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: Faces applies to new frames Date: Sat, 28 Jun 2008 12:01:36 -0400 Message-ID: <87iqvty2e7.fsf@stupidchicken.com> References: <87k5gbx12n.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 1214669270 23340 80.91.229.12 (28 Jun 2008 16:07:50 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 28 Jun 2008 16:07:50 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jun 28 18:08:35 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 1KCcyV-0000j3-Cl for ged-emacs-devel@m.gmane.org; Sat, 28 Jun 2008 18:08:31 +0200 Original-Received: from localhost ([127.0.0.1]:36096 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KCcxf-0000Hf-DK for ged-emacs-devel@m.gmane.org; Sat, 28 Jun 2008 12:07:39 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KCcwZ-0007xm-0Q for emacs-devel@gnu.org; Sat, 28 Jun 2008 12:06:31 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KCcwW-0007wt-8n for emacs-devel@gnu.org; Sat, 28 Jun 2008 12:06:30 -0400 Original-Received: from [199.232.76.173] (port=48265 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KCcwW-0007wn-1H for emacs-devel@gnu.org; Sat, 28 Jun 2008 12:06:28 -0400 Original-Received: from cyd.mit.edu ([18.115.2.24]:52277) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KCcwV-0003cH-JL for emacs-devel@gnu.org; Sat, 28 Jun 2008 12:06:27 -0400 Original-Received: by cyd.mit.edu (Postfix, from userid 1000) id 2B6504E479; Sat, 28 Jun 2008 12:01:36 -0400 (EDT) In-Reply-To: (Stefan Monnier's message of "Thu, 26 Jun 2008 21:28:48 -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, 2) 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:100093 Archived-At: Stefan Monnier writes: > by default there is no `font' parameter in default-frame-alist, so as > long as we leave it that way, it should not affect face settings. The > code in face-set-after-frame-default should apply the defface-spec to > every new frame, so we shouldn't need any entry in default-frame-alist > for it to apply to new frames. There are several problems here, so let's take it one at a time. First, let's ignore Customize and try to make set-face-attribute work properly. In this case, default faces aren't properly set for future frames. The problem lies in the interaction between face attributes and the `font' frame parameter. For historical reasons, we allow the attributes of the default face to be changed by this frame parameter. But that means that when we create a new frame, the initial value of this frame parameter needs to be set based on the value of the `default' face. Otherwise, it will override whatever attributes the `default' face has that were set by set-face-attribute. The attached patch does this. It also removes the `font-parameter' frame parameter, which is used to override the default face (a similar patch will be needed for w32fns.c). I think this is bogus. *** trunk/lisp/faces.el.~1.416.~ 2008-06-28 11:45:58.000000000 -0400 --- trunk/lisp/faces.el 2008-06-28 11:48:47.000000000 -0400 *************** *** 2017,2029 **** ;; Find attributes that should be initialized from frame parameters. (let ((face-params '((foreground-color default :foreground) (background-color default :background) - (font-parameter default :font) (border-color border :background) (cursor-color cursor :background) (scroll-bar-foreground scroll-bar :foreground) (scroll-bar-background scroll-bar :background) (mouse-color mouse :background))) ! apply-params) (dolist (param face-params) (let* ((value (frame-parameter frame (nth 0 param))) (face (nth 1 param)) --- 2017,2028 ---- ;; Find attributes that should be initialized from frame parameters. (let ((face-params '((foreground-color default :foreground) (background-color default :background) (border-color border :background) (cursor-color cursor :background) (scroll-bar-foreground scroll-bar :foreground) (scroll-bar-background scroll-bar :background) (mouse-color mouse :background))) ! apply-params default-font) (dolist (param face-params) (let* ((value (frame-parameter frame (nth 0 param))) (face (nth 1 param)) *************** *** 2056,2061 **** --- 2055,2065 ---- (make-face-x-resource-internal face frame)) (internal-merge-in-global-face face frame)) (error nil))) + ;; 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)) ;; Apply the attributes specified by frame parameters. This ;; rewrites parameters changed by make-face-x-resource-internal (dolist (param apply-params) *** trunk/src/xfns.c.~1.720.~ 2008-06-27 18:18:48.000000000 -0400 --- trunk/src/xfns.c 2008-06-28 11:50:55.000000000 -0400 *************** *** 204,210 **** Lisp_Object Qsuppress_icon; Lisp_Object Qundefined_color; Lisp_Object Qcompound_text, Qcancel_timer; - static Lisp_Object Qfont_param; /* In dispnew.c */ --- 204,209 ---- *************** *** 3098,3109 **** if (NILP (font)) error ("No suitable font was found"); } - else if (!NILP (font_param)) - { - /* Remember the explicit font parameter, so we can re-apply it after - we've applied the `default' face settings. */ - x_set_frame_parameters (f, Fcons (Fcons (Qfont_param, font_param), Qnil)); - } x_default_parameter (f, parms, Qfont, font, "font", "Font", RES_TYPE_STRING); } --- 3097,3102 ---- *************** *** 5871,5878 **** staticpro (&Qcompound_text); Qcancel_timer = intern ("cancel-timer"); staticpro (&Qcancel_timer); - Qfont_param = intern ("font-parameter"); - staticpro (&Qfont_param); /* This is the end of symbol initialization. */ /* Text property `display' should be nonsticky by default. */ --- 5864,5869 ----