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, 11 Aug 2011 09:50:15 -0400 Message-ID: References: <87mxgem09k.fsf@stupidchicken.com> <87r55cjvef.fsf@stupidchicken.com> <87sjpsnerd.fsf@mail.jurta.org> <4E355D2C.40709@gmx.at> <87k4axzg7j.fsf@mail.jurta.org> <87oc092gy0.fsf@stupidchicken.com> <4E380897.5000406@gmx.at> <871ux2nsrw.fsf@stupidchicken.com> <4E3AA5DA.8030403@gmx.at> <87mxfnn414.fsf@stupidchicken.com> <4E3D41F2.8060801@gmx.at> <4E3FA812.3080009@gmx.at> <87zkjkb572.fsf@mail.jurta.org> <4E3FD5ED.5000206@gmx.at> <4E412E2D.90908@gmx.at> <4E422ECA.2020207@gmx.at> <4E43A253.9040404@gmx.at> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1313070637 3756 80.91.229.12 (11 Aug 2011 13:50:37 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 11 Aug 2011 13:50:37 +0000 (UTC) Cc: Juri Linkov , Chong Yidong , emacs-devel@gnu.org To: martin rudalics Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Aug 11 15:50:33 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 1QrVeX-0004Pq-TM for ged-emacs-devel@m.gmane.org; Thu, 11 Aug 2011 15:50:30 +0200 Original-Received: from localhost ([::1]:35021 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QrVeX-0001rX-G4 for ged-emacs-devel@m.gmane.org; Thu, 11 Aug 2011 09:50:29 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:44672) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QrVeQ-0001rB-IH for emacs-devel@gnu.org; Thu, 11 Aug 2011 09:50:26 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QrVeM-0006Qr-Ae for emacs-devel@gnu.org; Thu, 11 Aug 2011 09:50:22 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:49677 helo=ironport2-out.pppoe.ca) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QrVeL-0006Qn-Te for emacs-devel@gnu.org; Thu, 11 Aug 2011 09:50:18 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av0EAMDcQ05FxKeo/2dsb2JhbABBp0Z4gUABAQQBViMFCws0EhQYDSSIArx0hkcEn2aEMw X-IronPort-AV: E=Sophos;i="4.67,355,1309752000"; d="scan'208";a="130631862" Original-Received: from 69-196-167-168.dsl.teksavvy.com (HELO ceviche.home) ([69.196.167.168]) by ironport2-out.pppoe.ca with ESMTP/TLS/ADH-AES256-SHA; 11 Aug 2011 09:50:15 -0400 Original-Received: by ceviche.home (Postfix, from userid 20848) id 5D70D6610B; Thu, 11 Aug 2011 09:50:15 -0400 (EDT) In-Reply-To: <4E43A253.9040404@gmx.at> (martin rudalics's message of "Thu, 11 Aug 2011 11:35:15 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.181 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:143141 Archived-At: > Does this approximately describe the current state of affairs? I've > deliberately dismissed things I consider sugar like whether methods > represent functions or just symbols to look up functions, or whether a > parameter actually is a condition enabling a method (like a window's > minimum height) rather then ask for some kind of post-action (like > setting a window's height). Not quite. Here's my take on display-buffer-alist: (defvar display-buffer-alist nil "Specifications of user preferences for `display-buffer'. This is a list of elements of the form (CONDITION . ACTION) where CONDITION is either a regexp matching buffer names, or a function that takes a buffer and returns a boolean. ACTION is a list of the form (FUNCTION . ALIST) where FUNCTION can be either a function or a list of functions. Those functions will be called with 2 arguments: the buffer to display and an ALIST built from the various alists specified in the various ACTIONs. It should either return the window used, or nil to fallback to the next function.") (defvar display-buffer-default-action (list #'display-buffer-default) "Default action to perform to display a buffer. This is an ACTION just like in `display-buffer-alist'.") (defvar display-buffer-overriding-action '(nil) "Overriding action to perform to display a buffer. This is an ACTION just like in `display-buffer-alist'.") (defun display-buffer (&optional buffer action) "Display BUFFER in some window." (let* ((user-action (assq-regexp (buffer-name buffer) display-buffer-alist)) (functions (append (car display-buffer-overriding-action) (car user-action) (car action) (car display-buffer-default-action))) (alist (append (cdr display-buffer-overriding-action) (cdr user-action) (cdr action) (cdr display-buffer-default-action)))) (run-with-args-until-success functions buffer alist))) (defalias 'display-buffer-default 'emacs23-display-buffer) (defun display-buffer-other-window (buffer alist) (let ((pop-up-windows t) (special-display-buffer-names nil) (special-display-regexps nil) (same-window-buffer-names nil) (same-window-regexps nil)) (emacs23-display-buffer buffer))) [...] The code is clearly incorrect and incomplete, but hopefully gives you an idea of what I expect it to do. Stefan