Emacs hacks

I'm using XEmacs as my everyday editor. As I'm using it quite heavily, I customized it to fit my needs. Here are some things which might interest you. Note that they are tested with XEmacs 21.1 and some with GNU Emacs, but there's no guarantee they will work with the later.

XSLT-process minor mode

Check-out this minor mode I've created for applying an XSLT processor to an XML file you're editing in (X)Emacs.

XSLT editing and automatic header file creation

templates.el is a small package that helps automatic generation of the most common templates in an XSLT page, properly indented in the context. The following keybindings are provided:

In addition to this functionality, pressing the F8 key generates a header file properly set for the current file type. Of course, you can change any of the above bindings.

To install the package, just add it in your Emacs Lisp path and add this line to your .emacs file:

(require 'templates)

Bookmark navigation

This package allows navigation through bookmarks in (X)emacs. A bookmark is a reference point in a file you setup using C-M-. and you can remove using C-M-/. The created bookmarks are added into a bookmark history. The bookmarks have to be setup using these commands, if you're using the normal (X)emacs "set bookmark" feature, the created bookmarks will not be added to the bookmark history.

You can navigate between a list of bookmarks using a Netscape-like navigation: M-<left> takes you to the previous bookmark, M-<right> takes to the next bookmark in the history. If there's no bookmark to navigate to, nothing happens.

When you're using etags, a bookmark is setup automatically when you do a M-. to find a definition at the point in file you invoke find-tag. After etags takes you to the definition, you can use M- to go back in the source file you were before visiting the definition. Each time you use M-, to visit a new definition using etags, a bookmark is setup in the source file you're in. If you find a definition is not interesting and you're not interested in marking it in the bookmark history, you can remove it using C-M-/.

Updated (January 5, 2001): The source code is in the bookmarknav.el. This is an update of the previous version with lots of clean-up in it (thanks to Christoph Conrad for doing most of the work).

To set it up, put it in your Lisp path and add a

(require
'bookmarknav)
in your .emacs file.

Find file recursively

There are lots of times when you know there must be a file in a given directory structure whose name matches some regular expression, and you would like to open it. The directory structure however is quite large and you don't remember exactly in which directory the file is located.

The find-recursive.el extension allows you to open a file given a regexp and an directory to search into. To use it, add

(require 'find-recursive)
in your .emacs file, and type C-x M-f (easy to remember, as it's like the regular C-x C-f that opens a file). This will prompt you for a regexp and a directory. If there's only one file that matches the regexp in that directory, it is automatically opened. Otherwise, by typing TAB you get a list of the matching files from which you can choose.

Change the background color for remote displays

If you're editing files on multiple machines, sometimes is useful to have the background color changed to indicate an (X)emacs instance running on a remote machine. The remotedisplay.el does this. To install add the
(load "remotedisplay")
line to your .emacs file.

Home page

Last modified: Sun Jan 18 00:20:41 PST 2004