From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: display-buffer-alist simplifications Date: Thu, 04 Aug 2011 17:01:41 -0400 Message-ID: References: <4E3AFA34.2090903@gmx.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; CHARSET=US-ASCII Content-Transfer-Encoding: 7BIT X-Trace: dough.gmane.org 1312491715 22293 80.91.229.12 (4 Aug 2011 21:01:55 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 4 Aug 2011 21:01:55 +0000 (UTC) Cc: emacs-devel@gnu.org To: grischka Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Aug 04 23:01:51 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Qp538-0007wU-Ee for ged-emacs-devel@m.gmane.org; Thu, 04 Aug 2011 23:01:50 +0200 Original-Received: from localhost ([::1]:46003 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qp538-0006NT-2B for ged-emacs-devel@m.gmane.org; Thu, 04 Aug 2011 17:01:50 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:49310) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qp535-0006NO-4Y for emacs-devel@gnu.org; Thu, 04 Aug 2011 17:01:48 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qp534-0000iy-6Q for emacs-devel@gnu.org; Thu, 04 Aug 2011 17:01:47 -0400 Original-Received: from relais.videotron.ca ([24.201.245.36]:21483) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qp534-0000ip-3d for emacs-devel@gnu.org; Thu, 04 Aug 2011 17:01:46 -0400 Original-Received: from ceviche.home ([96.22.109.87]) by vl-mr-mrz22.ip.videotron.ca (Sun Java(tm) System Messaging Server 6.3-8.01 (built Dec 16 2008; 32bit)) with ESMTP id <0LPF003Y392UGSI0@vl-mr-mrz22.ip.videotron.ca> for emacs-devel@gnu.org; Thu, 04 Aug 2011 17:01:42 -0400 (EDT) Original-Received: by ceviche.home (Postfix, from userid 20848) id 13F3A660CF; Thu, 04 Aug 2011 17:01:42 -0400 (EDT) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-Received-From: 24.201.245.36 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:142890 Archived-At: >> 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