aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1996-09-02 01:16:42 +0000
committerRichard M. Stallman1996-09-02 01:16:42 +0000
commit9dc176a0123c924a2aa2f065b563ee2833fe7c95 (patch)
treec6d9d7c30d7c70045c9aeeb332c12aacf611cf23
parent2747503c0aa02240f4a21209a19e9cfb6a86e8cf (diff)
downloademacs-9dc176a0123c924a2aa2f065b563ee2833fe7c95.tar.gz
emacs-9dc176a0123c924a2aa2f065b563ee2833fe7c95.zip
(locate-library): New arg PATH. Handle autocompression mode.
-rw-r--r--lisp/help.el25
1 files changed, 21 insertions, 4 deletions
diff --git a/lisp/help.el b/lisp/help.el
index 8e1317ed0d4..97887b1c81c 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -666,12 +666,15 @@ Argument is a command definition, usually a symbol with a function definition."
666 (message "%s is not on any key" definition))) 666 (message "%s is not on any key" definition)))
667 nil) 667 nil)
668 668
669(defun locate-library (library &optional nosuffix) 669(defun locate-library (library &optional nosuffix path)
670 "Show the precise file name of Emacs library LIBRARY. 670 "Show the precise file name of Emacs library LIBRARY.
671This command searches the directories in `load-path' like `M-x load-library' 671This command searches the directories in `load-path' like `M-x load-library'
672to find the file that `M-x load-library RET LIBRARY RET' would load. 672to find the file that `M-x load-library RET LIBRARY RET' would load.
673Optional second arg NOSUFFIX non-nil means don't add suffixes `.elc' or `.el' 673Optional second arg NOSUFFIX non-nil means don't add suffixes `.elc' or `.el'
674to the specified name LIBRARY." 674to the specified name LIBRARY.
675
676If the optional third arg PATH is specified, that list of directories
677is used instead of `load-path'."
675 (interactive "sLocate library: ") 678 (interactive "sLocate library: ")
676 (catch 'answer 679 (catch 'answer
677 (mapcar 680 (mapcar
@@ -684,8 +687,22 @@ to the specified name LIBRARY."
684 (progn 687 (progn
685 (message "Library is file %s" try) 688 (message "Library is file %s" try)
686 (throw 'answer try))))) 689 (throw 'answer try)))))
687 (if nosuffix '("") '(".elc" ".el" "")))) 690 (if nosuffix
688 load-path) 691 '("")
692 (let ((basic '(".elc" ".el" ""))
693 (compressed '(".Z" ".gz" "")))
694 ;; If autocompression mode is on,
695 ;; consider all combinations of library suffixes
696 ;; and compression suffixes.
697 (if (rassq 'jka-compr-handler file-name-handler-alist)
698 (apply 'nconc
699 (mapcar '(lambda (compelt)
700 (mapcar '(lambda (baselt)
701 (concat baselt compelt))
702 basic))
703 compressed))
704 basic)))))
705 (or path load-path))
689 (message "No library %s in search path" library) 706 (message "No library %s in search path" library)
690 nil)) 707 nil))
691 708