martin rudalics <rudal...@gmx.at> writes: > > It seems to work, although somewhat different than I described. > > > > With your diff, in case (2), if BUFFER is what is passed to > > `pop-to-buffer' and BUFFER2 is indirectly related buffer displayed in a > > visible window, then BUFFER2 is replaced with BUFFER. I expected that > > BUFFER2's window will be selected; nothing more. > > Hmmm... This is not really what 'display-buffer' is supposed to do. I > have to disguise the fact that we wanted to display BUFFER. I attach a > new patch.
Now, when you said that, it does feel not right indeed. What I was concerned about is the situation my request originated from: 1. Org displays a *narrowed* indirect buffer 2. User requests to jump to a heading in base buffer of that indirect buffer 3. Changing the buffer (even in the same window - with your patch) will suddenly change the narrowing state. That said, it is not a problem `display-buffer' is supposed to solve anyway. The modified `get-buffer-window-list' from your patch may also be used in the above scenario before deciding which buffer we want to change to. So, I'd myself vote for the first version of the patch if looking from more general Emacs perspective. -- Ihor Radchenko // yantar92, Org mode maintainer, Learn more about Org mode at <https://orgmode.org/>. Support Org development at <https://liberapay.com/org-mode>, or support my work at <https://liberapay.com/yantar92>