From 344eea4113f8eb3e78cd201a90cc968a8c3658f5 Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Wed, 24 Mar 2021 12:39:08 +0200 Subject: [PATCH] xref.el: Keep Emacs 26 compatibility * lisp/progmodes/xref.el (xref--read-identifier) (xref-find-definitions, xref-find-definitions-other-window) (xref-find-definitions-other-frame, xref-find-references): Undo the latest change for Emacs 26 compatibility (bug#47286). --- lisp/progmodes/xref.el | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 3cb4247b4bf..ea52befec57 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -1192,7 +1192,12 @@ definitions." (xref--prompt-p this-command)) (let ((id (completing-read - (format-prompt prompt def) + (if def + (format "%s (default %s): " + (substring prompt 0 (string-match + "[ :]+\\'" prompt)) + def) + prompt) (xref-backend-identifier-completion-table backend) nil nil nil 'xref--read-identifier-history def))) @@ -1252,19 +1257,19 @@ If sufficient information is available to determine a unique definition for IDENTIFIER, display it in the selected window. Otherwise, display the list of the possible definitions in a buffer where the user can select from the list." - (interactive (list (xref--read-identifier "Find definitions of"))) + (interactive (list (xref--read-identifier "Find definitions of: "))) (xref--find-definitions identifier nil)) ;;;###autoload (defun xref-find-definitions-other-window (identifier) "Like `xref-find-definitions' but switch to the other window." - (interactive (list (xref--read-identifier "Find definitions of"))) + (interactive (list (xref--read-identifier "Find definitions of: "))) (xref--find-definitions identifier 'window)) ;;;###autoload (defun xref-find-definitions-other-frame (identifier) "Like `xref-find-definitions' but switch to the other frame." - (interactive (list (xref--read-identifier "Find definitions of"))) + (interactive (list (xref--read-identifier "Find definitions of: "))) (xref--find-definitions identifier 'frame)) ;;;###autoload @@ -1275,7 +1280,7 @@ offering the symbol at point as the default. With prefix argument, or if `xref-prompt-for-identifier' is t, always prompt for the identifier. If `xref-prompt-for-identifier' is nil, prompt only if there's no usable symbol at point." - (interactive (list (xref--read-identifier "Find references of"))) + (interactive (list (xref--read-identifier "Find references of: "))) (xref--find-xrefs identifier 'references identifier nil)) ;;;###autoload -- 2.39.2