(find-function-search-for-symbol):

Remove unnecessary test on `library' for explicit file name.
Widen scope of save-match-data.
This commit is contained in:
Dave Love 1998-12-11 17:42:56 +00:00
parent 645ff508dd
commit 78b6524e5c

View file

@ -108,29 +108,27 @@ If VARIABLE-P is nil, `find-function-regexp' is used, otherwise
`find-variable-regexp' is used." `find-variable-regexp' is used."
(if (null library) (if (null library)
(error "Don't know where `%s' is defined" symbol)) (error "Don't know where `%s' is defined" symbol))
(if (string-match "\\.el\\(c\\)\\'" library) (save-match-data
(setq library (substring library 0 (match-beginning 1)))) (if (string-match "\\.el\\(c\\)\\'" library)
(let* ((path find-function-source-path) (setq library (substring library 0 (match-beginning 1))))
(compression (or (rassq 'jka-compr-handler file-name-handler-alist) (let* ((path find-function-source-path)
(member 'crypt-find-file-hook find-file-hooks))) (compression (or (rassq 'jka-compr-handler file-name-handler-alist)
(filename (if (and (file-exists-p library) (member 'crypt-find-file-hook find-file-hooks)))
(not (file-directory-p library))) (filename (progn
library ;; use `file-name-sans-extension' here? (if it gets fixed)
;; use `file-name-sans-extension' here? (if it gets fixed) (if (string-match "\\(\\.el\\)\\'" library)
(if (string-match "\\(\\.el\\)\\'" library) (setq library (substring library 0
(setq library (substring library 0 (match-beginning 1))))
(match-beginning 1)))) (or (locate-library (concat library ".el") t path)
(or (locate-library (concat library ".el") t path) (locate-library library t path)
(locate-library library t path) (if compression
(if compression (or (locate-library (concat library ".el.gz")
(or (locate-library (concat library ".el.gz") t path)
t path) (locate-library (concat library ".gz")
(locate-library (concat library ".gz") t path)))))))
t path))))))) (if (not filename)
(if (not filename) (error "The library `%s' is not in the path" library))
(error "The library `%s' is not in the path" library)) (with-current-buffer (find-file-noselect filename)
(with-current-buffer (find-file-noselect filename)
(save-match-data
(let ((regexp (format (if variable-p (let ((regexp (format (if variable-p
find-variable-regexp find-variable-regexp
find-function-regexp) find-function-regexp)