Prev: Next: Up: Top[Contents][Index]


13 Emacs Major Mode

Pound is distributed with pound-mode.el, an Elisp source which provides a major mode for editing pound configuration files in GNU Emacs. The file is located in src directory of the distribution. To install it, follow the instructions below.

First, select the directory where to place the file. The directory must form a part of the emacs load-path (see Library Search in GNU Emacs Lisp Reference Manual) variable. Then, copy pound-mode.el to that directory. Then, add the following statements to your .emacs or site-wide site-start.el file (see The Emacs Initialization File in GNU Emacs Manual):

(autoload 'pound-mode "pound-mode")
(add-to-list 'auto-mode-alist
             (cons (purecopy "pound\\.cfg\\'") 'pound-mode))

The first statement loads pound Emacs major mode. The second one associates file pound.cfg with that mode, so that each time you load a file with that name to your editor, it will automatically select pound-mode as its default major mode. Depending on your customs, you may further modify auto-mode-alist to associate pound-mode with more files. For example, if your main configuration file includes files from /etc/pound directory (see File inclusion), it might be a good idea to add the following:

(add-to-list 'auto-mode-alist
   (cons (purecopy "pound/.*\\.cfg\\'") 'pound-mode))

Once these changes done, you can start emacs to see if it correctly selects the major mode for your pound.cfg.

The pound-mode major mode highlights pound configuration keywords and data types, and provides automatic indentation for the configuration file. It defines the following key bindings:

C-M-a

Place cursor at the start of the enclosing section.

C-M-e

Place cursor at the end of the enclosing section.

C-M-\

Indent region.

C-c C-c

Check the syntax of the current buffer by running pound -c (see lint).

The following customization variables are available:

Customization Variable: pound-basic-offset

Default indentation increment. Each nesting level in the configuration file will be indented that amount of columns, relative to the enclosing section.

The default value is 8.

Customization Variable: pound-command

Command line for starting the pound daemon. Default is ‘pound’.

Use this variable to specify full pathname of the pound binary, if it cannot be found using the PATH shell variable, or to supply additional options to it.

Customization Variable: pound-include-dir

Defines pound include directory (see include directory).


Prev: Next: Up: Top[Contents][Index]