]> code.delx.au - gnu-emacs/commitdiff
Show the default value in the prompt
authorDmitry Gutov <dgutov@yandex.ru>
Mon, 13 Jul 2015 01:27:32 +0000 (04:27 +0300)
committerDmitry Gutov <dgutov@yandex.ru>
Mon, 13 Jul 2015 01:27:32 +0000 (04:27 +0300)
* 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

index 214503efc5ee161b92914d13f939bef834f53e5d..1caded0ea5a9d196363bfecd574753fd06b2b05a 100644 (file)
@@ -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.