summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorDmitry Gutov <dgutov@yandex.ru>2014-12-29 04:21:51 +0200
committerDmitry Gutov <dgutov@yandex.ru>2014-12-29 04:21:51 +0200
commit381c0bfaf2104295f25c4cc0ea68e881ed37170e (patch)
treed26c236ee7585b6a53f2836c24b331fa7cf2a091 /lisp/emacs-lisp
parentceed9dd191c6739489f4ba78d82c21e162f5e95d (diff)
downloademacs-381c0bfaf2104295f25c4cc0ea68e881ed37170e.tar.gz
emacs-381c0bfaf2104295f25c4cc0ea68e881ed37170e.tar.bz2
emacs-381c0bfaf2104295f25c4cc0ea68e881ed37170e.zip
Unbreak jumping to an alias's definition
* lisp/emacs-lisp/find-func.el (find-function-library): Return a pair (ORIG-FUNCTION . LIBRARY) instead of just its second element. (find-function-noselect): Use it. * lisp/progmodes/elisp-mode.el (elisp--xref-identifier-file): Rename to `elisp--xref-identifier-location', incorporate logic from `elisp--xref-find-definitions', use the changed `find-function-library' return value.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/find-func.el28
1 files changed, 17 insertions, 11 deletions
diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el
index e1586a96716..3131be09eb1 100644
--- a/lisp/emacs-lisp/find-func.el
+++ b/lisp/emacs-lisp/find-func.el
@@ -312,9 +312,14 @@ The search is done in the source for library LIBRARY."
(cons (current-buffer) nil))))))))
(defun find-function-library (function &optional lisp-only verbose)
- "Return the library FUNCTION is defined in.
+ "Return the pair (ORIG-FUNCTION . LIBRARY) for FUNCTION.
-If FUNCTION is a built-in function and LISP-ONLY is non-nil,
+ORIG-FUNCTION is the original name, after removing all advice and
+resolving aliases. LIBRARY is an absolute file name, a relative
+file name inside the C sources directory, or a name of an
+autoloaded feature.
+
+If ORIG-FUNCTION is a built-in function and LISP-ONLY is non-nil,
signal an error.
If VERBOSE is non-nil, and FUNCTION is an alias, display a
@@ -336,13 +341,14 @@ message about the whole chain of aliases."
def (symbol-function (find-function-advised-original function))))
(if aliases
(message "%s" aliases))
- (cond
- ((autoloadp def) (nth 1 def))
- ((subrp def)
- (if lisp-only
- (error "%s is a built-in function" function))
- (help-C-file-name def 'subr))
- ((symbol-file function 'defun)))))
+ (cons function
+ (cond
+ ((autoloadp def) (nth 1 def))
+ ((subrp def)
+ (if lisp-only
+ (error "%s is a built-in function" function))
+ (help-C-file-name def 'subr))
+ ((symbol-file function 'defun))))))
;;;###autoload
(defun find-function-noselect (function &optional lisp-only)
@@ -362,8 +368,8 @@ searched for in `find-function-source-path' if non-nil, otherwise
in `load-path'."
(if (not function)
(error "You didn't specify a function"))
- (let ((library (find-function-library function lisp-only t)))
- (find-function-search-for-symbol function nil library)))
+ (let ((func-lib (find-function-library function lisp-only t)))
+ (find-function-search-for-symbol (car func-lib) nil (cdr func-lib))))
(defun find-function-read (&optional type)
"Read and return an interned symbol, defaulting to the one near point.