+2014-12-29 Dmitry Gutov <dgutov@yandex.ru>
+
+ Unbreak jumping to an alias's definition.
+
+ * 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.
+
+ * 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.
+
2014-12-29 Juri Linkov <juri@linkov.net>
* comint.el (comint-history-isearch-message): Use field-beginning
(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
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)
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.
menu))
-(defun menu-bar-next-tag-other-window ()
- "Find the next definition of the tag already specified."
- (interactive)
- (find-tag-other-window nil t))
-
-(defun menu-bar-next-tag ()
- "Find the next definition of the tag already specified."
- (interactive)
- (find-tag nil t))
-
(define-obsolete-function-alias
'menu-bar-kill-ring-save 'kill-ring-save "24.1")
(`apropos
(elisp--xref-find-apropos id))))
-(defun elisp--xref-identifier-file (type sym)
- (pcase type
- (`defun (when (fboundp sym)
- (find-function-library sym)))
- (`defvar (when (boundp sym)
- (or (symbol-file sym 'defvar)
- (help-C-file-name sym 'var))))
- (`feature (when (featurep sym)
- (ignore-errors
- (find-library-name (symbol-name sym)))))
- (`defface (when (facep sym)
- (symbol-file sym 'defface)))))
+(defun elisp--xref-identifier-location (type sym)
+ (let ((file
+ (pcase type
+ (`defun (when (fboundp sym)
+ (let ((fun-lib
+ (find-function-library sym)))
+ (setq sym (car fun-lib))
+ (cdr fun-lib))))
+ (`defvar (when (boundp sym)
+ (or (symbol-file sym 'defvar)
+ (help-C-file-name sym 'var))))
+ (`feature (when (featurep sym)
+ (ignore-errors
+ (find-library-name (symbol-name sym)))))
+ (`defface (when (facep sym)
+ (symbol-file sym 'defface))))))
+ (when file
+ (when (string-match-p "\\.elc\\'" file)
+ (setq file (substring file 0 -1)))
+ (xref-make-elisp-location sym type file))))
(defun elisp--xref-find-definitions (symbol)
(save-excursion
(dolist (type '(feature defface defvar defun))
(let ((loc
(condition-case err
- (let ((file (elisp--xref-identifier-file type symbol)))
- (when file
- (when (string-match-p "\\.elc\\'" file)
- (setq file (substring file 0 -1)))
- (xref-make-elisp-location symbol type file)))
+ (elisp--xref-identifier-location type symbol)
(error
(xref-make-bogus-location (error-message-string err))))))
(when loc