diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2011-06-30 22:20:09 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2011-06-30 22:20:09 -0700 |
commit | d0672f86c94e9dbf52e783e2bc4162b9cf3b5f44 (patch) | |
tree | e0e9fc7f479bce996d52c4356052480b3a088c56 /lisp/emacs-lisp | |
parent | b9444d97feca73cb2a90559241bc79584692da54 (diff) | |
parent | bbc6b304672eb229e6750692a1b4e83277ded115 (diff) | |
download | emacs-d0672f86c94e9dbf52e783e2bc4162b9cf3b5f44.tar.gz emacs-d0672f86c94e9dbf52e783e2bc4162b9cf3b5f44.tar.bz2 emacs-d0672f86c94e9dbf52e783e2bc4162b9cf3b5f44.zip |
Merge from trunk.
Diffstat (limited to 'lisp/emacs-lisp')
-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 |