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 #14 received at 20206 <at> debbugs.gnu.org (full text, mbox):

From: Dima Kogan <dima <at> secretsauce.net>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 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: Fri, 27 Mar 2015 23:01:32 -0700
martin rudalics <rudalics <at> gmx.at> writes:

>  > -  (pop-to-buffer (current-buffer))
>
> Something must be wrong here.  According to its doc-string
> `pop-to-buffer' should
>
> "Select buffer BUFFER in some window, preferably a different one."
>
> But I nowhere see that it tries to enforce that.  Am I blind?

I don't see it either. (pop-to-buffer buf) simply does (display-buffer
buf).


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


>  > +  (pop-to-buffer (current-buffer) '(display-buffer-use-some-window (inhibit-same-window . t)))
>
> In any case `display-buffer-use-some-window' as sole action doesn't look
> right.  It should be preceded by `display-buffer-reuse-window' and
> `display-buffer-pop-up-window'.  And `pop-to-buffer' should do that
> already.

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.

dima




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.