aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Love1998-12-11 17:42:56 +0000
committerDave Love1998-12-11 17:42:56 +0000
commit78b6524e5c54d95798fa688992ff23628a35283c (patch)
tree09bf5056269077483284bbb42fa9e4068a77b9df
parent645ff508dde95b470daf511876177adcb1734f54 (diff)
downloademacs-78b6524e5c54d95798fa688992ff23628a35283c.tar.gz
emacs-78b6524e5c54d95798fa688992ff23628a35283c.zip
(find-function-search-for-symbol):
Remove unnecessary test on `library' for explicit file name. Widen scope of save-match-data.
-rw-r--r--lisp/emacs-lisp/find-func.el44
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
108`find-variable-regexp' is used." 108`find-variable-regexp' is used."
109 (if (null library) 109 (if (null library)
110 (error "Don't know where `%s' is defined" symbol)) 110 (error "Don't know where `%s' is defined" symbol))
111 (if (string-match "\\.el\\(c\\)\\'" library) 111 (save-match-data
112 (setq library (substring library 0 (match-beginning 1)))) 112 (if (string-match "\\.el\\(c\\)\\'" library)
113 (let* ((path find-function-source-path) 113 (setq library (substring library 0 (match-beginning 1))))
114 (compression (or (rassq 'jka-compr-handler file-name-handler-alist) 114 (let* ((path find-function-source-path)
115 (member 'crypt-find-file-hook find-file-hooks))) 115 (compression (or (rassq 'jka-compr-handler file-name-handler-alist)
116 (filename (if (and (file-exists-p library) 116 (member 'crypt-find-file-hook find-file-hooks)))
117 (not (file-directory-p library))) 117 (filename (progn
118 library 118 ;; use `file-name-sans-extension' here? (if it gets fixed)
119 ;; use `file-name-sans-extension' here? (if it gets fixed) 119 (if (string-match "\\(\\.el\\)\\'" library)
120 (if (string-match "\\(\\.el\\)\\'" library) 120 (setq library (substring library 0
121 (setq library (substring library 0 121 (match-beginning 1))))
122 (match-beginning 1)))) 122 (or (locate-library (concat library ".el") t path)
123 (or (locate-library (concat library ".el") t path) 123 (locate-library library t path)
124 (locate-library library t path) 124 (if compression
125 (if compression 125 (or (locate-library (concat library ".el.gz")
126 (or (locate-library (concat library ".el.gz") 126 t path)
127 t path) 127 (locate-library (concat library ".gz")
128 (locate-library (concat library ".gz") 128 t path)))))))
129 t path))))))) 129 (if (not filename)
130 (if (not filename) 130 (error "The library `%s' is not in the path" library))
131 (error "The library `%s' is not in the path" library)) 131 (with-current-buffer (find-file-noselect filename)
132 (with-current-buffer (find-file-noselect filename)
133 (save-match-data
134 (let ((regexp (format (if variable-p 132 (let ((regexp (format (if variable-p
135 find-variable-regexp 133 find-variable-regexp
136 find-function-regexp) 134 find-function-regexp)