diff options
author | Kenichi Handa <handa@m17n.org> | 2011-07-07 08:28:00 +0900 |
---|---|---|
committer | Kenichi Handa <handa@m17n.org> | 2011-07-07 08:28:00 +0900 |
commit | d2a0a50628933d3cdb09818eee2e17f55e22531f (patch) | |
tree | d19c8e71eb63eb6ccd204c2f36f406e4cf853154 /lisp/emacs-lisp/find-func.el | |
parent | c805dec0b5fa81b5c9f2b724e2ec12a17d723aca (diff) | |
parent | 354cf0ba0b20108c9776be1d868458893bc2cd54 (diff) | |
download | emacs-d2a0a50628933d3cdb09818eee2e17f55e22531f.tar.gz emacs-d2a0a50628933d3cdb09818eee2e17f55e22531f.tar.bz2 emacs-d2a0a50628933d3cdb09818eee2e17f55e22531f.zip |
merge trunk
Diffstat (limited to 'lisp/emacs-lisp/find-func.el')
-rw-r--r-- | lisp/emacs-lisp/find-func.el | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el index 9c4a3e9832c..0194af2e3a8 100644 --- a/lisp/emacs-lisp/find-func.el +++ b/lisp/emacs-lisp/find-func.el @@ -141,6 +141,15 @@ See the functions `find-function' and `find-variable'." (dolist (suffix (get-load-suffixes) (nreverse suffixes)) (unless (string-match "elc" suffix) (push suffix suffixes))))) +(defun find-library--load-name (library) + (let ((name library)) + (dolist (dir load-path) + (let ((rel (file-relative-name library dir))) + (if (and (not (string-match "\\`\\.\\./" rel)) + (< (length rel) (length name))) + (setq name rel)))) + (unless (equal name library) name))) + (defun find-library-name (library) "Return the absolute file name of the Emacs Lisp source of LIBRARY. LIBRARY should be a string (the name of the library)." @@ -148,13 +157,23 @@ LIBRARY should be a string (the name of the library)." ;; the same name. (if (string-match "\\.el\\(c\\(\\..*\\)?\\)\\'" library) (setq library (replace-match "" t t library))) - (or + (or (locate-file library (or find-function-source-path load-path) (find-library-suffixes)) (locate-file library (or find-function-source-path load-path) load-file-rep-suffixes) + (when (file-name-absolute-p library) + (let ((rel (find-library--load-name library))) + (when rel + (or + (locate-file rel + (or find-function-source-path load-path) + (find-library-suffixes)) + (locate-file rel + (or find-function-source-path load-path) + load-file-rep-suffixes))))) (error "Can't find library %s" library))) (defvar find-function-C-source-directory |