Subject: Re: bug#20206: 25.0.50; [PATCH] keep diff-mode's window visible when we visit sources from diff-mode

From: Dima Kogan <[email-masked]>
Date: Sat, 28 Mar 2015 14:44:14 -0700

martin rudalics <[email-masked]> writes:

> 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'?

The diff-mode scenario is the same as the other example. M-enter invokes
(diff-goto-source), which invokes (pop-to-buffer), which invokes
(display-buffer). Here's the previous example, but using diff-mode
instead. Assuming "dat" and "dat.patch" exist in the current directory
(attached):

emacs -Q --eval '(progn

  (find-file "dat")
  (find-file "dat.patch")        # open both files; one window/frame
  (split-window-horizontally)    # two windows; both show "dat.patch"
  (other-window 1)               # switch to right window
  (switch-to-buffer "asdf")      # switch to dummy "asdf" buffer
  (other-window 1)               # left window active with "dat.patch",
                                 # right shows "asdf"

  (switch-to-buffer "dat")
  (switch-to-buffer "dat.patch") # left window: show "dat" and then back
                                 # to "dat.patch"

  (diff-goto-source))            # navigate to the diff source

In emacs23 the "dat" buffer is shown in the window OTHER than the one
showing the diff. In emacs24, the diff window is covered up.