In file explorer (Nautilus) under Ubuntu, I can select a file and right click and scroll to:
open with other application
My question is how can I add emacs
to that list of "other application"
In file explorer (Nautilus) under Ubuntu, I can select a file and right click and scroll to:
open with other application
My question is how can I add emacs
to that list of "other application"
After we had installed emacs we may not yet have a .desktop file to integrate it with the desktop environment.
We then can copy the
emacs23.desktop
file if located in/usr/share/applications
or we can create a custom emacs.desktop file in~.local/share/applications
, e.g. with the following content (add further options at your needs).We can then select Emacs in the list of "Open With Other Applications -> Show other applications" on right click of a file with a content we want to associate Emacs with.
After having selected the now present Emacs (note that there is no icon defined yet if using a custom dektop file, give the path to an icon in your emacs.desktop above) we can then choose to "Open with Emacs" in the Nautilus context menu:
To undo this we simply right click on the Emacs entry in the menu that pops up after having selected "Open With Other Application..." and say "Forget association": (Forget association option does not exist for Ubuntu 16.04 and later)
I use emacs-snapshot available here (the latest release, good if you want to extend your environment with additional packages) and this is my
~/.local/share/applications/emacs-snapshot.desktop
entry that adds files into the existing emacs instance as a new buffer instead of creating a new window every time (way faster and you can easily switch usingC-x b
- even cooler with IDO-mode enabled).Note that for emacsclient to work, you need to have this in your
~/.emacs
configuration file: