Emacs Start Scripts
I tend to run Emacs in a wide variety of environments - sometimes I have X11 available, sometimes not. If I do, I usually work with several terminal windows simultaneously, and I don't want Emacs to get in the way of that, nor do I want more than one instance running at once. Emacs has the facilities to accomodate all these requirements, but it requires you to run it The Right Way(tm) depending on the situation. That's why I came up with these three shell scripts to make my life easier.
How It Works
All three scripts examine the environment to see if X11 is available (i.e. DISPLAY is set). If it isn't, they just run Emacs in the terminal and wait for it to terminate. If X11 is available, the scripts check if there is an emacsserver running. If there is, they'll run emacsclient to load the files in the already running Emacs. If not, they'll start up a new one in the background and enable emacsserver if applicable.
The three scripts have slightly different semantics and uses:
Just put the scripts where your shell will find them and make sure they are executable. ~/bin is a good place usually.
By default, the scripts run emacs or emacsclient. If you want them to start other commands, you can put a file named .emacsconfig in your home directory and set the shell variables EMACS and EMACSCLIENT in it (/bin/sh syntax). For example, if you're running Debian with both Emacs 20 and Emacs 21 installed, but want to run Emacs 20, you can use this:
The scripts themselves were tested on Linux and Mac OS X using the respective /bin/sh shells - bash and zsh. It is assumed they will run on any Unix-type system.
The functionality was tested with GNU Emacs 20 and GNU Emacs 21. I haven't tested XEmacs, but expect it to work. I tried using the scripts with the Mac OS X native (i.e. Aqua) port of GNU Emacs 21 and it didn't work - I have no idea why, but then again, I wasn't surprised.
|Dec 9, 2002||Copyright © 2002-2011 Christoph Pfisterer|