emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debbugs-tracker] bug#35737: closed (xref--original-command)


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#35737: closed (xref--original-command)
Date: Tue, 28 May 2019 20:48:04 +0000

Your message dated Tue, 28 May 2019 23:30:30 +0300
with message-id <address@hidden>
and subject line Re: bug#35737: xref--original-command
has caused the debbugs.gnu.org bug report #35737,
regarding xref--original-command
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
35737: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=35737
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: xref--original-command Date: Tue, 14 May 2019 23:53:42 +0300 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu)
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)))))
 



--- End Message ---
--- Begin Message --- Subject: Re: bug#35737: xref--original-command Date: Tue, 28 May 2019 23:30:30 +0300 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu)
> "revert buffer" sounds like undoing changes, and we're repeating a search
> and refreshing (or maybe reloading) the results.

"revert buffer" is a standard term for updating an Emacs buffer.

> I get the idea, but not the goal. I know why we'd want to make
> xref-find-definitions and project-find-regexp to behave differently. The
> rest, I'm not so clear.
>
> Anyway, I was hoping my efforts in improving the default behavior would
> benefit your goals as well, but it seems the split between xref--show-xrefs
> and xref--show-defs goes against them. That's too bad.

Thanks for your efforts.  Your recent changes would be useful for other goals,
e.g. making the xref output to use grep-like output format.

>> The goal was to improve the default behavior to make customization easier.
>
> That's why I added xref-show-definitions-function.
>
> Customizing display-buffer-alist is an arcane art. The hook this variable
> provides should be easier to understand for an average user.
>
> So, to clarify, you're not interested in changing the *visible* default
> behavior, at least for now?

No, not a visual change this time.  I'd also close bug#33992 because
it's also leading nowhere.  But maybe your recent patch with
xref--definitions-buffer-mode is an improvement, I don't know.

I'm looking at xref from customization's point of view, and I see no more
improvements that could simplify xref customization.


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]