From: Dave Abrahams <dave@boostpro.com>
To: martin rudalics <rudalics@gmx.at>
Cc: Alp Aker <alptekin.aker@gmail.com>, 12081@debbugs.gnu.org
Subject: bug#12081: 24.1; buffer-predicate often not called
Date: Mon, 30 Jul 2012 05:35:17 -0400 [thread overview]
Message-ID: <m2obmx1tii.fsf@pluto.luannocracy.com> (raw)
In-Reply-To: <5016502A.8060300@gmx.at> (martin rudalics's message of "Mon, 30 Jul 2012 11:13:14 +0200")
on Mon Jul 30 2012, martin rudalics <rudalics-AT-gmx.at> wrote:
>>> Why is showing the buffer visiting /tmp/xx bad in your scenario? Can
>>> you give a scenario where the present behavior really hurts you? In
>>> that case we can try to ignore such a buffer in `switch-to-prev-buffer'.
>>
>> Well, note that it's a regression: replace-buffer-in-windows used to
>> call other-window (via window-loop).
>
> This doesn't explain why showing the buffer visiting /tmp/xx is bad
> here.
<sigh>
It's only bad because the documentation led me to believe that I could
control what would be shown after kill-buffer by using buffer-predicate.
This is a *manufactured* test case, because my real use case is a lot
more complicated to set up. But I gave references to the actual case if
you really care about the motivation.
> If you show a buffer A in a window, then show a buffer B in that
> window and subsequently kill B, the most natural thing is to show A
> again in that window. In particular so, if B was used to display some
> temporary information.
I don't think anyone disputes that the current behavior is a good
default. But Emacs is all about customization, and overriding defaults
is an important part of that.
>> As for how it hurts not to check buffer predicates in
>> swtich-to-prev-buffer: Buffer predicates are supposed to provide a
>> way of exercising some control over what buffers are automatically
>> selected for display.
>
> In Dave's scenario neither of the file visiting buffers was shown
> automatically but under the user's control.
True, but I'm not sure what your point is here. I expected to be able
to exercise some control, but couldn't.
>> But if kill-buffer doesn't respect buffer
>> predicates, then there's not much point to setting up a buffer
>> predicate at all: why bother filtering buffers chosen for display, if
>> the filter isn't respected by one of the most common ways in which a
>> buffer is chosen for the user?
>
> `other-buffer' is used in many places for different reasons, so it's by
> no means obvious that it's about "filtering buffers chosen for
> display".
The intended use of "buffer-predicate" has no obvious (to me) connection
with the places or reasons that other-buffer is used.
> It has been used in `replace-buffer-in-windows' because there was no
> better alternative. And it might have been a good idea to not call
> this parameter "buffer-predicate" in the first place but something
> more indicative.
Indicative of what?
> Also the manual text
>
>> `buffer-predicate'
>> The buffer-predicate function for this frame. The function
>> `other-buffer' uses this predicate (from the selected frame) to
>> decide which buffers it should consider, if the predicate is not
>> `nil'. It calls the predicate with one argument, a buffer, once
>> for each buffer; if the predicate returns a non-`nil' value, it
>> considers that buffer.
>
> is misleading:
> Neither `other-buffer' nor `replace-buffer-in-windows' necessarily
> care about which frame is selected when they get called. When killing
> a buffer `replace-buffer-in-windows' obviously has to act on all
> windows on all frames.
IMO this means the result of (selected-frame) will be temporarily set,
during the call to buffer-predicate, for each frame that needs to be
changed, and buffer-predicate will be called for each such frame. Those
are the only semantics that make sense as long as buffer-predicate takes
one argument.
--
Dave Abrahams
BoostPro Computing Software Development Training
http://www.boostpro.com Clang/LLVM/EDG Compilers C++ Boost
next prev parent reply other threads:[~2012-07-30 9:35 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-28 20:47 bug#12081: 24.1; buffer-predicate often not called Dave Abrahams
2012-07-29 13:56 ` martin rudalics
2012-07-29 15:05 ` Dave Abrahams
2012-07-29 17:08 ` martin rudalics
2012-07-29 17:31 ` Alp Aker
2012-07-29 18:24 ` Dave Abrahams
2012-07-29 21:37 ` Dave Abrahams
2012-07-29 23:30 ` Alp Aker
2012-07-29 23:53 ` Dave Abrahams
2012-07-30 9:13 ` martin rudalics
2012-07-30 9:35 ` Dave Abrahams [this message]
2012-07-30 17:42 ` martin rudalics
2012-07-30 20:13 ` Dave Abrahams
2012-07-31 8:39 ` martin rudalics
2012-08-13 22:13 ` Dave Abrahams
2012-08-14 9:09 ` martin rudalics
2012-08-14 16:07 ` Dave Abrahams
2012-07-30 16:22 ` Alp Aker
2012-07-30 16:33 ` Alp Aker
2012-07-30 17:42 ` martin rudalics
2012-07-31 6:59 ` Alp Aker
2012-07-31 8:40 ` martin rudalics
2012-08-31 17:15 ` martin rudalics
2012-09-05 14:30 ` martin rudalics
2012-07-30 17:42 ` martin rudalics
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=m2obmx1tii.fsf@pluto.luannocracy.com \
--to=dave@boostpro.com \
--cc=12081@debbugs.gnu.org \
--cc=alptekin.aker@gmail.com \
--cc=rudalics@gmx.at \
/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).