6.2 The Source File Recording Facility
discard-source-file-infodiscards all recorded source file information. This function allows you to reduce the size of an image; it is particularly useful before an image is saved.
discard-source-file-infodoes not affect the setting of
&optional type want-list
get-source-filereturns information about the file or files in which the specified object is defined.
nil, its value can be either
structure, or a definition type that you have created by using the function
get-source-filesearches for only a specific type of definition. If the definition exists, the pathname of the source file that contains the definition is returned. If the definition does not exist, an error is signaled.
niland you specify the want-list argument, the function searches for all definitions of the specified object and returns a list of the form
(type . pathname)for each definition of the object.
get-source-filesearches for all definitions of the specified object. If there is a single definition of the object, the function returns two values: the pathname of the file that contains the definition and the type of definition. If there are multiple definitions of the same object, a continuable error is signaled.
*load-pathname*contains the pathname that is returned by the function
loadwhenever it loads a file.
loadrebinds this variable every time a file is loaded. During the dynamic extent of the loading process, evaluations can access this variable to find out what file they are being loaded from. The information is provided for both binary and source files.
record-source-filerecords information about the source file that defines the specified object.
structure, or a definition type you create by supplying a symbol.
*record-source-files*determines whether to record the name of the file in which an object is defined.
nilvalue, source file names are recorded. Redefinition warnings are produced only when an object is redefined in the same file. The warnings include the name of the original source file that defines the object. The value of this variable is non-
nil, source file names are not recorded; however, old information about an object is not lost. Redefinition warnings are produced when a file is reloaded and when an object is redefined in the same file; they do not include source file information.
*redefinition-action*specifies what action is taken when a redefinition occurs.
:warn, you are warned when a function or macro is redefined as a result of loading a different file from the source file that contains the original definition. If the source file that contains the original definition is unknown, the warning is always given. This value is the default.
:query, you are asked whether you wish to proceed with the redefinition.
nil, no action is taken.
;;; Suppose that *record-source-files* is set to :warn, which is ;;; the default. If the file temp1.lisp contains ;;; (defun test ()) ;;; and the file temp2.lisp also contains ;;; (defun test ()) ;;; the following session could occur: ;; The default action is :warn. > *redefinition-action* :WARN*source-pathname* Variable
;; Define "test" the first time. > (load "~/temp1.lisp") ;;; Loading source file "/u/kdo/temp1.lisp" #P"/u/kdo/temp1.lisp"
;; Redefine from same file--no message. > (load "~/temp1.lisp") ;;; Loading source file "/u/kdo/temp1.lisp" #P"/u/kdo/temp1.lisp" ;; Redefine it by loading a new file. > (load "~/temp2.lisp") ;;; Loading source file "/u/kdo/temp2.lisp" ;;; Warning: Redefining function TEST which used to be defined in ;;; file /u/kdo/temp1.lisp #P"/u/kdo/temp2.lisp"
;; Redefine it from the top level. > (defun test ()) ;;; Warning: Redefining function TEST which used to be defined in ;;; file /u/kdo/temp2.lisp TEST
;; Reset to ask for confirmation. > (setq *redefinition-action* :query) :QUERY > (load "~/temp1.lisp") ;;; Loading source file "/u/kdo/temp1.lisp" Redefining function TEST which used to be defined at top level OK? (Y or N) y #P"/u/kdo/temp1.lisp"
;; Do not print warnings. > (setq *redefinition-action* nil) NIL
> (load "~/temp2.lisp") ;;; Loading source file "/u/kdo/temp2.lisp" #P"/u/kdo/temp2.lisp"
*source-pathname*contains the truename of the source file of the file being loaded. If a source file is loaded, the value of this variable is the truename of that file. If a compiled file is loaded, the value of this variable is the truename of the source file from which the compiled file was created. You can bind this variable to another value if you do not want the truename of the file being loaded to be used as the default pathname for
*terse-redefinitions*controls the level of detail printed in redefinition warnings.
nilvalue, the warnings are brief and can be hard to understand.
Generated with Harlequin WebMaker