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

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

bug#44611: Prefix arg for xref-goto-xref


From: Dmitry Gutov
Subject: bug#44611: Prefix arg for xref-goto-xref
Date: Sun, 27 Dec 2020 20:53:14 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0

On 27.12.2020 18:22, Juri Linkov wrote:
On the subject of grep-mode, it could have a similar command introduced
too, for situations when you only needed to find one occurrence, to jump to
it and quit the window.
This is what I already successfully use:

diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index d2293151c7..08c44dcb25 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -2572,11 +2572,15 @@ compile-goto-error
    (or (compilation-buffer-p (current-buffer))
        (error "Not in a compilation buffer"))
    (compilation--ensure-parse (point))
+  (let ((window (posn-window (event-end event))))
      (if (get-text-property (point) 'compilation-directory)
          (dired-other-window
           (car (get-text-property (point) 'compilation-directory)))
        (setq compilation-current-error (point))
-    (next-error-internal)))
+      (next-error-internal))
+    (when current-prefix-arg
+      (with-selected-window window
+        (quit-window)))))

So... if others like it, we could keep just this binding (C-u RET) for "quit the window and go to location", in both Grep and Xref.





reply via email to

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