diff options
author | Dave Love <fx@gnu.org> | 1998-12-11 17:42:56 +0000 |
---|---|---|
committer | Dave Love <fx@gnu.org> | 1998-12-11 17:42:56 +0000 |
commit | 78b6524e5c54d95798fa688992ff23628a35283c (patch) | |
tree | 09bf5056269077483284bbb42fa9e4068a77b9df /lisp | |
parent | 645ff508dde95b470daf511876177adcb1734f54 (diff) | |
download | emacs-78b6524e5c54d95798fa688992ff23628a35283c.tar.gz emacs-78b6524e5c54d95798fa688992ff23628a35283c.tar.bz2 emacs-78b6524e5c54d95798fa688992ff23628a35283c.zip |
(find-function-search-for-symbol):
Remove unnecessary test on `library' for explicit file name.
Widen scope of save-match-data.
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/emacs-lisp/find-func.el | 44 |
1 files changed, 21 insertions, 23 deletions
diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el index 3cc417258e0..119c11332a3 100644 --- a/lisp/emacs-lisp/find-func.el +++ b/lisp/emacs-lisp/find-func.el @@ -108,29 +108,27 @@ If VARIABLE-P is nil, `find-function-regexp' is used, otherwise `find-variable-regexp' is used." (if (null library) (error "Don't know where `%s' is defined" symbol)) - (if (string-match "\\.el\\(c\\)\\'" library) - (setq library (substring library 0 (match-beginning 1)))) - (let* ((path find-function-source-path) - (compression (or (rassq 'jka-compr-handler file-name-handler-alist) - (member 'crypt-find-file-hook find-file-hooks))) - (filename (if (and (file-exists-p library) - (not (file-directory-p library))) - library - ;; use `file-name-sans-extension' here? (if it gets fixed) - (if (string-match "\\(\\.el\\)\\'" library) - (setq library (substring library 0 - (match-beginning 1)))) - (or (locate-library (concat library ".el") t path) - (locate-library library t path) - (if compression - (or (locate-library (concat library ".el.gz") - t path) - (locate-library (concat library ".gz") - t path))))))) - (if (not filename) - (error "The library `%s' is not in the path" library)) - (with-current-buffer (find-file-noselect filename) - (save-match-data + (save-match-data + (if (string-match "\\.el\\(c\\)\\'" library) + (setq library (substring library 0 (match-beginning 1)))) + (let* ((path find-function-source-path) + (compression (or (rassq 'jka-compr-handler file-name-handler-alist) + (member 'crypt-find-file-hook find-file-hooks))) + (filename (progn + ;; use `file-name-sans-extension' here? (if it gets fixed) + (if (string-match "\\(\\.el\\)\\'" library) + (setq library (substring library 0 + (match-beginning 1)))) + (or (locate-library (concat library ".el") t path) + (locate-library library t path) + (if compression + (or (locate-library (concat library ".el.gz") + t path) + (locate-library (concat library ".gz") + t path))))))) + (if (not filename) + (error "The library `%s' is not in the path" library)) + (with-current-buffer (find-file-noselect filename) (let ((regexp (format (if variable-p find-variable-regexp find-function-regexp) |