2 Customizing the Lisp Environment
*autoload-verbose*controls the printing of messages that are displayed when functions or macros are loaded by the autoloading facility.
nilvalue, a message is printed whenever an autoloadable function or macro is loaded. The default value is
t. If the value is
nil, no message is printed.
autoloadablepis true if its argument is a symbol that names an autoloadable function or macro; otherwise, it is false.
command-line-argumentreturns a string representing a command-line argument that was provided when Lisp was invoked. The command-line arguments are accessed by a position number, where
nilfor positions that exceed the total number of command-line arguments specified.
;; Assume you invoked Lisp with no command-line arguments. > (command-line-argument 0) "lisp"define-autoload Function
> (command-line-argument 1) NIL
define-autoloadname filename type
&key :arglist :documentation
define-autoloadprovides a functional interface for autoload definitions. It evaluates all of its arguments.
define-autoloadaccepts the following keyword arguments:
defmacro-autoloaddefines an autoloadable macro.
defmacro-autoload. The filename argument is a string or a pathname that names the file containing the definition for the macro.
arglist. The optional documentation argument is the macro's documentation string, which is accessible to the Common Lisp function
&optional arglist documentation
defun-autoloaddefines an autoloadable function.
defun-autoload. The filename argument is a string or a pathname that names the file containing the definition for the function.
;;; The unevaluated argument (x &rest args) becomes the argument ;;; list for FOOD. The argument list is correctly defined when ;;; the file is loaded. > (defun-autoload (food "/lnz/pizza") (x &rest args) "This function teaches someone how to eat pizza. If the number of arguments given to FOOD exceeds 4, the pizza is served with anchovies.") FOOD
> (arglist 'food) (X &REST ARGS)
&key :restart-function :full-gc :gc :reserved-free-segments :dynamic-free-segments :verbose
disksavesaves a copy of an executing Lisp image on disk.
:full-gchas a non-
nilvalue, a garbage collection is performed before the image is saved. After the garbage collection, all dynamic storage is converted to static storage. Objects converted from dynamic storage to static storage are never recopied during a garbage collection; however, they are scanned for pointers to update. As a result, large systems that are loaded into Lisp and saved can have fewer garbage collections, and these garbage collections might take less time to complete.
:gchas a non-
:full-gcis unspecified or
nil, a normal garbage collection is performed before the image is saved. Due to memory management constraints,
disksavecan force a garbage collection in addition to any requested through use of the
:full-gcis specified, the saved image might contain all of the garbage that is currently in the image, and therefore the files saved on disk can be considerably larger than necessary. When you call
nilvalue, the progress of the saving process is reported to the terminal. Due to memory management constraints,
disksaveprints its messages using primitive input and output functions; thus, the messages might not appear in scripts created by the Common Lisp function
nilvalue, the portions of the Lisp image that normally would be loaded into read-only memory are loaded into writable storage when the saved image is invoked.
:aoption to abort to the top level of Lisp and invoke
disksaveis invoked, the window environment is temporarily suspended. Once the
disksavefunction has saved the Lisp image on disk, the windows of the running Lisp image are restored automatically to the state they were in before the
disksavefunction call. To restore the state of the windows when the saved image is executed, call the function
initialize-windowsor the function
edwith no arguments. If you initialized the Window Tool Kit while using a specific type of X display server, you might not be able to initialize windows in the saved image under a different type of X server. You should always start a new image under the same type of X display server that you used when you saved the image. See The Window Tool Kit for more information about the Window Tool Kit.
foreign-variable-pointerand those created by the function
make-foreign-pointerwhen the value of the
:statickeyword argument is non-
nil. See Section 220.127.116.11 on page 97 for more information.
ensure-autoloadeddetermines if the specified autoloadable constructs have been loaded; it loads any constructs that have not been loaded.
*enter-top-level-hook*controls the behavior of Lisp when an image is started.
(load (merge-pathnames "lisp-init" (user-homedir-pathname)) :if-does-not-exist nil)
*enter-top-level-hook*must be bound to a compiled function to provide an extra measure of error checking.
;;; This example assumes you are working in a Lisp image named ;;; MYLISP. After *ENTER-TOP-LEVEL-HOOK* is bound, the image ;;; is saved on disk. The next time MYLISP is started up, the ;;; appropriate message appears. > (defun ignore-lisp-init-file () (format t "Ignoring lisp init-file name~%")) IGNORE-LISP-INIT-FILE
> (compile 'IGNORE-LISP-INIT-FILE) IGNORE-LISP-INIT-FILE
> (setq *enter-top-level-hook* #'IGNORE-LISP-INIT-FILE) #<Compiled-Function IGNORE-LISP-INIT-FILE 522507>
> (disksave "mylisp") "mylisp" > (quit) % mylisp ;; After executing its initialization routines, Lisp responds ;; with this message. Ignoring lisp init-file name >
environment-variablereturns the string value of a specified environment variable. The function returns
nilif the variable does not exist.
setfto assign a value to the variable. If the variable already exists, its value is reassigned. If the variable does not exist, a new environment variable is created. If you set the value of the variable to
nil, the variable is deleted.
run-program; the programs that are invoked inherit the modifications. Environment variables that have been changed or added revert to their original values when Lisp exits.
> (environment-variable "SHELL") "/bin/csh"
> (setf (environment-variable "SHELL") nil) NIL
> (environment-variable "SHELL") NIL
> (setf (environment-variable "SHELL") "/bin/sh") "/bin/sh"
> (environment-variable "SHELL") "/bin/sh"
shell(in The User's Guide)
lisp-image-namereturns the pathname of the object file that started the current invocation of Lisp. If the object file cannot be determined, the function returns
> (lisp-image-name) #P"/usr/local/bin/lisp"*prompt* Variable
*prompt*specifies the string to be used as a prompt in the top-level read-eval-print loop. Initially,
*prompt*is unbound and the default prompt string (>) is used.
> (setq *prompt* "at your service! ") NIL at your service! 999 999 at your service! (makunbound '*prompt*) *PROMPT*set-disksave-parameters Function
> 999 999
set-disksave-parameters &key :reserved-free-segments :dynamic-free-segments :verbose
set-disksave-parameterssets the default values for certain keyword arguments to the function
Initial values of
Keyword Platform Initial Value
SGI 67 all others 3
HP 20 SGI 28 all others 90
:stack-segments (HP only)
working-directoryreturns the current working directory as a pathname.
*default-pathname-defaults*is set to the new working directory.
working-directoryto set the current working directory; this method of setting the working directory is preferable to explicitly setting the variable
*default-pathname-defaults*because it keeps the operating system and the variable synchronized.
> (working-directory) #P"/liquid/bin/"
> (setf (working-directory) "/u/win/") #P"/u/win/"
> (working-directory) #P"/u/win/"
> (setf (working-directory) "/scratch/") #P"/scratch/"
> (working-directory) #P"/scratch/"
> (setf (working-directory) (user-homedir-pathname)) #P"/u/win/"
> (working-directory) #P"/u/win/"
> (pwd) #P"/u/win/"
pwd(in The User's Guide)
Generated with Harlequin WebMaker