GNU bug report logs - #20206
25.0.50; [PATCH] keep diff-mode's window visible when we visit sources from diff-mode

Previous Next

Package: emacs;

Reported by: Dima Kogan <dima <at> secretsauce.net>

Date: Thu, 26 Mar 2015 18:25:02 UTC

Severity: wishlist

Tags: patch

Found in version 25.0.50

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


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

From: Eli Zaretskii <eliz <at> gnu.org>
To: martin rudalics <rudalics <at> gmx.at>
Cc: mrsam <at> courier-mta.com, 20206 <at> debbugs.gnu.org
Subject: Re: bug#20206: 25.0.50;
 [PATCH] keep diff-mode's window visible when we visit sources from
 diff-mode
Date: Mon, 13 Apr 2015 17:34:03 +0300
> Date: Mon, 13 Apr 2015 14:14:14 +0200
> From: martin rudalics <rudalics <at> gmx.at>
> Cc: help-gnu-emacs <at> gnu.org
> 
>  > The change in behavior is when there are already two buffers being shown, with different files. So, with two files, a and b:
>  >
>  >
>  > $ emacs -Q a b
>  >
>  > I get just "b" displayed.
>  >
>  > ^X^B^Xo, cursor down, Enter.
>  >
>  > I get the "b" file in the top window, "a" file in the bottom window, with the cursor in the "a" file's window.
>  >
>  >
>  > ^X^B
>  >
>  > The buffer window now replaces the "a" file, where the cursor was, and the cursor now winds up in the buffer list window. That's the different behavior than what I'm used to.
>  >
>  >
>  > Now, if instead of doing ^X^B at this point, I press ^Xo, moving the cursor back to the "b" file's window, then ^X^B still opens the list buffer in the "a" file's window (also).
>  >
>  >
>  > So, maybe the change in behavior is that list-buffers' window is "sticky", and it tries to open the buffer window in the same window it was previously shown in, apparently. If that window is showing another file buffer, even if the cursor is still in that file buffer the buffer list window still gets opened there, replacing the buffer the cursor was in.
>  >
>  >
>  > So, depending on window history, ^X^B ends up either opening the buffer list window in some other window, than the one the cursor is currently in, or the same window where the cursor is. I'm pretty sure that in earlier versions of emacs, ^X^B never opened the list buffer in the same window the cursor was, at the time the list-buffers command was executed.
>  >
>  >
>  > And that's where my muscle memory is failing me now. I'm used to having multiple windows open; and with the cursor in one of them, ^X^B opening the buffer in some other window, and then typing ^Xo to jump into the buffer list window. Now, depending on where the buffer-list window was previously shown, it will now open in the same window with the cursor, and I realize belatedly, after I already jumped somewhere else with ^Xo.
> 
> Your explanation is correct.  The behavior is intended as a feature but
> inherently breaks the behavior of `pop-to-buffer', especially when used
> interactively.  I intend to fix this soonish for Emacs 25 and also post
> a simple workaround you can use for Emacs 24.4.

I think the following piece of magic will do what Sam wanted:

  (setq display-buffer-alist
        '(("\\*Buffer List\\*" .
           (display-buffer-pop-up-window '((inhibit-same-window . t))))))

If this is desired for all buffers, the regexp should be changed to
something that matches any buffer name.




This bug report was last modified 5 years and 335 days ago.

Previous Next


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