2 Customizing the Lisp Environment
*autoload-verbose*
*autoload-verbose*
controls the printing of messages that are displayed when functions or macros are loaded by the autoloading facility.
nil
value, a message is printed whenever an autoloadable function or macro is loaded. The default value ist
. If the value isnil
, no message is printed.
autoloadablep
name
autoloadablep
is true if its argument is a symbol that names an autoloadable function or macro; otherwise, it is false.
defmacro-autoload
, defun-autoload
command-line-argument
argument-number
command-line-argument
returns a string representing a command-line argument that was provided when Lisp was invoked. The command-line arguments are accessed by a position number, wherenil
for 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-autoload
name filename type&key :arglist :documentation
define-autoload
provides a functional interface for autoload definitions. It evaluates all of its arguments.
'function
or'macro
.
define-autoload
accepts the following keyword arguments::arglist
arglist
.
:documentation
documentation
.
defmacro-autoload
name filename&optional
arglist documentation
defmacro-autoload
defines 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 functiondocumentation
.
defun-autoload
defun-autoload
name filename&optional arglist documentation
defun-autoload
defines an autoloadable function.
defun-autoload
. The filename argument is a string or a pathname that names the file containing the definition for the function.
documentation
.
;;; 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)
defmacro-autoload
disksave
target-file&key :restart-function :full-gc :gc :reserved-free-segments :dynamic-free-segments :verbose
disksave
saves a copy of an executing Lisp image on disk.
disksave
::restart-function
:full-gc,
:gc
:full-gc
has a non-nil
value, 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.
:gc
has a non-nil
value and:full-gc
is unspecified ornil
, a normal garbage collection is performed before the image is saved. Due to memory management constraints,disksave
can force a garbage collection in addition to any requested through use of the:full-gc
and:gc
keyword arguments.
:gc
nor:full-gc
is 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 calldisksave
, specifying:gc
or:full-gc
is recommended.
:reserved-free-segments
:dynamic-free-segments
disksave
.
:verbose
nil
value, the progress of the saving process is reported to the terminal. Due to memory management constraints,disksave
prints its messages using primitive input and output functions; thus, the messages might not appear in scripts created by the Common Lisp functiondribble
.
:writable
.:writable
nil
value, 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.
nil
.
:stack-segments
.:stack-segments
:a
option to abort to the top level of Lisp and invokedisksave
again.
disksave
is invoked, the window environment is temporarily suspended. Once thedisksave
function has saved the Lisp image on disk, the windows of the running Lisp image are restored automatically to the state they were in before thedisksave
function call. To restore the state of the windows when the saved image is executed, call the functioninitialize-windows
or the functioned
with 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-pointer
and those created by the functionmake-foreign-pointer
when the value of the:static
keyword argument is non-nil
. See Section 4.1.2.7 on page 97 for more information.
ensure-autoloaded
names
ensure-autoloaded
determines if the specified autoloadable constructs have been loaded; it loads any constructs that have not been loaded.
*enter-top-level-hook*
*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.
*enter-top-level-hook*
is unbound.
;;; 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 >
disksave
, load
environment-variable
variable-name
environment-variable
returns the string value of a specified environment variable. The function returnsnil
if the variable does not exist.
setf
to 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 tonil
, the variable is deleted.
shell
orrun-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"
run-program
;shell
(in The User's Guide)
lisp-image-name
lisp-image-name
returns the pathname of the object file that started the current invocation of Lisp. If the object file cannot be determined, the function returnsnil
.
> (lisp-image-name) #P"/usr/local/bin/lisp"*prompt* Variable
*prompt*
*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-parameters
sets the default values for certain keyword arguments to the functiondisksave
.
disksave
.
disksave
working-directory
working-directory
returns the current working directory as a pathname.
*default-pathname-defaults*
is set to the new working directory.
setf
withworking-directory
to 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/"
cd
,pwd
(in The User's Guide)
Generated with Harlequin WebMaker