I am switching to GNU emacs for my python and bash scripting. I really enjoy this, but I don’t like the X-window portion of emacs. As such, I always use emacs -nw <my_file> to edit my files. However, when I associate my .py and .sh files with emacs, I end up opening emacs in X-window mode when I double-click on them from gnome-nautilus (Ubuntu 10.10).
What I would like to know is: What should I add to my .emacs file in order to use emacs without X-window when I double click on my files? Note: I do want emacs to open a terminal, possibly resize it according to my specifications (already have a .sh script for that), launch itself and open my file.
How should I accomplish that?
Cheers!
EDIT: Thanks for all the answers! I have to give the check to the most complete one, although of course it builds on the preceding ones.
Building on Gareth’s answer:
To open a file in an existing emacs session if one is running, but open a new one in a terminal if there isn’t one, you can do the following:
(server-start)to your.emacsCreate a script
run_emacswith the following contents:and make it executable.
Set your application to open python and bash files to be
emacsclient -a /path/to/run_emacs %F(if you placerun_emacssomewhere in your$PATH, you can leave out the/path/to/bit).