summaryrefslogtreecommitdiff
path: root/lisp/help.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1996-09-02 01:16:42 +0000
committerRichard M. Stallman <rms@gnu.org>1996-09-02 01:16:42 +0000
commit9dc176a0123c924a2aa2f065b563ee2833fe7c95 (patch)
treec6d9d7c30d7c70045c9aeeb332c12aacf611cf23 /lisp/help.el
parent2747503c0aa02240f4a21209a19e9cfb6a86e8cf (diff)
downloademacs-9dc176a0123c924a2aa2f065b563ee2833fe7c95.tar.gz
(locate-library): New arg PATH. Handle autocompression mode.
Diffstat (limited to 'lisp/help.el')
-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."
(message "%s is not on any key" definition)))
nil)
-(defun locate-library (library &optional nosuffix)
+(defun locate-library (library &optional nosuffix path)
"Show the precise file name of Emacs library LIBRARY.
This command searches the directories in `load-path' like `M-x load-library'
to find the file that `M-x load-library RET LIBRARY RET' would load.
Optional second arg NOSUFFIX non-nil means don't add suffixes `.elc' or `.el'
-to the specified name LIBRARY."
+to the specified name LIBRARY.
+
+If the optional third arg PATH is specified, that list of directories
+is used instead of `load-path'."
(interactive "sLocate library: ")
(catch 'answer
(mapcar
@@ -684,8 +687,22 @@ to the specified name LIBRARY."
(progn
(message "Library is file %s" try)
(throw 'answer try)))))
- (if nosuffix '("") '(".elc" ".el" ""))))
- load-path)
+ (if nosuffix
+ '("")
+ (let ((basic '(".elc" ".el" ""))
+ (compressed '(".Z" ".gz" "")))
+ ;; If autocompression mode is on,
+ ;; consider all combinations of library suffixes
+ ;; and compression suffixes.
+ (if (rassq 'jka-compr-handler file-name-handler-alist)
+ (apply 'nconc
+ (mapcar '(lambda (compelt)
+ (mapcar '(lambda (baselt)
+ (concat baselt compelt))
+ basic))
+ compressed))
+ basic)))))
+ (or path load-path))
(message "No library %s in search path" library)
nil))