emacs-devel
[Top][All Lists]
Advanced

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

Re: display-buffer-alist simplifications


From: Juri Linkov
Subject: Re: display-buffer-alist simplifications
Date: Mon, 01 Aug 2011 11:20:04 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (x86_64-pc-linux-gnu)

>     (:inherit
>      (repeat :tag "Inherit"
>
> in `custom-face-attributes'?  If so, then this specifies inheritance
> explicitly.  The inheritance mechanism used by `display-buffer-alist' is
> implicit.

Yes, I meant exactly that.  Explicit settings are easier to understand
and customize for the users.

> Let's consider the following example setup:
>
> (setq
>  display-buffer-alist
>  '((((regexp . ".*")) (pop-up-window (largest) (lru)))
>    (((regexp . "^\\*Help\\*$")) (pop-up-window-set-height . 
> fit-window-to-buffer))
>    (((regexp . "^\\*.+\\*$")) (pop-up-window-set-height . 20))
>    (((regexp . ".*")) (pop-up-window-min-height . 15))))

This is a kind of inheritance by regexps, i.e. a set of buffer names
matched by a stricter regexp is a subset of buffer names matched by a
more loose regexp.  ("Inheritance" is not the right term here, but
acceptable in a sense that a set of objects instantiated by a subclass
is a subset of the set of all objects instantiated by its parent.)

> Now the questions are whether (1) writing such specifications is useful
> in the first place, and (2) whether such implicit inheritance is useful.
> If they are, I don't see a way to _explicitly_ specify that *Help*
> buffers should inherit the minimum window height from the specifier for
> all buffers.

Yes, writing such specifications is useful and "inheritance by regexps"
is useful.  But actually I meant inheritance for named specifications
like macro specifiers (and they are not required to use regexps).

>> I also want to note that tags like `reuse-window' and `pop-up-window'
>> are redundant in plists.  Their meaning can be expressed as plists like
>> `:window same', `:window other', `:buffer same'.
>
> These tags are mainly used to group items together for the customization
> interface: A user caring about how to display a buffer on a separate
> frame shouldn't be concerned with specifiers that describe how to pop up
> a new window for that buffer.  On the "top level" :window is ambiguous
> because it can mean the window to reuse or the window to split.  So we
> would have to write ":window-to-reuse same" and ":window-to-split lru"
> or something the like.

This is the most difficult part of the design - to find a good balance
between customization tags and parameters.

>> This would bring
>> them closer to the syntax of defface specs that is proven to be flexible
>> and easy to configure.
>
> If I leave in inheritance, the form above could be simplified to say
>
> (setq
>  display-buffer-alist
>  '((".*" :pop-up-window largest)
>    (".*" :pop-up-window lru)
>    ("^\\*Help\\*$" :pop-up-window-set-height fit-window-to-buffer)
>    ("^\\*.+\\*$" :pop-up-window-set-height 20)
>    (".*" :pop-up-window-min-height 15)))

This looks nicer.  But currently I don't know how expressive it will be.



reply via email to

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