From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andy Moreton Newsgroups: gmane.emacs.devel Subject: Re: display-buffer-alist simplifications Date: Tue, 02 Aug 2011 00:34:22 +0100 Message-ID: <82livcwvsx.fsf@gmail.com> References: <87mxgem09k.fsf@stupidchicken.com> <4E2A7EBD.7050300@gmx.at> <87livooqt6.fsf@stupidchicken.com> <4E2B158B.1080101@gmx.at> <87wrf8iyse.fsf@stupidchicken.com> <4E2BEED2.5040608@gmx.at> <8739hvu6lh.fsf@stupidchicken.com> <4E2C50E6.3020103@gmx.at> <878vrnweju.fsf@stupidchicken.com> <4E2D34D7.4040002@gmx.at> <87r55cjvef.fsf@stupidchicken.com> <87sjpsnerd.fsf@mail.jurta.org> <4E355D2C.40709@gmx.at> <87k4axzg7j.fsf@mail.jurta.org> <87oc092gy0.fsf@stupidchicken.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1312241701 28843 80.91.229.12 (1 Aug 2011 23:35:01 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 1 Aug 2011 23:35:01 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Aug 02 01:34:58 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 1Qo20f-0003eT-8z for ged-emacs-devel@m.gmane.org; Tue, 02 Aug 2011 01:34:57 +0200 Original-Received: from localhost ([::1]:38144 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qo20e-0006zG-QO for ged-emacs-devel@m.gmane.org; Mon, 01 Aug 2011 19:34:56 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:60746) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qo20b-0006yy-W9 for emacs-devel@gnu.org; Mon, 01 Aug 2011 19:34:54 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qo20a-0001vv-UA for emacs-devel@gnu.org; Mon, 01 Aug 2011 19:34:53 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:52299) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qo20a-0001vc-D9 for emacs-devel@gnu.org; Mon, 01 Aug 2011 19:34:52 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1Qo20Z-0003dH-3l for emacs-devel@gnu.org; Tue, 02 Aug 2011 01:34:51 +0200 Original-Received: from 82-69-64-228.dsl.in-addr.zen.co.uk ([82.69.64.228]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 02 Aug 2011 01:34:51 +0200 Original-Received: from andrewjmoreton by 82-69-64-228.dsl.in-addr.zen.co.uk with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 02 Aug 2011 01:34:51 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 58 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 82-69-64-228.dsl.in-addr.zen.co.uk User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (windows-nt) Cancel-Lock: sha1:CnGuCXGpNQEqBYsCvBcn2rEuds4= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 80.91.229.12 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:142651 Archived-At: On Mon 01 Aug 2011, Chong Yidong wrote: > Here is one suggestion. > > 1) Expose all the internal "variables" currently living inside > display-buffer-alist as Lisp variables, e.g. reuse-window-even-sizes > and pop-up-window-min-height. > > 2) Make the "display methods" specifier just another one of these > variables, e.g. call it `display-buffer-method'. > > 3) Change display-buffer-alist so that it is just a method of overriding > Lisp variables during display-buffer. That is to say, it is an alist > where each element has the form (MATCHER . OVERRIDES). The first > entry with matching MATCHER takes effect; its OVERRIDES is an alist > where each element has the form (VAR . VALUE), which says to bind VAR > to VALUE. > > MATCHER will include matching the buffer name to a regexp, but we can > add more complex conditionals later, e.g. a way to specify that a > variable must have a certain value. > > In this scheme, there is no interaction between elements of > display-buffer-alist, and no interaction between specifiers apart from > the familiar behavior of rebinding Lisp variables. This is a very important point, ensuring that smaller pieces can be composed together into larger lists without changing the semantics. It is much easier to reason about than the curent design. > Martin's example would be implemented like the following: > > (setq pop-up-window-min-height 15) > > (setq pop-up-window-choice '((largest) (lru))) > > (setq display-buffer-method '(pop-up-window)) > > (setq > display-buffer-alist > '((((regexp . "\\`\\*Help\\*\\'")) > (pop-up-window-set-height . fit-window-to-buffer)) > (((regexp . "\\`\\*.+\\*\\'")) > (pop-up-window-set-height . 20)))) > > WDYT? This proposal is much simpler to understand than the current design. I've followed the discussion here and read the documentation several times, and I still cannot make any sense of display-buffer-alist. Point (3) above is important. Processing the alist only as far as the entry with a matching MATCHER form is easier to reason about. It is also more compositional: it allows the user to combine working alists of specifiers together without surprising changes in the semantics of the constituent pieces. AndyM