bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#6454: 24.0.50; kill-buffer switches current-buffer


From: martin rudalics
Subject: bug#6454: 24.0.50; kill-buffer switches current-buffer
Date: Fri, 18 Jun 2010 16:33:19 +0200
User-agent: Thunderbird 2.0.0.21 (Windows/20090302)

> I know that kill-buffer should not change current-buffer.

What about C-x k  ;-)

> It does do so
> in corner cases and that's a bug (which I've already worked around in
> some parts of the Elisp code because I couldn't figure out how to fix
> Fkill_buffer instead).
>
>> Looks like a bug but I'm not sure whether fixing it could break
>> other things.
>
> If the fix only affects kill-buffer, then it's likely safe.

It's not that trivial.  Fkill_buffer already calls Fset_buffer before
eventually calling it again in window_loop.  If the first call fails to
produce a good buffer, the buffer in the selected window might be the
better choice.

So we would have to check whether we want to kill the current buffer and
not change it if we don't.  Unfortunately, there's no proof that the
buffer current when calling `kill-buffer' is the buffer considered
current by the outermost calling application.  It might be just current
because some intermittent part (the actual caller of `kill-buffer')
wanted to have a look at the buffer's local variables.  So `kill-buffer'
can't be sure about the "real identity of the current buffer" either.

martin





reply via email to

[Prev in Thread] Current Thread [Next in Thread]