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

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

bug#20489: 25.0.50; next-error-find-buffer chooses non-current buffer wi


From: Juri Linkov
Subject: bug#20489: 25.0.50; next-error-find-buffer chooses non-current buffer without good reason
Date: Wed, 28 Feb 2018 23:17:25 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu)

> Anyway, I've fixed the current problem (see below), so this is a matter of
> opinion. If you still consider this feature to be important, I think
> ideally we'd abstract it away behind a new -function variable as well.

Please clarify what do you have in mind.  In what place in code such
function could be called?

> This way, someone would also be able to implement window-local navigation
> relationship instead of buffer-local (you've mentioned this option before).

Window-local navigation could be implemented by something like below.
But maybe window-local specific code in next-error and next-error-internal
could be abstracted away in a function that you proposed above?

diff --git a/lisp/simple.el b/lisp/simple.el
index edcb73c..c0da57d 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -174,6 +174,8 @@ next-error-find-buffer-function
   "Function called to find a `next-error' capable buffer."
   :type '(choice (const :tag "Single next-error capable buffer on selected 
frame"
                         next-error-buffer-on-selected-frame)
+                 (const :tag "Previous next-error capable buffer on selected 
window"
+                        next-error-buffer-on-selected-window)
                  (const :tag "No default" ignore)
                  (function :tag "Other function"))
   :group 'next-error
@@ -195,6 +197,12 @@ next-error-buffer-on-selected-frame
     (if (eq (length window-buffers) 1)
         (car window-buffers))))
 
+(defun next-error-buffer-on-selected-window (&optional _avoid-current
+                                                       _extra-test-inclusive
+                                                       _extra-test-exclusive)
+  "Return the previous next-error buffer used in the selected window."
+  (window-parameter nil 'next-error-buffer))
+
 (defun next-error-find-buffer (&optional avoid-current
                                         extra-test-inclusive
                                         extra-test-exclusive)
@@ -285,6 +293,9 @@ next-error
         ;; Override possible change of next-error-last-buffer in 
next-error-function
         (setq next-error-last-buffer buffer)
         (setq-default next-error-last-buffer buffer)
+        (when (eq next-error-find-buffer-function
+                  'next-error-buffer-on-selected-window)
+          (set-window-parameter nil 'next-error-buffer buffer))
         (when next-error-recenter
           (recenter next-error-recenter))
         (message "%s error from %s"
@@ -306,6 +317,9 @@ next-error-internal
       ;; Override possible change of next-error-last-buffer in 
next-error-function
       (setq next-error-last-buffer buffer)
       (setq-default next-error-last-buffer buffer)
+      (when (eq next-error-find-buffer-function
+                'next-error-buffer-on-selected-window)
+        (set-window-parameter nil 'next-error-buffer buffer))
       (when next-error-recenter
         (recenter next-error-recenter))
       (message "Current error from %s" next-error-last-buffer)





reply via email to

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