emacs-devel
[Top][All Lists]
Advanced

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

Re: display-buffer-alist simplifications


From: Chong Yidong
Subject: Re: display-buffer-alist simplifications
Date: Wed, 03 Aug 2011 16:29:07 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

martin rudalics <address@hidden> writes:

> I suppose that what you mean here is to rewrite Emacs 23 options like
> `even-window-heights' and `split-height-threshold' where applicable.
> These values would serve as the default values for any buffer, that is,
> there would be no distinction between *Help* and *Info* buffers wrt the
> minimum height of their windows, I presume.  Then the applications could
> override this by their plists and `display-buffer-alist' would override
> the application's and the default values.  Is that correct?
>
> One idea of `display-buffer-alist' was to concentrate all display
> buffer related variables into one and make any additions inside that
> variable.  A basic drawback of the <= Emacs 23 approach was that we
> always added variables like `display-buffer-reuse-frames' and
> `display-buffer-mark-dedicated' with very ad hoc semantics many people
> don't understand.

Fair enough.  So use `display-buffer-fallback-alist' as Juri said.  The
main point is to make it so that (i) display specifiers behave like
familiar old variable binding, and (ii) there is an easy way to set the
default without introducing complex merging sematics.

OTOH, this can be implemented internally as local vars---concatenate all
the alists from the display-buffer-alist, the display-buffer arg, and
display-buffer-fallback-alist into one big alist, then do a
destructuring-bind.

> Any such thing like `display-buffer-fallback-alist' has to cope with
> the variables `special-display-buffer-names' and
> `special-display-regexps' which may prescribe individual behavior
> based on the names of buffers.  There is no "global" default value for
> all buffers unless we are prepared to sacrifice compatibility with
> Emacs 23.

We can specify that these old variables override the new behavior,
i.e. `display-buffer-fallback-alist' only applies to buffers not
matching `special-display-buffer-names'.

>> 2) Make the "display methods" specifier just another one of these
>>    variables, e.g. call it `display-buffer-method'.
>
> Would this discriminate buffers via regexps and how would you apply
> the "try reusing a window and if that fails pop up a new one ..."
> here?
>
> Would we write, for example,
>
>   (setq display-buffer-method '(pop-up-window reuse-window))
>
> If so how would we express to first find another window showing the
> same buffer and then another window showing another buffer?

One way would be to allow display-buffer-method to be a list of macro
specifiers, e.g. something like:

  (setq display-buffer-fallback-alist
    '((display-buffer-method (other-window-same-buffer other-window))))

  (setq display-buffer-macro-specifiers
    '((other-window-same-buffer
       (display-buffer-method reuse-window)
       (reuse-window-buffer same)
       (reuse-window-window other))
      (other-window
       (display-buffer-method reuse-window)
       (reuse-window-window other))



reply via email to

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