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: Faces applies to new frames Date: Sat, 28 Jun 2008 23:14:11 -0400 Message-ID: References: <87k5gbx12n.fsf@stupidchicken.com> <87iqvty2e7.fsf@stupidchicken.com> <871w2hcek1.fsf@stupidchicken.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1214709291 30412 80.91.229.12 (29 Jun 2008 03:14:51 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 29 Jun 2008 03:14:51 +0000 (UTC) Cc: emacs-devel@gnu.org To: Chong Yidong Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jun 29 05:15:36 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KCnO3-00037V-Qx for ged-emacs-devel@m.gmane.org; Sun, 29 Jun 2008 05:15:36 +0200 Original-Received: from localhost ([127.0.0.1]:57318 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KCnND-00081i-Nx for ged-emacs-devel@m.gmane.org; Sat, 28 Jun 2008 23:14:43 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KCnMq-0007hJ-2H for emacs-devel@gnu.org; Sat, 28 Jun 2008 23:14:20 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KCnMo-0007fB-Jc for emacs-devel@gnu.org; Sat, 28 Jun 2008 23:14:19 -0400 Original-Received: from [199.232.76.173] (port=52650 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KCnMo-0007ew-5Q for emacs-devel@gnu.org; Sat, 28 Jun 2008 23:14:18 -0400 Original-Received: from 69-196-135-70.dsl.teksavvy.com ([69.196.135.70]:51288 helo=ceviche.home) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KCnMn-0002Kx-QD for emacs-devel@gnu.org; Sat, 28 Jun 2008 23:14:18 -0400 Original-Received: by ceviche.home (Postfix, from userid 20848) id B585770033; Sat, 28 Jun 2008 23:14:11 -0400 (EDT) In-Reply-To: <871w2hcek1.fsf@stupidchicken.com> (Chong Yidong's message of "Sat, 28 Jun 2008 19:42:06 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:100113 Archived-At: >>> + ;; The face specs may specify a different default font. Save this >>> + ;; in the `font' frame parameter. >>> + (setq default-font (face-font 'default)) >>> + (when default-font >>> + (set-frame-parameter frame 'font default-font)) >> >> But doesn't that mean that (make-frame '((font . "foo-bar"))) will >> disregard the explicit request for "foo-bar"? > True. I think that in this case, x-create-frame-with-faces should take > note that it is passed a `font' frame parameter, and tell > face-set-after-frame-default to stick to that instead of imposing > whatever the `default' face says. And that's exactly the reason why I introduced `font-parameter'. Basically, I think that frame parameters should generally take precedence since they may really be set on a frame-by-frame basis. We can try and distinguish parameters coming from default-frame-alist from those coming from elsewhere (pop-up-frame-alist, minibuffer-frame-alist, ...), but it seems a simpler solution is to not try and distinguish between the provenance and simply blindly give priority to frame parameters. This implies that set-face-attribute should probably store global settings elsewhere than on default-frame-alist. It sounds like face-new-frame-defaults would be a good place for that instead (th0o this is only based on its name) Here's my current understanding of the various places where we store face info: - face-new-frame-defaults, should be global and seems to only ever contain "unspecified". I.e. pretty much unused. - defface. Can go from global to terminal-specific. Usually terminal-specific. - Xresources. Can go from terminal-specific to frame-specific. Usually terminal-specific. - default-frame-alist and other frame parameters. Can go from global to frame-specific. Are there any more? I've sorted them based on their locality, so if we follow the principle that more-local should take precedence over more global settings, they should be taken in this order. And indeed, I believe it's the order in which they're applied right now. Based on the above, we then have to figure out how set-face-attribute (when applied globally) should affect the above settings, depending on the effect we're looking for. Here's a suggestion: 1 - rule out frame-specific Xresources settings 2 - make face-new-frame-defaults terminal-local, so it's initialized at terminal-creation time by applying defface and Xresources settings. 3 - rule that "global" set-face-attribute settings only apply to future frames on the same terminals (i.e. they're not truly global any more), so it can work by modifying the terminal's face-new-frame-defaults and it will hence take precedence over customize (i.e. defface) and Xresources settings. This will also have the advantage that the only face-initialization we need to do at frame-creation time is to apply the few face-relevant settings from the frame parameters. I.e. It will speed up frame creation significantly when you have many faces. Stefan