unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: Dmitry Gutov <dgutov@yandex.ru>
Cc: 20489@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	[thread overview]
Message-ID: <87zi3s7r16.fsf@mail.linkov.net> (raw)
In-Reply-To: <de30f4c8-ecb8-47d3-5af4-c8395337f984@yandex.ru> (Dmitry Gutov's message of "Wed, 28 Feb 2018 04:13:54 +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)





  reply	other threads:[~2018-02-28 21:17 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-02 23:17 bug#20489: 25.0.50; next-error-find-buffer chooses non-current buffer without good reason Dmitry Gutov
2015-05-03  5:49 ` Stefan Monnier
2015-05-03 12:56   ` Dmitry Gutov
2015-05-04 22:03     ` Ted Zlatanov
2015-05-04 22:22       ` Dmitry Gutov
2015-05-04 22:33         ` Ted Zlatanov
2015-05-05 15:05           ` Dmitry Gutov
2015-05-05 15:15             ` Ted Zlatanov
2016-01-24 21:10 ` Juri Linkov
2016-01-25  6:23   ` Dmitry Gutov
2016-01-25 21:55     ` Juri Linkov
2016-01-25 23:36       ` Dmitry Gutov
2016-01-27  0:57         ` Juri Linkov
2016-01-27  2:43           ` Dmitry Gutov
2016-01-27 22:57             ` Juri Linkov
2016-01-27 23:28               ` Dmitry Gutov
2016-01-28 23:59                 ` Juri Linkov
2016-01-29  0:35                   ` Dmitry Gutov
2016-01-29 23:44                     ` Juri Linkov
2016-01-30  0:57                       ` Dmitry Gutov
2016-01-30 23:43                         ` Juri Linkov
2016-01-31  0:39                           ` Dmitry Gutov
2016-01-31 21:57                             ` Juri Linkov
2016-01-31 22:38                               ` Dmitry Gutov
2016-02-02  0:44                                 ` Juri Linkov
2016-02-02  1:40                                   ` Dmitry Gutov
2016-02-03  0:35                                     ` Juri Linkov
2016-02-04  1:00                                       ` Dmitry Gutov
2016-02-22  0:01 ` Dmitry Gutov
2016-02-22 17:22   ` Eli Zaretskii
2016-02-22 17:30     ` Dmitry Gutov
2016-02-22 17:39       ` Eli Zaretskii
2016-02-22 18:09         ` Dmitry Gutov
2016-02-22 18:11           ` Dmitry Gutov
2016-02-22 19:07           ` Eli Zaretskii
2016-02-27 10:14   ` Eli Zaretskii
2016-02-29  3:15     ` Dmitry Gutov
2016-02-29 16:23       ` Eli Zaretskii
2016-02-29 23:30         ` Dmitry Gutov
2017-11-06 21:53 ` Juri Linkov
2018-02-15 22:16   ` Juri Linkov
2018-02-27  1:21     ` Dmitry Gutov
2018-02-27  1:54       ` Dmitry Gutov
2018-02-27 18:07         ` Dmitry Gutov
2018-02-27 21:16         ` Juri Linkov
2018-02-28  2:13           ` Dmitry Gutov
2018-02-28 21:17             ` Juri Linkov [this message]
2018-03-02  1:19               ` Dmitry Gutov
2018-03-06 22:17                 ` Juri Linkov
2018-03-07 14:11                   ` Dmitry Gutov
2018-03-07 21:11                     ` Juri Linkov
2018-03-12 22:08                       ` Dmitry Gutov
2018-02-28 21:25             ` Juri Linkov
2018-03-01 22:58               ` Juri Linkov
2018-03-02  1:26                 ` Dmitry Gutov
2018-03-06 22:25                   ` Juri Linkov
2018-03-07 14:08                     ` Dmitry Gutov
2018-03-07 21:03                       ` Juri Linkov
2018-02-28 21:32             ` Juri Linkov
2018-03-02  0:54               ` Dmitry Gutov
2018-03-01 23:04             ` Juri Linkov
2018-03-02  1:30               ` Dmitry Gutov
2018-02-28 17:33           ` Richard Stallman
2018-02-21 21:30   ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zi3s7r16.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=20489@debbugs.gnu.org \
    --cc=dgutov@yandex.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).