GNU Emacs setup - no window

I am switching to GNU emacs for python and bash scripts. I really like this, but I don't like the X-window part of emacs. That way, I always use emacs -nw <my_file> to edit my files. However, when I link my .py and .sh files to emacs, I end up opening emacs in X-window mode when I double-click them from gnome-nautilus (Ubuntu 10.10).

What I would like to know: 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 want emacs to open a terminal, possibly changing it according to my specifications (there is already an .sh script for this), run it myself and open my file.

How to do it?

Hooray!

EDIT : Thanks for all the answers! I have to give the most comprehensive verification, although, of course, it is based on the previous ones.

+4
source share
3 answers

Based on Gareth's answer:

To open a file in an existing emacs session if it is running, but open a new one in the terminal if it is not there, you can do the following:

  • Add (server-start) to your .emacs
  • Create a run_emacs script with the following contents:

     #!/bin/bash gnome-terminal -e "emacs -nw $@ " 

    and make it executable.

  • Define the application to open python and bash files as emacsclient -a /path/to/run_emacs %F (if you place run_emacs somewhere in your $PATH you can leave the /path/to/ bit).

+3
source

Johan explained what to do if you want to run a separate Emacs process for each file.

But usually you want to start one Emacs process and organize the opening of files in new buffers in an already running Emacs process.

To do this, you need to start the Emacs server the first time you start Emacs (for example, by running the server-start command or putting (server-start) in your .emacs ) and organizing Gnome to start the emacsclient program.

+3
source

If you are using gnome, you need to change the command line parameter for the emacs shortcut from

/ usr / bin / emacs% F

to

gnome-terminal -e "/ usr / bin / emacs -nw% F"

This can be done by right-clicking in the "Application" menu, select "Edit Menu".

+1
source

All Articles