From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chong Yidong Newsgroups: gmane.emacs.devel Subject: Re: display-buffer-alist simplifications Date: Mon, 01 Aug 2011 13:13:27 -0400 Message-ID: <87oc092gy0.fsf@stupidchicken.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> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1312218836 10720 80.91.229.12 (1 Aug 2011 17:13:56 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 1 Aug 2011 17:13:56 +0000 (UTC) Cc: martin rudalics , emacs-devel@gnu.org To: Juri Linkov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Aug 01 19:13:48 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 1Qnw3k-0003W7-BK for ged-emacs-devel@m.gmane.org; Mon, 01 Aug 2011 19:13:44 +0200 Original-Received: from localhost ([::1]:34630 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qnw3j-0008Mo-SB for ged-emacs-devel@m.gmane.org; Mon, 01 Aug 2011 13:13:43 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:46803) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qnw3h-0008L1-Fl for emacs-devel@gnu.org; Mon, 01 Aug 2011 13:13:42 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qnw3g-0001hf-B3 for emacs-devel@gnu.org; Mon, 01 Aug 2011 13:13:41 -0400 Original-Received: from vm-emlprdomr-06.its.yale.edu ([130.132.50.147]:58482) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qnw3g-0001aI-9B for emacs-devel@gnu.org; Mon, 01 Aug 2011 13:13:40 -0400 Original-Received: from furball ([128.36.14.85]) (authenticated bits=0) by vm-emlprdomr-06.its.yale.edu (8.14.4/8.14.4) with ESMTP id p71HDRmG001254 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Mon, 1 Aug 2011 13:13:27 -0400 In-Reply-To: <87k4axzg7j.fsf@mail.jurta.org> (Juri Linkov's message of "Mon, 01 Aug 2011 11:20:04 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-Scanned-By: MIMEDefang 2.71 on 130.132.50.147 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 130.132.50.147 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:142637 Archived-At: Juri Linkov writes: >> (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). The problem is that the design is trying to do BOTH "inheritance by regexps" and "inheritance by specifiers" at the same time---there are too many moving parts. At this point, I think we really need to figure out a way to make the system simple. Even expressiveness must take a back seat---we can always add expressiveness later by providing an overriding hook! 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. 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?