unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Constantin Kulikov <zxnotdead@gmail.com>
Cc: emacs-devel@gnu.org
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	[thread overview]
Message-ID: <83inpg9ib5.fsf@gnu.org> (raw)
In-Reply-To: <CAFkz2yqH6ruYjisdpOv8+Ao=0CMBxv0qPC1DQ+4vRJfoY5Oa3w@mail.gmail.com> (message from Constantin Kulikov on Sun, 15 Jan 2017 22:32:10 +0300)

> From: Constantin Kulikov <zxnotdead@gmail.com>
> 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	other threads:[~2017-01-15 20:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-15 19:32 kill-buffer calls frame's buffer-predicate for all buffers even if the killed buffer was not shown in any window Constantin Kulikov
2017-01-15 20:31 ` Eli Zaretskii [this message]
2017-01-16  8:14   ` Constantin Kulikov
2017-01-16 16:26     ` Eli Zaretskii
2017-01-16 16:55       ` Eli Zaretskii
2017-01-16 22:21       ` Constantin Kulikov
2017-01-17 14:26         ` Stefan Monnier
2017-01-17 14:40         ` Constantin Kulikov
2017-01-18 10:03           ` Constantin Kulikov
2017-01-18 15:43             ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83inpg9ib5.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=zxnotdead@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).