[Top][All Lists]

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

Re: display-buffer-overriding-action

From: Chong Yidong
Subject: Re: display-buffer-overriding-action
Date: Tue, 13 Sep 2011 15:01:08 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Stefan Monnier <address@hidden> writes:

>> former is not a problem: C-x 5 b passes an ACTION argument to
>> pop-to-buffer, which takes precedence over d-b-alist.
> No, the ACTION argument takes precedence over d-b-default-action but not
> over d-b-alist.

I meant d-b-default-action there.

>> The display-buffer action functions aren't told what the original
>> arguments to display-buffer were, so it can't know whether
>> display-buffer was called for `C-x 5 b' or `C-x 4 b', or another
>> command entirely.
> C-x 5 b would not do
>   (display-buffer BUFFER <some-clever-action)
> but
>   (let ((d-b-overriding-action <some-clever-action>))
>     (display-buffer BUFFER))

In your scheme, under what circumstances would *any* Lisp caller of
display-buffer use the ACTION argument?

As far as I can see, every Lisp caller falls into one of two cases:

- "Generic" calls to display-buffer or pop-to-buffer, which don't intend
   to second guess Emacs defaults and/or user settings.

- Commands like `C-x 5 b' or `info-other-window', which fall under the
  "explicit command" criterion and should override the defaults.

Your rationale for not using the ACTION argument is to allow a third
case, wherein the Lisp caller wants to specify some behavior that can be
overridden by the user.  I contend that Lisp callers should almost never
do that: as far as possible, they should use a `bare' display-buffer or
pop-to-buffer call.  In that case, it's conceptually cleaner to handle
the second case by letting those callers use the ACTION argument.

Do you have any specific counterexamples in mind?

reply via email to

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