Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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"

share|improve this question
    
Which emacs package do you have installed? Also, what type of file are you expecting to see this on? –  dobey Apr 19 '13 at 17:42
add comment

2 Answers

up vote 2 down vote accepted

After we had installed emacs Install 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/application, e.g. with the following content (add further options at your needs).

[Desktop Entry]
Name=Emacs 23
Comment=
Exec=/usr/bin/emacs23 %F
Icon=
Terminal=true
Type=Application

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.

enter image description here

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:

enter image description here

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":

enter image description here

share|improve this answer
    
Thanks for the answer - I couldn't get this working before. I was missing the %F flag in my emacs.desktop file. –  kermit666 May 18 '13 at 13:46
add comment

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 using C-x b - even cooler with IDO-mode enabled).

[Desktop Entry]
Name=Emacs-kermit
Version=1.0
GenericName=Emacs
Comment=GNU Emacs Snapshot Client
Exec=/usr/bin/emacsclient.emacs-snapshot -a 'emacs' %F
TryExec=emacs-snapshot
Terminal=false
Type=Application
Icon=emacs-snapshot
Categories=Development;Utility;TextEditor;
MimeType=text/plain;

Note that for emacsclient to work, you need to have this in your ~/.emacs configuration file:

(load "server")
(unless (server-running-p) (server-start))
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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