diff options
-rw-r--r-- | lisp/minibuffer.el | 1 | ||||
-rw-r--r-- | lisp/progmodes/xref.el | 14 |
2 files changed, 12 insertions, 3 deletions
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index dc37c5f4476..441eca214bd 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -956,6 +956,7 @@ styles for specific categories, such as files, buffers, etc." ;; A new style that combines substring and pcm might be better, ;; e.g. one that does not anchor to bos. (project-file (styles . (substring))) + (xref-location (styles . (substring))) (info-menu (styles . (basic substring)))) "Default settings for specific completion categories. Each entry has the shape (CATEGORY . ALIST) where ALIST is diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index b8a5d481190..6f7125670bd 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -1018,9 +1018,17 @@ between them by typing in the minibuffer with completion." (setq xref (if (not (cdr xrefs)) (car xrefs) - (cdr (assoc (completing-read "Jump to definition: " - (reverse xref-alist-with-line-info)) - xref-alist-with-line-info)))) + (let* ((collection (reverse xref-alist-with-line-info)) + (ctable + (lambda (string pred action) + (cond + ((eq action 'metadata) + '(metadata . ((category . xref-location)))) + (t + (complete-with-action action collection string pred)))))) + (cdr (assoc (completing-read "Choose definition: " + ctable nil t) + collection))))) (xref-pop-to-location xref (assoc-default 'display-action alist)))) |