unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: martin rudalics <rudalics@gmx.at>
Cc: 32607@debbugs.gnu.org
Subject: bug#32607: 27.0.50; pop-to-buffer in next-error-no-select
Date: Mon, 03 Sep 2018 01:43:02 +0300	[thread overview]
Message-ID: <87efebjzbd.fsf@mail.linkov.net> (raw)
In-Reply-To: <5B8B8DCE.4070704@gmx.at> (martin rudalics's message of "Sun, 02 Sep 2018 09:14:22 +0200")

[-- Attachment #1: Type: text/plain, Size: 1225 bytes --]

>> Suppose we have such customization:
>>
>>    (setq display-buffer-alist '(("\\`\\*grep\\*\\'" display-buffer-same-window)))
>>
>> Now after running grep with a non-empty output in ‘emacs -Q’,
>> typing ‘C-o’ (compilation-display-error) will display two identical
>> buffers instead of displaying the buffer with the found grep hit.
>>
>> The problem is with pop-to-buffer in next-error-no-select.
>> I wonder what is an idiomatic way to ensure a buffer is already
>> displayed in some window, to not display the same buffer
>> in other window?
>
> I'm not quite sure I understand: Is there a reason you did not supply
> 'display-buffer-reuse-window' in the above customization?

Because it's an idiomatic way to tell the Emacs window manager to
display the *grep* buffer in the same window (an old way to do the same
was using same-window-buffer-names and same-window-regexps)
when manually running M-x grep.

But it fails when using C-o from the already displayed *grep*.
I think next-error-no-select should override the user setting with
display-buffer-overriding-action because the purpose of pop-to-buffer in
next-error-no-select is to ensure the *grep* buffer is displayed somewhere:

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: next-error-no-select.1.patch --]
[-- Type: text/x-diff, Size: 569 bytes --]

diff --git a/lisp/simple.el b/lisp/simple.el
index 0ccf2f1d22..df7d86a835 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -385,7 +385,8 @@ next-error-no-select
   (interactive "p")
   (let ((next-error-highlight next-error-highlight-no-select))
     (next-error n))
-  (pop-to-buffer next-error-last-buffer))
+  (let ((display-buffer-overriding-action '(display-buffer-reuse-window)))
+    (pop-to-buffer next-error-last-buffer)))
 
 (defun previous-error-no-select (&optional n)
   "Move point to the previous error in the `next-error' buffer and highlight match.

  reply	other threads:[~2018-09-02 22:43 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-01 22:32 bug#32607: 27.0.50; pop-to-buffer in next-error-no-select Juri Linkov
2018-09-02  7:14 ` martin rudalics
2018-09-02 22:43   ` Juri Linkov [this message]
2018-09-03  7:31     ` martin rudalics
2018-09-03 22:31       ` Juri Linkov
2018-09-04  7:51         ` martin rudalics
2018-09-04 21:28           ` Juri Linkov
2018-09-05  7:47             ` martin rudalics
2018-09-05 22:06               ` Juri Linkov
2018-09-06  7:04                 ` martin rudalics
2018-09-06 21:56                   ` Juri Linkov
2018-09-07  6:28                     ` Eli Zaretskii
2018-09-08 23:28                       ` Juri Linkov
2018-09-09  5:44                         ` Eli Zaretskii
2018-09-07  7:28                     ` martin rudalics
2018-09-08 23:46                       ` Juri Linkov
2018-09-09  8:40                         ` martin rudalics
2018-09-09 16:01                           ` Juri Linkov
2018-09-10  8:29                             ` martin rudalics
2018-09-11 23:47                               ` Juri Linkov
2018-09-12  6:33                                 ` martin rudalics
2018-09-12 21:47                                   ` Juri Linkov
2018-09-12 22:03                           ` Stefan Monnier
2018-09-12 22:21                             ` Juri Linkov
2018-09-12 22:06                           ` Stefan Monnier
2018-09-13  7:46                             ` martin rudalics
2018-09-13 11:26                               ` Stefan Monnier
2018-09-13 23:04                                 ` Juri Linkov
2018-09-14  1:34                                   ` Stefan Monnier
2018-09-15 23:31                                     ` Juri Linkov
2018-09-16  9:09                                       ` martin rudalics
2018-09-16 21:19                                         ` Stefan Monnier

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=87efebjzbd.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=32607@debbugs.gnu.org \
    --cc=rudalics@gmx.at \
    /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).