emacs-devel
[Top][All Lists]
Advanced

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

Re: display-buffer-alist simplifications


From: Stefan Monnier
Subject: Re: display-buffer-alist simplifications
Date: Thu, 04 Aug 2011 17:01:41 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

>> It's also to force display-buffer (and switch-to-buffer when called
>> from Lisp packages) to use some other window/frame.  I don't want any
>> other buffer ever shown in my *Completions* window (which I carefully
>> size and place next to my minibuffer-only frame), same for my other
>> strongly-dedicated windows like *compilation*.
> I'd actually like to have *compilation* and *grep* (alternatively)
> use the same one window.  In that sense I always found that the
> 'dedicated' thing is too inflexible.

Yes, the `dedicated' is rather inflexible, and I'd agree with you (tho
not for *grep* and *compilation*, but for *vc-diff* and *diff* ;-).

But my proposal largely side-steps this issue since it's now a matter of
providing the corresponding display-buffer-group-dedicated function
which you could use as

  (...
   ("\\*\\(vc-\\)?diff*"
    display-buffer-group-dedicated (dedication-group . diffs))
   ("\\*\\(compilation\\|grep\\)\\*"
    display-buffer-group-dedicated (dedication-group . compilation))
   ...)

Note: that's been possible in special-display-regexps for many years,
provided you write display-buffer-group-dedicated.

> Btw. it is IMO wrong to cater for an unlimited number of (anonymous)
> windows.  Basically, you want 'display-buffer-alist' do two things
> at the same time:
>   1) associate buffers to windows,
> and also
>   2) specify these windows and their behavior

I guess I can see why that can be true for a single-frame usage.
It's going in the direction of ECB-style setups.

But I do use an unlimited number of windows (and frames), so I really
want to cater to such users as well ;-)

>   (setq window-parameter-list '(
>      (window-1 (spec . val) ....)
>      (window-2 (spec . val) ....)
>      (window-3 (spec . val) ....)
>      ))

>   (setq display-buffer-alist '(
>      ((name . "*completions*) . window-2)
>      ((name . "*Help*) . window-3)
>      ((name . "*grep*) . window-2) ;; for me, as above ;)
>      ((name . ".*") . window-1)
>      ))

You could write it as:

   (defun my-window-1 (buf) (foo1 buf (spec . val) ...)))
   (defun my-window-2 (buf) (foo2 buf (spec . val) ...)))
   (defun my-window-3 (buf) (foo3 buf (spec . val) ...)))
   
   (setq display-buffer-alist '(
      ("*completions*" my-window-2)
      ("*Help*" my-window-3)
      ("*grep*" my-window-2)
      (".*" my-window-1)
      ))

or [assuming there's a display-buffer-named-window function somewhere ]:

   (setq display-buffer-named-window-alist '(
      (window-1 (spec . val) ....)
      (window-2 (spec . val) ....)
      (window-3 (spec . val) ....)
      ))

   (setq display-buffer-alist '(
      ("*completions*" display-buffer-named-window window-2)
      ("*Help*" display-buffer-named-window my-window-3)
      ("*grep*" display-buffer-named-window my-window-2)
      (".*" display-buffer-named-window my-window-1)
      ))


-- Stefan



reply via email to

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