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


Message #169 received at 20489 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: 20489 <at> debbugs.gnu.org
Subject: Re: bug#20489: 25.0.50;
 next-error-find-buffer chooses non-current buffer without good reason
Date: Wed, 28 Feb 2018 23:25:02 +0200
> This way, someone would also be able to implement window-local navigation
> relationship instead of buffer-local (you've mentioned this option before).

In addition to code sent in the previous message that should select the right
next-error capable buffer from the navigated buffer (e.g. on typing ‘next-error’),
for window-local navigation we also need to select the last used window (e.g.
typing RET on the list of matches), so all navigation will be in the same window.

(defun display-buffer-in-next-error-last-window (buffer alist)
  "Return a window used to display the last next-error buffer."
  (let* ((window (car (delq nil
          (mapcar (lambda (w) (when (and (local-variable-p 'next-error-last-buffer
                                                           (window-buffer w))
                                         (eq (current-buffer)
                                             (buffer-local-value
                                              'next-error-last-buffer
                                              (window-buffer w))))
                                w))
                  (window-list-1 nil 'nomini))))))
    (when (window-live-p window)
      window
      (prog1 (window--display-buffer buffer window 'reuse alist)
        (unless (cdr (assq 'inhibit-switch-frame alist))
          (window--maybe-raise-frame (window-frame window)))))))

(push '("\\`\\*\\(compilation\\|grep\\|Occur\\)\\*\\'"
	display-buffer-in-next-error-last-window
	(inhibit-same-window . t))
      display-buffer-from-alist)

But this requires a feature that is not yet implemented, namely
a customization like ‘display-buffer-from-alist’ to match the source
buffer name (that was the current buffer before navigation) instead
of the target buffer (the buffer to display) like ‘display-buffer-alist’
currently specifies.




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.