bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#20206: 25.0.50; [PATCH] keep diff-mode's window visible when we visi


From: martin rudalics
Subject: bug#20206: 25.0.50; [PATCH] keep diff-mode's window visible when we visit sources from diff-mode
Date: Sat, 28 Mar 2015 10:58:55 +0100

>> And `display-buffer' should not use the selected window either, after
>> all it's likely the most recently used one. Could you please debug
>> this in order to explain why the selected window gets used in all
>> these cases?
>
> I think it uses the most recent window a buffer was displayed in. If
> this most-recenty-used window now shows a different buffer, then this
> new buffer is covered up. Example:
>
> emacs24 -Q --eval '(progn
>    (split-window-horizontally)     # split into left,right; *scratch* in each
>    (other-window 1)                # focus the right window (*scratch*)
>    (switch-to-buffer "asdf")       # right window now has buffer "asdf"
>    (other-window 1)                # focus the left window (*scratch*)
>    (switch-to-buffer "*Messages*") # left window now has buffer *Messages*
>    (switch-to-buffer "*scratch*")  # left window back to buffer *scratch*
>    (display-buffer "*Messages*")   # display *Messages* somewhere
>   )'
>
> Running the above covers up the focused *scratch* buffer in the left
> window. Running it in emacs23 instead does NOT cover it up, which is the
> behavior that feels more right to me. The recent patches try to get back
> to this state.
>
> If we do not do the
>
>   (switch-to-buffer "*Messages*") (switch-to-buffer "*scratch*")
>
> dance then the *scratch* buffer isn't covered up even in emacs24.

I see.  This is due to `display-buffer-in-previous-window' which covers
such idiosyncrasies like *Backtrace* alternately appearing in one and
the other window (because the least recently used window alternates
continuously).  Your `switch-to-buffer' calls imply that you do want to
see both *Messages* and *scratch* preferably in the left window and
`display-buffer' complies.

You can switch this off by customizing `display-buffer-base-action'
accordingly.

> OK, but if the larger question is now on the table, (about what should
> (pop-to-buffer) and (display-buffer) do by default), we should probably
> answer that first.

Can you tell me whether and how `display-buffer-in-previous-window' is
used in the `diff-mode' scenario (I use a highly customized `ediff-mode'
so I can't easily check that myself).  Does it use `switch-to-buffer'?

martin





reply via email to

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