Guido Krüger's Web Service

Emacs Configuration


General configuration

I'm using GNU Emacs 19.34.6 under Windows 95 for source code creation all the time. Currently, I'm using the standard java mode which is part of the cc-mode.el package (maybe JDE would be a better alternative, but I did not really try yet). I added a couple of customizations to support more intuitive key bindings and to allow for proper syntax highlighting with Java files. Feel free to download a zipped version of the .emacs and .emacs.local files to get some nice features. However, be sure to understand that I'm neither a GNU Emacs nor a LISP expert! Most of what I did here was by trial-and-error.

Some of the code needs further modification. For example, the filedoc function uses my name as author name which you might want to change. There are also some non-Java customizations in the file which you might simply ignore.

The following lines are part of my autoexec.bat file to provide Emacs support:

rem ***GNU Emacs********************
set HOME=d:\emacs
set emacs_dir=d:\emacs
set SHELL=d:\emacs\bin\cmdproxy.exe
set EMACSLOADPATH=%emacs_dir%\lisp
set EMACSDATA=%emacs_dir%\etc
set EMACSPATH=%emacs_dir%\bin
set EMACSLOCKDIR=%emacs_dir%\lock
set INFOPATH=%emacs_dir%\info
set EMACSDOC=%emacs_dir%\etc
set TERM=CMD
set USER=guido
As you might guess, Emacs is installed in the d:\emacs directory. I had no luck with installation directories of different names.

I usually start Emacs from a DOS box or shell window using a batch file called emacs.bat with the following content:

@echo off
%emacs_dir%\bin\runemacs.exe %1 %2 %3 %4 %5 %6 %7 %8 %9
I also have a desktop icon which points to d:\emacs\bin\runemacs.exe in the d:\emacs\bin directory.

Further notes

My .emacs file includes another file called .emacs.local near the beginning. This file is used to store machine specific information which should not be ported to another machine. For example, if you have different screen sizes at work and at home, you may freely exchange the .emacs file as long as you keep each .emacs.local in place. Just use the .emacs.local sample from the zip file - it gives you a good starting point for your own customizations. The .emacs.local must be in the same directory as .emacs (usually \emacs).

There is another feature worth mentioning. After closing Emacs, it creates a file .emacs.files in the working directory from where you started Emacs. In this file, the names and positions of all open files are stored and used to memorize the current state for the next session. When starting Emacs the next time, all currently open files are re-opened and the cursor is placed at its old position. If you don't like this feature, simply disable the gk-state-saver function and uncomment the load-file statement near the end of .emacs.


© 1995-2004 Guido Krüger - Last updated 31 Dec 2003 - Back to top-level page