1

I recently upgraded to Emacs 25. With Emacs 24, the menu bar never integrated with Unity. Emacs always had its own menu bar – Gnome 2 style. One of the first things I noticed after upgrading to Emacs 25 was that the menu bar integrated with Unity.

However, since then it sometimes integrated with Unity and sometimes doesn't in a seemingly random fashion.

How do I make Emacs's menu bar always integrate with Unity?

1

This was a fast one. I struggled with this for quite a bit but a few minutes after posting the question, I found the answer myself.

I got a keyboard shortcut (Ctrl + ß) for opening Emacs in addition to the default shortcut Unity provides (Ctrl + 4 because it's the 4th application in my launcher). Every time I use Unity's shortcut, Emacs' menu bar integrates nicely with Unity. Every time I use my own shortcut, it doesn't.

I then found that the exec line of Emacs' desktop file looks like this:

Exec=emacs25 %F

My own shortcut, however, executes emacs. I removed Emacs 24 and after launching Emacs via emacs, it actually launches Emacs 25, according to Help → About Emacs. Yet, the menu bar behaves differently.

When launching emacs25 from the command line, Emacs' menu bar integrates with Unity just like it does when using Unity's shortcut or when using the button in the launcher. I will now change my own shortcut to execute emacs25.

If anyone knows why Emacs behaves in this weird fashion, please let me know.

Development version

Edit: If you want to use the current development version of Emacs, first install it normally (with sudo make install). Then open a terminal, enter emacs (but don't hit enter) and press tab twice. You will be shown several program names, including one with with a version number. In my case, this is emacs-27.0.50. Then open /usr/local/share/applications/emacs.desktop and adapt the Exec line. So

Exec=emacs %F

becomes:

Exec=emacs-27.0.50 %F

Save the file and open Emacs as usual via its desktop file. The menus will be integrated into the window bars.

  • emacs25 isn't a normal binary name for a compiled emacs. I would think it is consistent that emacs and emacs-25.3 (or as appropriate for the version) are the two executable names which are built. Assuming that emacs25 isn't a typo, you may find that emacs and emacs-25.3 are identical, and emacs25 is something particular to Ubuntu which adds that Unity integration. – phils Nov 21 '17 at 21:42
  • @phils Nope, they all eventually point to the same binary. /usr/bin/emacs-25.325 on my machine. – UTF-8 Nov 21 '17 at 22:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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