comparison lisp/help.el @ 35233:f5e1761e4c75

(load-symbol-file-load-history): New function extracted from function symbol-file. (symbol-file): Use it.
author Gerd Moellmann <gerd@gnu.org>
date Thu, 11 Jan 2001 14:24:22 +0000
parents 610ac8a2b8a5
children c96d6054a03e
comparison
equal deleted inserted replaced
35232:4e0f20145b5f 35233:f5e1761e4c75
567 (defvar symbol-file-load-history-loaded nil 567 (defvar symbol-file-load-history-loaded nil
568 "Non-nil means we have loaded the file `fns-VERSION.el' in `exec-directory'. 568 "Non-nil means we have loaded the file `fns-VERSION.el' in `exec-directory'.
569 That file records the part of `load-history' for preloaded files, 569 That file records the part of `load-history' for preloaded files,
570 which is cleared out before dumping to make Emacs smaller.") 570 which is cleared out before dumping to make Emacs smaller.")
571 571
572 (defun symbol-file (function) 572 (defun load-symbol-file-load-history ()
573 "Return the input source from which FUNCTION was loaded. 573 "Load the file `fns-VERSION.el' in `exec-directory' if not already done.
574 The value is normally a string that was passed to `load': 574 That file records the part of `load-history' for preloaded files,
575 either an absolute file name, or a library name 575 which is cleared out before dumping to make Emacs smaller."
576 \(with no directory name and no `.el' or `.elc' at the end).
577 It can also be nil, if the definition is not associated with any file."
578 (unless symbol-file-load-history-loaded 576 (unless symbol-file-load-history-loaded
579 (load (expand-file-name 577 (load (expand-file-name
580 ;; fns-XX.YY.ZZ.el does not work on DOS filesystem. 578 ;; fns-XX.YY.ZZ.el does not work on DOS filesystem.
581 (if (eq system-type 'ms-dos) 579 (if (eq system-type 'ms-dos)
582 "fns.el" 580 "fns.el"
583 (format "fns-%s.el" emacs-version)) 581 (format "fns-%s.el" emacs-version))
584 exec-directory) 582 exec-directory)
585 ;; The file name fns-%s.el already has a .el extension. 583 ;; The file name fns-%s.el already has a .el extension.
586 nil nil t) 584 nil nil t)
587 (setq symbol-file-load-history-loaded t)) 585 (setq symbol-file-load-history-loaded t)))
586
587 (defun symbol-file (function)
588 "Return the input source from which FUNCTION was loaded.
589 The value is normally a string that was passed to `load':
590 either an absolute file name, or a library name
591 \(with no directory name and no `.el' or `.elc' at the end).
592 It can also be nil, if the definition is not associated with any file."
593 (load-symbol-file-load-history)
588 (let ((files load-history) 594 (let ((files load-history)
589 file functions) 595 file functions)
590 (while files 596 (while files
591 (if (memq function (cdr (car files))) 597 (if (memq function (cdr (car files)))
592 (setq file (car (car files)) files nil)) 598 (setq file (car (car files)) files nil))