this post was submitted on 23 Nov 2023
3 points (100.0% liked)

Emacs

311 readers
2 users here now

A community for the timeless and infinitely powerful editor. Want to see what Emacs is capable of?!

Get Emacs

Rules

  1. Posts should be emacs related
  2. Be kind please
  3. Yes, we already know: Google results for "emacs" and "vi" link to each other. We good.

Emacs Resources

Emacs Tutorials

Useful Emacs configuration files and distributions

Quick pain-saver tip

founded 1 year ago
MODERATORS
 
top 25 comments
sorted by: hot top controversial new old
[–] [email protected] 1 points 11 months ago (1 children)

I find it looks and performs* better in WSL1 with GWSL

*until I access files in the Windows volumes.

[–] [email protected] 1 points 11 months ago

I didn't know gwsl works for wsl1. I'm gonna give it a try. WSL1 is so much better if you exclude missing syscalls.

[–] [email protected] 1 points 11 months ago (2 children)

You can try emacs-pgtk package, cause WSLg relies on Wayland

[–] [email protected] 1 points 11 months ago (1 children)

Yep that's what finally caused me to switch to using Emacs on WSL2 (instead of the Windows build). Then you can also get rid of that ugly white border from WSLg.

[–] [email protected] 1 points 11 months ago (2 children)

any details on that white border stuff? pgtk didnt autofix it for me in the past and id love to not have it searing my eyes

[–] [email protected] 1 points 11 months ago

Not sure if there's something else missing in your setup. I'm using WSL2 (Ubuntu), and in my case all I had to do was compile Emacs passing the --with-pgtk flag, then:

sudo apt install gnome-tweaks yaru-theme-gtk yaru-theme-icons

And ran gnome-tweaks in the terminal, and changed the application and icon themes to Yaru-dark.

[–] [email protected] 1 points 11 months ago

that sometimes happens when wslg has issues with bind mounting the runtime dir from the system distro or runtime dir permissions, were you by chance using it with a uid != 1000?

[–] [email protected] 1 points 11 months ago (2 children)

I downloaded the source code for emacs and compiling it locally with the --with-pgtk flag. (And --with-native-compilation for better performance)

That made my life improve a lot.

[–] [email protected] 1 points 11 months ago

takes notes

[–] [email protected] 1 points 11 months ago (1 children)

You can also install pgtk emacs directly from snaps when under Ubuntu in wsl, if you prefer.

[–] [email protected] 1 points 11 months ago (1 children)

I get a warning when compiling emacs from source with the pgtk flag telling me about a known bug in my version of gtk that causes problems when opening and closing multiple emacs instances. Do you know anything about this? In particular would it be resolved by switching to the snap?

[–] [email protected] 1 points 11 months ago

I have no idea about that compilation issue you get. Since the emacs snaps (pgtk and x) are pre built binaries, you wont get that problem. Ive been using Emacs PGTK from snaps on WSLg for a year without any issue.

[–] [email protected] 1 points 11 months ago

Interesting. I'll have to investigate. I use wsl2 and always have. I'll report back if I notice some differences.

[–] [email protected] 1 points 11 months ago

First and foremost these are different fonts, so it's hard to draw a comparison. However, I do agree that the font used in the gui lacks crispness.

[–] [email protected] 1 points 11 months ago

It looks a lot like when an app doesn't know about the current fractional scaling. Are you doing any scaling?

[–] [email protected] 1 points 11 months ago

Looks like you have application scaling enabled.

[–] [email protected] 1 points 11 months ago

My fonts look OK but they're different fonts (and I'm running Citrix thin clients etc so that may well be messing with ability to do sub-pixel tweaking etc).

And I actually like my "native" and "wsl" emacs to look different... I share init.el files (~/.emacs.d/ is a symlink to /mnt/c/Users/... etc) but make sure I use different themes and change the frame title to make it easy to distinguish between the two instances.

https://preview.redd.it/eu42hdi1652c1.png?width=1542&format=png&auto=webp&s=73cfb262d81b84a56950b13d5bed026f9058a08e

I know I could do it all in just one instance but somehow this just feels cleaner for my cross-platform dev work...

[–] [email protected] 1 points 11 months ago

I had this issue, then compiled emacs --with-pgtk and fonts became way better.

However, recently, wsl2 was updated in my win11 and out of curiosity I had recompiled emacs without pgtk and fonts are actually crisp and look the same as --with-pgtk.

I am staying with X due to better clipboard support, though, ugly white borders are something you have to "embrace" :)

[–] [email protected] 1 points 11 months ago

To get rid of the ugly border you can recompile wslg and set the colors to something different. You can also use something like X410 to handle your X windows, which is where I ended up.

[–] [email protected] 1 points 11 months ago

just use M-x set-frame-font to adjust font settings and improve crispness in wsl2.

[–] [email protected] 1 points 11 months ago (1 children)

Just run the native Windows binary of Emacs. It uses the native Windows font rendering APIs, so the text should end looking the same as it does in other Windows applications (assuming it's the same font and size, of course). The Linux version that you’re running uses a completely different font renderer, so it will be very hard to make it match exactly.

[–] [email protected] 1 points 11 months ago (1 children)

I don't know much about wsl but they probably want to develop on headless linux why still being able to use GUI Emacs.

[–] [email protected] 1 points 11 months ago (1 children)

That doesn’t make any sense. WSL is not a headless Linux.

[–] [email protected] 1 points 11 months ago (1 children)

It actually is, you can't run a desktop enviroment with it for example but it does let you open linux gui apps to be used from windows.

[–] [email protected] 1 points 11 months ago

That’s exactly why it’s not headless.