diff options
| author | Stefan Monnier | 2001-10-12 21:00:54 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2001-10-12 21:00:54 +0000 |
| commit | be5fc59bde20008088764f072b71e36dd616cfd8 (patch) | |
| tree | 0bea036c90c09e9a3220120b346a2d4684767318 | |
| parent | 7e573c4a6d106ae4408fd1d054ebb74458a7cb84 (diff) | |
| download | emacs-be5fc59bde20008088764f072b71e36dd616cfd8.tar.gz emacs-be5fc59bde20008088764f072b71e36dd616cfd8.zip | |
(locate-library): Use load-suffixes and abbrev filename.
| -rw-r--r-- | lisp/help-funs.el | 49 | ||||
| -rw-r--r-- | 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." | |||
| 82 | "Show the precise file name of Emacs library LIBRARY. | 82 | "Show the precise file name of Emacs library LIBRARY. |
| 83 | This command searches the directories in `load-path' like `M-x load-library' | 83 | This command searches the directories in `load-path' like `M-x load-library' |
| 84 | to find the file that `M-x load-library RET LIBRARY RET' would load. | 84 | to find the file that `M-x load-library RET LIBRARY RET' would load. |
| 85 | Optional second arg NOSUFFIX non-nil means don't add suffixes `.elc' or `.el' | 85 | Optional second arg NOSUFFIX non-nil means don't add suffixes `load-suffixes' |
| 86 | to the specified name LIBRARY. | 86 | to the specified name LIBRARY. |
| 87 | 87 | ||
| 88 | If the optional third arg PATH is specified, that list of directories | 88 | 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." | |||
| 94 | (interactive (list (read-string "Locate library: ") | 94 | (interactive (list (read-string "Locate library: ") |
| 95 | nil nil | 95 | nil nil |
| 96 | t)) | 96 | t)) |
| 97 | (let (result) | 97 | (catch 'answer |
| 98 | (catch 'answer | 98 | (dolist (dir (or path load-path)) |
| 99 | (mapc | 99 | (dolist (suf (append (unless nosuffix load-suffixes) '(""))) |
| 100 | (lambda (dir) | 100 | (let ((try (expand-file-name (concat library suf) dir))) |
| 101 | (mapc | 101 | (and (file-readable-p try) |
| 102 | (lambda (suf) | 102 | (null (file-directory-p try)) |
| 103 | (let ((try (expand-file-name (concat library suf) dir))) | 103 | (progn |
| 104 | (and (file-readable-p try) | 104 | (if interactive-call |
| 105 | (null (file-directory-p try)) | 105 | (message "Library is file %s" (abbreviate-file-name try))) |
| 106 | (progn | 106 | (throw 'answer try)))))) |
| 107 | (setq result try) | 107 | (if interactive-call |
| 108 | (throw 'answer try))))) | 108 | (message "No library %s in search path" library)) |
| 109 | (if nosuffix | 109 | nil)) |
| 110 | '("") | ||
| 111 | '(".elc" ".el" "") | ||
| 112 | (let ((basic '(".elc" ".el" "")) | ||
| 113 | (compressed '(".Z" ".gz" ""))) | ||
| 114 | ;; If autocompression mode is on, | ||
| 115 | ;; consider all combinations of library suffixes | ||
| 116 | ;; and compression suffixes. | ||
| 117 | (if (rassq 'jka-compr-handler file-name-handler-alist) | ||
| 118 | (apply 'nconc | ||
| 119 | (mapcar (lambda (compelt) | ||
| 120 | (mapcar (lambda (baselt) | ||
| 121 | (concat baselt compelt)) | ||
| 122 | basic)) | ||
| 123 | compressed)) | ||
| 124 | basic))))) | ||
| 125 | (or path load-path))) | ||
| 126 | (and interactive-call | ||
| 127 | (if result | ||
| 128 | (message "Library is file %s" result) | ||
| 129 | (message "No library %s in search path" library))) | ||
| 130 | result)) | ||
| 131 | 110 | ||
| 132 | 111 | ||
| 133 | ;; Functions | 112 | ;; Functions |
diff --git a/src/ChangeLog b/src/ChangeLog index 799d43bf4fa..ebdcb23e3cd 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2001-10-12 Stefan Monnier <monnier@cs.yale.edu> | ||
| 2 | |||
| 3 | * minibuf.c (keys_of_minibuf): Eliminate redundant bindings. | ||
| 4 | |||
| 1 | 2001-10-12 Gerd Moellmann <gerd@gnu.org> | 5 | 2001-10-12 Gerd Moellmann <gerd@gnu.org> |
| 2 | 6 | ||
| 3 | * xterm.c (notice_overwritten_cursor): Renamed from | 7 | * xterm.c (notice_overwritten_cursor): Renamed from |