4
votes

I'm a new Emacs user, and learning how to split the window vertically and cycling the buffers in each pane.

However, after opening a new file in one pane, next-buffer does not cycle through this file in the other pane, but only after it has appeared once in the new pane. This can be reproduced as follows:

Open 2 files A and B in a new emacs session.

Split the windows vertically using 'split-window-right'.

'next-buffer' cycles through A and B in PaneLeft and PaneRight.

Open file C in PaneLeft.

'next-buffer' cycles through A, B, C in PaneLeft.

Ensure C is focused in PaneLeft, then switch to PaneRight. 'next-buffer' only cycles through A and B in PaneRight. It skips C possibly because C is already visible in PaneLeft.

Switch back to PaneLeft, and ensure A or B is focused in PaneLeft.

Switch back to PaneRight, now 'next-buffer' cycles through A, B, and C, regardless of what is visible in PaneLeft.

Is this the intended behaviour? How would I get it to work as I intended?

Note: I'm running without any custom extensions, and my .emacs is pretty much empty.

1
I can't reproduce this in emacs24 on Windows XP. I cycle through all buffers in both windows.mamboking
next-buffer avoids showing a buffer already visible in other window, that is intended behavior (don't know if there's some interactive replacement for next-buffer without this property)Anton Kovalenko
thanks for the tip, I edited the question to reflect my findings after more investigation. It does seem to be possible for next-buffer to show a buffer visible in the other window, but not initially.Justin Wong

1 Answers

2
votes

There is switch-to-visible-buffer variable to control this behavior. From GNU Emacs 24.2's documentation:

switch-to-visible-buffer is a variable defined in `window.el'.
Its value is t

Documentation:
If non-nil, allow switching to an already visible buffer.
If this variable is non-nil, `switch-to-prev-buffer' and
`switch-to-next-buffer' may switch to an already visible buffer
provided the buffer was shown in the argument window before.  If
this variable is nil, `switch-to-prev-buffer' and
`switch-to-next-buffer' always try to avoid switching to a buffer
that is already visible in another window on the same frame.

You can customize this variable.

This variable was introduced, or its default value was changed, in
version 24.1 of Emacs.

If this doesn't work as it is supposed to work, there probably is a bug.