From be5fc59bde20008088764f072b71e36dd616cfd8 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Fri, 12 Oct 2001 21:00:54 +0000 Subject: [PATCH] (locate-library): Use load-suffixes and abbrev filename. --- lisp/help-funs.el | 49 ++++++++++++++--------------------------------- src/ChangeLog | 4 ++++ 2 files changed, 18 insertions(+), 35 deletions(-) diff --git a/lisp/help-funs.el b/lisp/help-funs.el index 73cde500543..977626f3a29 100644 --- a/lisp/help-funs.el +++ b/lisp/help-funs.el @@ -82,7 +82,7 @@ With arg, you are asked to choose which language." "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' +Optional second arg NOSUFFIX non-nil means don't add suffixes `load-suffixes' to the specified name LIBRARY. If the optional third arg PATH is specified, that list of directories @@ -94,40 +94,19 @@ and the file name is displayed in the echo area." (interactive (list (read-string "Locate library: ") nil nil t)) - (let (result) - (catch 'answer - (mapc - (lambda (dir) - (mapc - (lambda (suf) - (let ((try (expand-file-name (concat library suf) dir))) - (and (file-readable-p try) - (null (file-directory-p try)) - (progn - (setq result try) - (throw 'answer try))))) - (if nosuffix - '("") - '(".elc" ".el" "") - (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))) - (and interactive-call - (if result - (message "Library is file %s" result) - (message "No library %s in search path" library))) - result)) + (catch 'answer + (dolist (dir (or path load-path)) + (dolist (suf (append (unless nosuffix load-suffixes) '(""))) + (let ((try (expand-file-name (concat library suf) dir))) + (and (file-readable-p try) + (null (file-directory-p try)) + (progn + (if interactive-call + (message "Library is file %s" (abbreviate-file-name try))) + (throw 'answer try)))))) + (if interactive-call + (message "No library %s in search path" library)) + nil)) ;; Functions diff --git a/src/ChangeLog b/src/ChangeLog index 799d43bf4fa..ebdcb23e3cd 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2001-10-12 Stefan Monnier + + * minibuf.c (keys_of_minibuf): Eliminate redundant bindings. + 2001-10-12 Gerd Moellmann * xterm.c (notice_overwritten_cursor): Renamed from -- 2.39.2