GNU bug report logs - #20489
25.0.50; next-error-find-buffer chooses non-current buffer without good reason

Previous Next

Package: emacs;

Reported by: Dmitry Gutov <dgutov <at> yandex.ru>

Date: Sat, 2 May 2015 23:19:01 UTC

Severity: normal

Found in version 25.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Juri Linkov <juri <at> linkov.net>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: 20489 <at> debbugs.gnu.org
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
> 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)




This bug report was last modified 7 years and 72 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.