2008-10-15

Emacs server + GNU screen daemon <-> Emacsclient + GNU screen

If the server mode of Emacs is activated and files are opened through emacsclient, opening files by Emacs can be as fast as vim. But you can see it running on you desktop anyhow, a showing window or a foreground process. Can we make it a background job? Yep, Screen can do the trick for us and I believe this can increase our productivity to a greater extent.

The first thing we need to do is to know how to activate server mode in Emacs. You can just type
M-x server-start
or put
(server-start)
in .emacs file.

Next, run emacs inside a screen started as a daemon,
screen -dmS emacs emacs-snapshot -nw

Note that the emacs used here is the snapshot version built from CVS repository. Only the CVS version of emacsclient supports the -t option that will be talked later.

Then, use emacsclient to edit a file called foo.txt
emacsclient.emacs-snapshot -t foo.txt

That's it. Happy emacsing.

3 則留言:

  1. Anonymous8:53 下午

    you don't know we have emacs daemon mode now?

    回覆刪除
  2. This is new to me. I'll check it out.

    Thanks for the tip.

    回覆刪除
  3. >emacs --help

    --daemon start a server in the background.

    Although it claims that a server is started in the background, you still have to load the server mode before using emacsclient to edit files.

    回覆刪除