Subject: bug#13167: 24.3.50; C-x right C-x left interferes with buffer order

From: martin rudalics <[email-masked]>
Date: Thu, 13 Dec 2012 11:29:53 +0100

> 1. emacs -Q
 > 2. C-h C-n
 > 3. C-x d RET
 > 4. v
 > 5. C-x right   (or C-h e for the same effect)

`next-buffer' picks a buffer that's not in the window's list of previous
buffers.

 > 6. C-x left

`previous-buffer' picks the buffer that was shown in the window before
the current buffer.

 > 7. q
 >
 > Then `q' displays the buffer `*Messages*' instead of the expected
 > previous Dired buffer `etc'.

This is from the doc-string of `quit-window':

   (3) restore the buffer previously displayed in WINDOW,

which is *Messages*.

 > Typing `C-x left' displays it,
 > but then another `q' displays the buffer `*Messages*' again.
 >
 > 8. C-x left
 > 9. q
 >
 > Again `*Messages*' instead of the expected NEWS.

Again according to the doc-string.

 > 10. C-x left
 > 11. q
 >
 > And again `*Messages*' instead of the expected *scratch*.
 >
 > So the question is why `*Messages*' gets in the way
 > in the list of previous buffers.

Simply because it is the last buffer displayed in that window before the
one you quit.  That's how it was designed and I'm not sure whether we
can do much better.  Why do you never quit the *Messages* buffer in your
scenario?  The semantics of C-x left and C-x right is that you want (or
at least don't mind) to switch back to the old buffer.  The semantics of
`quit-window' is that you don't want to switch back to the old buffer
soon.

martin