How to use one instance of emacs as the default text editor? [Linux]

What I would like to achieve

  • one instance of emacs
  • If I open any text file from nautilus, it should open in the current emacs instance
  • If I close emacs, it should not really close it, just hide it

What I have now

  • I installed emacs23 to start at startup
  • I have (start-server) in my init
  • I leave emacs open
  • I have emacsclient as the default text editor

Problems I encountered while trying to achieve the desired

  • emacs gives the following error if I exit emacs and try to start it again

File error: Unable to bind server socket, address already in use

Things i tried

Update: I tried the stackoverflow link again and now most of them work. However, something I would like to do is reload the initialization file so that I can make changes to the initialization file without restarting the computer. Any ideas?

Also, if the server is running and I have emacs false-closed (see the emacs fu link), how can I start it again without downloading the file? for example, what would be the equivalent of starting emacs23, since this does not work (see the error above)

+8
linux emacs ubuntu
Dec 16 '10 at 8:37
source share
4 answers
  • remove (start-server) from .emacs
  • use emacsclient "$@" -a "" to start emacs, whether it works or not.

If you save emacsclient "$@" -a "" as a script, for example. in editor , then editor -c creates a new frame, editor -t opens a new frame in the terminal, and editor FILE visits FILE in the existing frame. It starts the emacs server if it is not running.

+18
Dec 16 '10 at 12:52
source share

I run emacs with emacs --daemon so that emacs starts in demonized mode. Then I installed EDITOR in emacsclient -t -a emacs -nw , which will open a new emacs terminal frame attached to your emacs daemon, with the version of emacs "no window" used as an alternative if the emacs server is not working. To open emacs windows in the GUI, I have the emacsclient -n -c -a emacs editor emacsclient -n -c -a emacs .

It is also possible to run more than one instance of emacs on the same machine if you do not want the buffers from one project to mix with the buffers from another project. See my my post on this subject.

+2
Dec 16 '10 at 17:12
source share

However, I would like to be able to reload the initialization file, so that I can make changes to my init file without restarting the computer.

Looking through the methods that underlie the daemon effect you are looking for, none of them seem to allow you to simply load your initialization file and invoke the eval-buffer call after making the changes.

Also, if the server is running and I have emacs false-closed (see the emacs fu link), how can I start it again without downloading the file?

Running emacsclient (rather than emacs23 ) should do the trick, I would think.

+1
Dec 16 '10 at 16:30
source share

Hmm, I'm not sure about running emacs as a client, but I often review and apply changes to the .emacs file without closing emacs.

Just edit the file (inside or outside emacs, no matter which). Mx load-file, emacs will ask you for the path and file name, which is easy if it is ~ / .emacs.

Enter the path and file name, then RET and emacs will reboot with your changes. The buffers you opened will still be there.

+1
Jan 27 '11 at 16:39
source share