Tuesday, August 29, 2006

Emacs Tip: No More Than a Single Instance of Emacs

In my previous post on Emacs, I pointed out that after modifying the .emacs file to include the initialisation of gnuserv, there was an error message emitted when more than one instance of Emacs is launched.

This error comes from the fact that gnuserv only works if there is a single instance running.

As it turns out, this problem has a very simple solution. Instead of launching Emacs using the program runemacs.exe that comes with the aforementioned Emacs distribution, launch Emacs using the program gnuclientw.exe that comes with the gnuserv distribution from the previous post. This program will run Emacs as a client if gnuserv is already running, and if not, then it will run Emacs regularly.

This usage has a few nice effects. Firstly, no more than one Emacs window will exist; your desktop will stay tidy. Secondly, opening a file that is already open will take you to the same editing position; you don't risk editing the same file in two separate processes.

The only catch is that this requires re-associating all the file extensions to gnuclientw.exe instead of runemacs.exe and changing your shortcuts. Unfortunately, this is a bit of a pain under Windows, but worth-while when it's done.

I think that this post wraps up the "the essentials of how to get a great LaTeX environment for Windows" saga. There will be future posts, but they'll be about extra features (look for something on either folding or outlining soon). The basics are all nicely described now.

No comments:

Post a Comment