[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#25054: 25.1; bury-buffer makes bad choice of next buffer
From: |
Francesco Potortì |
Subject: |
bug#25054: 25.1; bury-buffer makes bad choice of next buffer |
Date: |
Tue, 06 Dec 2016 12:48:00 +0100 |
> > My main problem is with the *mail* buffer (I have mail-user-agent set to
> > 'sendmail-user-agent). After I send mail, the *mail* buffer is buried,
> > but after a while it pops up. I would expect that, being buried, it is
> > the last choice as the other buffer. Apparently it is not.
>
>It is. But the "other buffer" is not necessarily the one that will be
>shown in a window when that window's previous buffer is about getting
>buried or killed.
...
>(progn
> (switch-to-buffer "a")
> (switch-to-buffer "b")
> (when (y-or-n-p "Bury b ? ")
> (bury-buffer))
> (while (y-or-n-p "Previous ? ")
> (previous-buffer)))
>
>The loop in this scenario will eventually switch to "b" (because it has
>been already shown in the selected window) rather than to "*Messages*"
>(simply because it has never shown up in that window before). We could
>invent an option to change that behavior, but so far you would be its
>only user. And it's not even clear to me how to formulate that option.
I see, thanks for the explanation.
I definitely do not like that behaviour. When I bury a buffer, I want
it to be the last choice for displaying a buffer in a window. It worked
like that in Emacs 22 and it was okay for me. I'd like to customise
that back. In Emacs 22, if I am not wrong that amounted to just advise
switch-to-buffer and changing buffer-name-history before executing the
original code. But by looking at the source code for switch-buffer in
buffer.c, it appears that wouldn't work any more.
Maybe I could write a piece of advise to switch-buffer or other-buffer
that plays with buffer predicates.
Or maybe I could try using the other_buffer_safely function in buffer.c
(but I don't know how to call it from elisp).
Can you suggest a way?
- bug#25054: 25.1; bury-buffer makes bad choice of next buffer,
Francesco Potortì <=