Next: , Previous: , Up: Files   [Contents][Index]


13.1 File Options and Type Hooks

The user specifies file options with a special syntax on the first line of a file. If the first line contains the string "-*-", then Hemlock interprets the text between the first such occurrence and the second, which must be contained in one line , as a list of "option: value" pairs separated by semicolons. The following is a typical example:

;;; -*- Mode: Lisp, Editor; Package: Hemlock -*-

See the Hemlock User’s Manual for more details and predefined options.

File type hooks are executed when Hemlock reads a file into a buffer based on the type of the pathname. When the user specifies a Mode file option that turns on a major mode, Hemlock ignores type hooks. This mechanism is mostly used as a simple means for turning on some appropriate default major mode.

Macro: define-file-option name (buffer value) {declaration}* {form}*

This defines a new file option with the string name name. Buffer and value specify variable names for the buffer and the option value string, and form’s are evaluated with these bound.

Macro: define-file-type-hook type-list (buffer type) {declaration}* {form}*

This defines some code that process-file-options (below) executes when the file options fail to set a major mode. This associates each type, a simple-string, in type-list with a routine that binds buffer to the buffer the file is in and type to the type of the pathname.

Function: process-file-options buffer &optional pathname

This checks for file options in buffer and invokes handlers if there are any. Pathname defaults to buffer’s pathname but may be nil. If there is no Mode file option that specifies a major mode, and pathname has a type, then this tries to invoke the appropriate file type hook. read-buffer-file calls this.


Next: Pathnames and Buffers, Previous: Files, Up: Files   [Contents][Index]