I run Ubuntu 16.04. On searching Ubuntu Software app for Emacs I am presented with two guis, Lucid and Gtk.
Which one should I choose and why?
Emacs Stack Exchange is a question and answer site for those using, extending or developing Emacs. It only takes a minute to sign up.
Sign up to join this communityI run Ubuntu 16.04. On searching Ubuntu Software app for Emacs I am presented with two guis, Lucid and Gtk.
Which one should I choose and why?
Examples from etc/PROBLEMS
:
** When Emacs is compiled with Gtk+, closing a display kills Emacs.
...
*** Emacs built with GTK+ toolkit produces corrupted display on HiDPI screen
*** Emacs built with GTK+ toolkit can unexpectedly widen frames
Recent example: Bug#25228 "custom-set-faces from init file ~/.emacs ignored" only affects GTK builds.
And generally, new GTK versions could cause breakage, but that's much less of a concern with Lucid.
Also, GTK builds regularly emit scary looking (but harmless??) assertion failures on stderr ;)
top
reports 374m virt, 45.5m resident for GTK emacs -Q
on startuptop
reports 340m virt, 31.0m resident for Lucid emacs -Q
on startupThe differences are in the menus, toolbars, and scrollbars (which default to the "wrong" side in Lucid). Lucid screenshot is first (I put the scrollbar on the right side, for easier comparison with GTK).
PS there is also an option to make a "Motif" build, but (almost) nobody uses that.
Lucid Emacs uses the older lucid widget toolkit for XWindows. It looks older and greyer and I see no compelling reason to use it on a modern X desktop. Unless of course you have specific reasons to run it:
tldr; if you have to ask, stick to Gtk GUI for normal use.
If you forward X11 you need Lucid emacs, because gtk emacs may crash if the ssh connection is lost and X server crashes.
Note the error message when trying to run emacs --daemon with gtk emacs
$ emacs --daemon
Warning: due to a long standing Gtk+ bug
https://gitlab.gnome.org/GNOME/gtk/issues/221
Emacs might crash when run in daemon mode and the X11 connection is unexpectedly lost.
Using an Emacs configured with --with-x-toolkit=lucid does not have this problem.
Daemon mode is THE preferred way of running emacs (numerous benefits), but the almost certain crash in the event of disconnect from the display is weighing in favour of the Lucid toolkit instead of Gtk.
Note that this happens on local instances also, i.e. you don't have to forward X11 for it to happen. Just start emacs in daemon mode, fire up an emacs frame and close the X server. Emacs will die. This does not happen with lucid, ugly as it is. This is not 'reportedly' more stable, it is a long standing documented buggy behaviour when compiling emacs with the Gtk toolkit.
Elaboration of this situation is in etc/PROBLEMS:
when Emacs is run as a server on a text terminal, and an X frame is created, and the X server for that frame crashes or exits unexpectedly, Emacs must exit to prevent a GTK error that would result in an endless loop.
If you need Emacs to be able to recover from closing displays, compile it with the Lucid toolkit instead of GTK.
Maybe also worth noting is that the Lucid toolkit can be somewhat directly customized via the good old .Xresources.
Just edit ~/.Xdefaults, issue an xrdb -merge ~/.Xdefaults
, and restart emacs. Gives back some flexibility, lost with Gtk+ themeing.
For example, these lines:
Emacs.pane.menubar.background: darkslateGrey
Emacs.pane.menubar.foreground: navajoWhite
Emacs*shadowThickness: 1
will yield this result:
menu face
. So there is no need to customize the menu via xrdb.
Note that NixOs also recently changed the default GUI to Lucid due to, notably, an increase of stability in the daemon mode (it was actually a debate). Note that the gtk build is still available with emacs-gtk
.