GNU bug report logs -
#35737
xref--original-command
Previous Next
Reported by: Juri Linkov <juri <at> linkov.net>
Date: Tue, 14 May 2019 20:58:02 UTC
Severity: wishlist
Done: Juri Linkov <juri <at> linkov.net>
Bug is archived. No further changes may be made.
Full log
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Remembering the command that created the *xref* buffer
will allow such customization to treat RET differently,
i.e. it makes sense for RET to quit the transient xref buffer
displayed momentarily while navigating code with xref-find-definitions,
whereas leaving the xref buffer visible while navigating matches
in the xref buffer created by e.g. project-find-regexp:
(define-key xref--button-map [(control ?m)]
(lambda ()
(interactive)
(if (memq xref--original-command '(xref-find-definitions))
(call-interactively 'xref-quit-and-goto-xref)
(call-interactively 'xref-goto-xref))))
Better ideas?
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index bf999aeb0d..5c38cac164 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -477,6 +477,9 @@ xref--original-window-intent
(defvar-local xref--original-window nil
"The original window this xref buffer was created from.")
+(defvar-local xref--original-command nil
+ "The original command that created this xref buffer.")
+
(defun xref--show-pos-in-buf (pos buf)
"Goto and display position POS of buffer BUF in a window.
Honor `xref--original-window-intent', run `xref-after-jump-hook'
@@ -777,7 +788,8 @@ xref--analyze
(pop-to-buffer (current-buffer))
(goto-char (point-min))
(setq xref--original-window (assoc-default 'window alist)
- xref--original-window-intent (assoc-default 'display-action alist))
+ xref--original-window-intent (assoc-default 'display-action alist)
+ xref--original-command this-command)
(current-buffer)))))
This bug report was last modified 5 years and 351 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.