# HG changeset patch # User Miles Bader # Date 1002626071 0 # Node ID c64d3e3adf5d0c49ada080910e913a247c56695a # Parent 6d912cac53cfae1850df35224cb19fe161428df5 (symbol-file-load-history-loaded) (load-symbol-file-load-history, symbol-file): Moved from `help.el'. diff -r 6d912cac53cf -r c64d3e3adf5d lisp/subr.el --- a/lisp/subr.el Tue Oct 09 10:18:43 2001 +0000 +++ b/lisp/subr.el Tue Oct 09 11:14:31 2001 +0000 @@ -797,6 +797,45 @@ (if append (append (symbol-value list-var) (list element)) (cons element (symbol-value list-var)))))) + + +;;; Load history + +(defvar symbol-file-load-history-loaded nil + "Non-nil means we have loaded the file `fns-VERSION.el' in `exec-directory'. +That file records the part of `load-history' for preloaded files, +which is cleared out before dumping to make Emacs smaller.") + +(defun load-symbol-file-load-history () + "Load the file `fns-VERSION.el' in `exec-directory' if not already done. +That file records the part of `load-history' for preloaded files, +which is cleared out before dumping to make Emacs smaller." + (unless symbol-file-load-history-loaded + (load (expand-file-name + ;; fns-XX.YY.ZZ.el does not work on DOS filesystem. + (if (eq system-type 'ms-dos) + "fns.el" + (format "fns-%s.el" emacs-version)) + exec-directory) + ;; The file name fns-%s.el already has a .el extension. + nil nil t) + (setq symbol-file-load-history-loaded t))) + +(defun symbol-file (function) + "Return the input source from which FUNCTION was loaded. +The value is normally a string that was passed to `load': +either an absolute file name, or a library name +\(with no directory name and no `.el' or `.elc' at the end). +It can also be nil, if the definition is not associated with any file." + (load-symbol-file-load-history) + (let ((files load-history) + file functions) + (while files + (if (memq function (cdr (car files))) + (setq file (car (car files)) files nil)) + (setq files (cdr files))) + file)) + ;;;; Specifying things to do after certain files are loaded.