emacs-devel
[Top][All Lists]
Advanced

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

Re: kill-buffer calls frame's buffer-predicate for all buffers even if t


From: Eli Zaretskii
Subject: Re: kill-buffer calls frame's buffer-predicate for all buffers even if the killed buffer was not shown in any window.
Date: Sun, 15 Jan 2017 22:31:10 +0200

> From: Constantin Kulikov <address@hidden>
> Date: Sun, 15 Jan 2017 22:32:10 +0300
> 
> For example:
> 
> emacs -Q
> 
> M-: (set-frame-parameter nil 'buffer-predicate #'(lambda (b) (message "f-b-p: 
> %s" b))) RET
> M-: (with-temp-buffer nil) RET
> C-x b *Messages* RET
> 
> See that all buffers listed except of the *temp*(no window buffers were 
> changed). Why?

Because it needs to find another buffer to become the current one.
And it only searches until it finds the first buffer that is not
already visible in some window.  Your recipe just leaves it with too
few buffers, so it looks to you like it goes over all of them.

> This is inefficient, especially for the with-temp-buffer which is used very 
> frequently in emacs and in side
> packages.

As long as with-temp-buffer calls kill-buffer, there's no way around
it, because kill-buffer is a command that must fit user expectations.
We could perhaps introduce a new kill-temp-buffer primitive to avoid
the overhead.



reply via email to

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