18

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?

1
  • 1
    Further to Peter's answer, see also here re: stability. I too switched to lucid for increased stability, e.g. when killing X.
    – Basil
    May 26, 2017 at 14:56

5 Answers 5

28

Reasons to use Lucid over GTK

Stability

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 ;)

Resource consumption

  • top reports 374m virt, 45.5m resident for GTK emacs -Q on startup
  • top reports 340m virt, 31.0m resident for Lucid emacs -Q on startup

Reasons to use GTK over Lucid

Supports some fancier features

It looks nicer

The 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).

Screenshot of Lucid build Screenshot of GTK build


PS there is also an option to make a "Motif" build, but (almost) nobody uses that.

2
  • 1
    I believe the double-buffering fix is for all toolkits: "This extension allows us to reuse our existing drawing code and redirect it to an off-screen buffer. GTK+ or Lucid or Motif or whatever we’re using is oblivious." -- facebook.com/notes/daniel-colascione/buttery-smooth-emacs/…
    – phils
    May 27, 2017 at 8:46
  • 1
    oh, thanks @phils, I guess since most of that post talks about GTK I somehow got the idea that it was GTK specific. I never saw any flickering personally (apparently I have a "pure soul") so it's all theoretical to me anyway.
    – npostavs
    May 27, 2017 at 13:05
9

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:

  • run emacs in server mode on the background where the lucid version is reportedly more stable
  • run on very stripped down X server configurations

tldr; if you have to ask, stick to Gtk GUI for normal use.

2
  • 4
    I would be more inclined to say "if you're actually aware that you have a choice, then choose lucid". You might not have encountered problems with GTK (and maybe you never will), but they're a well-known issue, so why risk encountering them in future when you can side-step them completely?
    – phils
    May 27, 2017 at 8:40
  • lucid looks awful and the "more stable" argument doesn't really hold as the gtk version is pretty damn stable in its own right.
    – RichieHH
    Aug 16, 2020 at 17:57
5

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.
1
  • The answer might be more helpful if you elaborate a bit.
    – Drew
    Aug 27, 2020 at 3:35
4

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:

enter image description here

1
  • I see a change in colors while Emacs 29 is started. So it works as expected but is changed again to values defined within a theme. In other words Emacs can customize the Menu by setting a menu face. So there is no need to customize the menu via xrdb.
    – Claudio
    Mar 30 at 18:56
1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.