2 Customizing the Lisp Environment

2.2 The default startup function

The default startup function is invoked whenever you start up Lisp and have not rebound the variable*enter-top-level-hook*; the function reads the command line that invoked Lisp and parses all of the command-line arguments. Unless the command-line arguments specify otherwise, the function then searches your home directory for an initialization file and loads it if possible. Section 2.4 on page 9 presents more information about initialization files.

The default startup function parses command-line arguments in the order they appear on the command line. It recognizes and executes the following options:

These arguments indicate that the startup function should load the specified file by using the functionload; the file argument is passed to load as a string.

The following example demonstrates how to load the file"~/.lisp" instead of the regular initialization file:

% lisp -load ~/.lisp -n
These arguments inhibit the loading of the initialization file. If you do not specify one of these arguments, the initialization file is loaded after all of the other command-line arguments have been processed. The following example uses the abbreviated version of these arguments:

% lisp -n
These arguments pass the specified form to Lisp for evaluation. Any return value is lost; thus, the form argument can only produce side effects. The following example uses one of these arguments to make Lisp print in hexadecimal; the double quotation marks prevent interpretation of the form by the operating system shell.

% lisp -eval "(setq *print-base* 16)"
These arguments call the functionquit, which terminates the Lisp environment. In the example, the file"demo" is loaded, the function demo is called, but Lisp quits before it enters top level.

% lisp -load "demo" -eval "(demo)" -quit
The startup function ignores all other command-line arguments; however, they are available for processing by the functioncommand-line-argument.


The Advanced User's Guide - 9 SEP 1996

Generated with Harlequin WebMaker