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: Mon, 08 Aug 2011 14:43:32 -0400 Message-ID: References: <87mxgem09k.fsf@stupidchicken.com> <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> <4E380897.5000406@gmx.at> <871ux2nsrw.fsf@stupidchicken.com> <4E3AA5DA.8030403@gmx.at> <87mxfnn414.fsf@stupidchicken.com> <4E3D41F2.8060801@gmx.at> <4E3FA812.3080009@gmx.at> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1312829028 1611 80.91.229.12 (8 Aug 2011 18:43:48 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 8 Aug 2011 18:43:48 +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 Mon Aug 08 20:43:41 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 1QqUna-0004dX-Ip for ged-emacs-devel@m.gmane.org; Mon, 08 Aug 2011 20:43:38 +0200 Original-Received: from localhost ([::1]:59030 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QqUna-0008Qa-5k for ged-emacs-devel@m.gmane.org; Mon, 08 Aug 2011 14:43:38 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:52294) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QqUnY-0008Og-2D for emacs-devel@gnu.org; Mon, 08 Aug 2011 14:43:37 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QqUnW-00086R-K2 for emacs-devel@gnu.org; Mon, 08 Aug 2011 14:43:35 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.183]:24606 helo=ironport2-out.pppoe.ca) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QqUnW-00086J-FB for emacs-devel@gnu.org; Mon, 08 Aug 2011 14:43:34 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av0EAJstQE5FxKeo/2dsb2JhbABDpyZ4gUABAQQBViMFCws0EhQYDSSIAL4YhkcEn1WEMQ X-IronPort-AV: E=Sophos;i="4.67,338,1309752000"; d="scan'208";a="130096589" 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; 08 Aug 2011 14:43:33 -0400 Original-Received: by ceviche.home (Postfix, from userid 20848) id ED7446610B; Mon, 8 Aug 2011 14:43:32 -0400 (EDT) In-Reply-To: <4E3FA812.3080009@gmx.at> (martin rudalics's message of "Mon, 08 Aug 2011 11:10:42 +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.183 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:143025 Archived-At: > At which point you can give up the idea of merging. I meanwhile know > that no one here likes the idea of merging specifiers and don't have the > slightest intention to fight for it any more. But no one so far has > cared to explain how to support all the things people have piled up over > the years like split-height-threshold, even-window-heights, or > display-buffer-mark-dedicated. I'd be all in favor of functions if you > told me how to write a function that within a year has not been > rewritten completely because it's oh so important to add a little thingy > here and there. I think these will have to be handled in each display-buffer- function. Of course, that means that to avoid code duplication we'll want to structure those functions with care. >>>> (I'll use the word "macro" for now, but we might want to pick another >>>> word since "macro" can be confused with keyboard macros.) >>> I'd very much appreciate if someone could invent a more useful term for >>> these. >> The name exists already, it's called a function definition. It's really >> well supported by a lot of Emacs code: you can document those "macros" >> in a very simple way, let users get that doc via C-h f, see them work >> step by step with edebug, have feedback about their correctness/style >> with M-x byte-compile-file, ... > We currently have many ways to specify a function for displaying a > buffer: `display-buffer-function', `special-display-function', > `pop-up-frame-function', `split-window-preferred-function', the function > one can specify via `special-display-regexps'. I know of two people who > customized the latter - Drew and you. This doesn't strike me as a story > of success. Irrelevant. I'm not talking about the success of hooks, I'm talking about the success of functions as a way to name a bunch of things, so you can reuse them conveniently. I don't really care if people define their own functions or not: we'll provide our own set of functions so those who can't define their own can just chose one of the predefined behaviors. The hook just provides a good way to structure and modularize the code. >>>> - `display-buffer-alist' is an alist that maps a matcher (regexp, >>>> label, or matcher function) to an alist of display specifiers. >> If display specifiers are of the form (VAR . VAL), then you presumably >> mean "a list of display specifiers" rather than "an alist of ...". > It's an alist where the key of each element is a display specifier. I'm lost. So display-buffer-alist would be a list of (MATCHER . THINGS) where THINGS are lists of (DISPLAY-SPECIFIERS . SOMETHING-ELSE)? What are the SOMETHING-ELSE and what do they do? > OK. I agree with the idea to support the old code and its options as > fallback and try to get a new behavior. But what I'm missing is a > strategy for how to merge-in the re-bindings of the old options within > the old _and_ the new code. Things like > (defun message-mail-other-window (&optional to subject) > "Like `message-mail' command, but display mail buffer in another window." > (interactive) > (unless (message-mail-user-agent) > (let ((pop-up-windows t) > (special-display-buffer-names nil) > (special-display-regexps nil) > (same-window-buffer-names nil) > (same-window-regexps nil)) > (message-pop-to-buffer (message-buffer-name "mail" to)))) > which I intended to rewrite as > (defun message-mail-other-window (&optional to subject) > "Like `message-mail' command, but display mail buffer in another window." > (interactive) > (unless (message-mail-user-agent) > (message-pop-to-buffer (message-buffer-name "mail" to) 'other-window))) Rather than `other-window', my suggestion is to pass a RULE, i.e. something like '(display-buffer-other-window . ARGS), but yes that sounds about right. > would then become > (defun message-mail-other-window (&optional to subject) > "Like `message-mail' command, but display mail buffer in another window." > (interactive) > (unless (message-mail-user-agent) > (let ((pop-up-windows t) > (special-display-buffer-names nil) > (special-display-regexps nil) > (same-window-buffer-names nil) > (same-window-regexps nil)) > (message-pop-to-buffer (message-buffer-name "mail" to) 'other-window))) No, because the RULE takes precedence over the display-buffer-default-rule which is the one that obeys pop-up-frames and stuff. At least, that's what my idealized design does. Of course, such paper designs tend to behave unrealistically well. >> So, as is the case now, your list of specifiers is not truly an alist >> (i.e. earlier elements don't override later elements), instead it's >> a mix between an alist and an `or block'? >> That sounds like a problem. > If someone told me how to address the problem of merging specifiers in a > different way I'd be all ears. My suggestion is to not merge them, basically. Stefan