diff options
| author | Dmitry Gutov | 2015-04-26 18:08:56 +0300 |
|---|---|---|
| committer | Dmitry Gutov | 2015-04-26 18:08:56 +0300 |
| commit | 2f3b409a28241c88cdaca8778430121a736f7c77 (patch) | |
| tree | c005f037fddd71e0c1f85fd43aabee589bb48ff0 | |
| parent | a40869789fc5502e3d4e393b7c31d78cb7f29aa1 (diff) | |
| download | emacs-2f3b409a28241c88cdaca8778430121a736f7c77.tar.gz emacs-2f3b409a28241c88cdaca8778430121a736f7c77.zip | |
Introduce xref-prompt-for-identifier
* lisp/progmodes/xref.el (xref-prompt-for-identifier): New option.
(xref--read-identifier): Use it
(http://lists.gnu.org/archive/html/emacs-devel/2015-04/msg01205.html).
| -rw-r--r-- | lisp/progmodes/xref.el | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 0257210a6c7..9f1068668b1 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el | |||
| @@ -276,6 +276,15 @@ backward." | |||
| 276 | :type 'integer | 276 | :type 'integer |
| 277 | :version "25.1") | 277 | :version "25.1") |
| 278 | 278 | ||
| 279 | (defcustom xref-prompt-for-identifier nil | ||
| 280 | "When non-nil, always prompt for the identifier name. | ||
| 281 | |||
| 282 | Otherwise, only prompt when there's no value at point we can use, | ||
| 283 | or when the command has been called with the prefix argument." | ||
| 284 | :type '(choice (const :tag "always" t) | ||
| 285 | (const :tag "auto" nil)) | ||
| 286 | :version "25.1") | ||
| 287 | |||
| 279 | (defvar xref--marker-ring (make-ring xref-marker-ring-length) | 288 | (defvar xref--marker-ring (make-ring xref-marker-ring-length) |
| 280 | "Ring of markers to implement the marker stack.") | 289 | "Ring of markers to implement the marker stack.") |
| 281 | 290 | ||
| @@ -559,7 +568,7 @@ Return an alist of the form ((FILENAME . (XREF ...)) ...)." | |||
| 559 | (defun xref--read-identifier (prompt) | 568 | (defun xref--read-identifier (prompt) |
| 560 | "Return the identifier at point or read it from the minibuffer." | 569 | "Return the identifier at point or read it from the minibuffer." |
| 561 | (let ((id (funcall xref-identifier-at-point-function))) | 570 | (let ((id (funcall xref-identifier-at-point-function))) |
| 562 | (cond ((or current-prefix-arg (not id)) | 571 | (cond ((or current-prefix-arg xref-prompt-for-identifier (not id)) |
| 563 | (completing-read prompt | 572 | (completing-read prompt |
| 564 | (funcall xref-identifier-completion-table-function) | 573 | (funcall xref-identifier-completion-table-function) |
| 565 | nil t nil | 574 | nil t nil |