From 35ad161d9a020741519c83e9a86e55c9b3fe6db1 Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Mon, 13 Jul 2015 04:27:32 +0300 Subject: [PATCH] Show the default value in the prompt * lisp/progmodes/xref.el: Add `M-?' binding for xref-find-references. Declare functions `grep-read-files' and `grep-expand-template'. (xref--read-identifier): Show the default value in the prompt. --- lisp/progmodes/xref.el | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 214503efc5e..1caded0ea5a 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -618,7 +618,12 @@ Return an alist of the form ((FILENAME . (XREF ...)) ...)." (cond ((or current-prefix-arg (not id) (xref--prompt-p this-command)) - (completing-read prompt + (completing-read (if id + (format "%s (default %s): " + (substring prompt 0 (string-match + "[ :]+\\'" prompt)) + id) + prompt) (funcall xref-identifier-completion-table-function) nil nil nil 'xref--read-identifier-history id)) @@ -706,6 +711,7 @@ The argument has the same meaning as in `apropos'." ;;;###autoload (define-key esc-map "." #'xref-find-definitions) ;;;###autoload (define-key esc-map "," #'xref-pop-marker-stack) +;;;###autoload (define-key esc-map "?" #'xref-find-references) ;;;###autoload (define-key esc-map [?\C-.] #'xref-find-apropos) ;;;###autoload (define-key ctl-x-4-map "." #'xref-find-definitions-other-window) ;;;###autoload (define-key ctl-x-5-map "." #'xref-find-definitions-other-frame) @@ -736,7 +742,8 @@ and just use etags." (declare-function semantic-symref-find-references-by-name "semantic/symref") (declare-function semantic-symref-find-text "semantic/symref") (declare-function semantic-find-file-noselect "semantic/fw") -(declare-function rgrep-default-command "grep") +(declare-function grep-read-files "grep") +(declare-function grep-expand-template "grep") (defun xref-collect-references (symbol dir) "Collect references to SYMBOL inside DIR. -- 2.39.2