emacs-devel
[Top][All Lists]
Advanced

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

Re: display-buffer-alist simplifications


From: martin rudalics
Subject: Re: display-buffer-alist simplifications
Date: Sat, 23 Jul 2011 09:56:45 +0200
User-agent: Thunderbird 2.0.0.21 (Windows/20090302)

>    It would be cleaner to use a
>    plist, like this:
>
>     (reuse-window :window same :reuse-window-even-sizes t)
>
>    where ALL the behaviors are grouped together.

With the current `display-buffer-alist' writing

(setq
 display-buffer-alist
 '((((regexp . ".*"))
    (reuse-window nil same)
    (reuse-window other)
    (reuse-window-even-sizes . t))))

means to (1) try finding any window on the selected frame that shows the
buffer already, or (2) reuse any but the selected window on the selected
frame, evening out window sizes in both cases, if applicable.

A naive rewrite of this specifier according to your proposal would yield

(setq
 display-buffer-alist
 '(".*"
   (reuse-window :buffer same)
   (reuse-window :window other)
   (reuse-window :even-sizes t)))

The problem here is that the (reuse-window :window other) specifier
would change the semantics of the (reuse-window :buffer same) specifier
to _not reuse_ the selected window even if it shows the buffer.  Hence
the entry is not semantically equivalent to the former one.

There are various ways to achieve equivalence, neither of them entirely
satisfactory:

(1) Use a list as value for the method specifier similar to the
    current approach, for example

(setq
 display-buffer-alist
 '(".*"
   (reuse-window :which '(nil same))
   (reuse-window :which '(other))
   (reuse-window :even-sizes t)))


(2) Require that an entry for :window is present for any reuse-window
    method specifier, so we'd have to write

(setq
 display-buffer-alist
 '(".*"
   (reuse-window :window nil :buffer same :frame nil)
   (reuse-window :window other :buffer nil :frame nil)
   (reuse-window :even-sizes t)))


(3) Disallow lookup for further occurrences of the same specifier.
    This implies that we'd have to write

(setq
 display-buffer-alist
 '(".*"
   (reuse-window :buffer same :even-sizes t)
   (reuse-window :window other :even-sizes t)))

Which one would you prefer?  Any other suggestions?

martin



reply via email to

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