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:25:02 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu)

> 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.





reply via email to

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