setq-default

Macro

Package: top-level

Arguments: symbol value

This macro does two things: (1) it sets the global value (as returned by global-symbol-value) of symbol to be the value of value (note: symbol is not evaluated, value is evaluated, just as in setq); (2) checks the relevant alists and modifies them as necessary.

Here is exactly what happens in (2). The system checks whether symbol is the key of any pair in the alist which is the value of *default-lisp-listener-bindings*; if it is, the system changes the value of that pair to

(sys:global-symbol-value variable)

If symbol is not the key of any pair on *default-lisp-listener-bindings*, the system checks whether it is the key of any pair on *cl-default-special-bindings*; if it is, the system changes the value on that alist as above. If the symbol is not the key of a pair on either list, the system adds the pair

(variable . (sys:global-symbol-value symbol))

to the *cl-default-special-bindings* alist.

The variable *default-lisp-listener-bindings* is used by the system only when listener processes (including the Initial Lisp Listener which provides the prompt when Lisp comes up) are created. Therefore, only those processes will see the value on the alist and the symbol will be bound (meaning that changing it with setf and setq will affect that process only) on listeners. This macro does not affect the binding of any running process. You should use this macro in your .clinit.cl or sys:siteinit.cl files and in custom.cl (used when the Lisp image is built - see building-images.htm) only for those symbols already on the *cl-default-special-bindings* alist or the *default-lisp-listener-bindings* alist unless you want to bind the symbol in Lisp-listener processes. Note further the form

(setq variable value) 

in the sys:siteinit.cl, .clinit.cl file or custom.cl file will usually not change the value for a listener process for any variable that does appear in either of the lists because the values on the lists are often specific values (t or nil or 10) and the binding is made to that specific value.

This operator is not available in Lisp images built with a minimal top level, that is built with the include-tpl argument to build-lisp-image specified nil. See Minimal top levels in building-images.htm for information on minimal top levels.

See top-level.htm for more information on the top level.

The documentation is described in introduction.htm and the index is in index.htm.

Copyright (c) 1998-2000, Franz Inc. Berkeley, CA., USA. All rights reserved.

Created 2000.10.5.