6.2 The Source File Recording Facility
Syntax:discard-source-file-info
discard-source-file-info
discards 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-info
does not affect the setting of*record-source-files*
.
record-source-file
, *record-source-files*
Syntax:get-source-file
object&optional
type want-list
get-source-file
returns information about the file or files in which the specified object is defined.
nil
, its value can be eitherfunction
,macro
,structure
, or a definition type that you have created by using the functionrecord-source-file
.
get-source-file
searches 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.
nil
and 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-file
searches 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.
record-source-file
Syntax:*load-pathname*
*load-pathname*
contains the pathname that is returned by the function load
whenever it loads a file.
load
rebinds 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-file
object type&optional
pathname load-instance
record-source-file
records information about the source file that defines the specified object.
function
,macro
,structure
, or a definition type you create by supplying a symbol.
*source-pathname*
.
*redefinition-action*
, *source-pathname*
Syntax:*record-source-files*
*record-source-files*
determines whether to record the name of the file in which an object is defined.
nil
value, 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
by default.
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.
record-source-file
, *redefinition-action*
Syntax:*redefinition-action*
*redefinition-action*
specifies what action is taken when a redefinition occurs.
:warn
: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
:query
, you are asked whether you wish to proceed with the redefinition.
nil
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"
Syntax:*source-pathname*
*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 record-source-file
.
record-source-file
Syntax:*terse-redefinitions*
*terse-redefinitions*
controls the level of detail printed in redefinition warnings.
nil
.
nil
value, the warnings are brief and can be hard to understand.
*redefinition-action*
Generated with Harlequin WebMaker