all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Chong Yidong <cyd@stupidchicken.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: Faces applies to new frames
Date: Sat, 28 Jun 2008 12:01:36 -0400	[thread overview]
Message-ID: <87iqvty2e7.fsf@stupidchicken.com> (raw)
In-Reply-To: <jwvd4m3fzd3.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Thu, 26 Jun 2008 21:28:48 -0400")

Stefan Monnier <monnier@iro.umontreal.ca> 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 ----




  parent reply	other threads:[~2008-06-28 16:01 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-26 22:50 Faces applies to new frames Chong Yidong
2008-06-26 23:08 ` Miles Bader
2008-06-27  1:28 ` Stefan Monnier
2008-06-27  2:43   ` Chong Yidong
2008-06-27  6:18     ` Stefan Monnier
2008-06-27 17:32       ` Chong Yidong
2008-06-27 17:52         ` Stefan Monnier
2008-06-27 17:54           ` Chong Yidong
2008-06-27 10:48   ` Robert J. Chassell
2008-06-27 12:17   ` Robert J. Chassell
2008-06-28 16:01   ` Chong Yidong [this message]
2008-06-28 20:17     ` Stefan Monnier
2008-06-28 23:42       ` Chong Yidong
2008-06-29  3:14         ` Stefan Monnier
2008-06-29  3:42           ` Miles Bader
2008-06-29  4:22             ` Stefan Monnier
2008-06-29  4:43               ` Miles Bader
2008-06-29  4:47                 ` Chong Yidong
2008-06-29  8:51                   ` David Kastrup
2008-06-29  5:36                 ` Stefan Monnier
2008-06-29 15:20                   ` Richard M Stallman
2008-06-29 17:08                     ` Chong Yidong
2008-06-30 14:43                       ` Richard M Stallman
2008-06-29 19:42                     ` Stefan Monnier
2008-06-30 14:43                       ` Richard M Stallman
2008-06-29  4:30           ` Chong Yidong
2008-06-29  6:11             ` Stefan Monnier
2008-06-29 15:25               ` Chong Yidong
2008-06-29 18:00                 ` Stefan Monnier
2008-06-29 19:24                   ` Chong Yidong
2008-06-29 20:00                     ` Stefan Monnier
2008-06-29 20:29                       ` Chong Yidong
2008-06-30  0:58                         ` Stefan Monnier
2008-06-30  2:24                           ` Chong Yidong
2008-06-30  4:46                             ` Stefan Monnier
2008-06-30  5:02                               ` Chong Yidong
2008-06-30 14:43                         ` Richard M Stallman
2008-06-29  2:48   ` Chong Yidong
2008-06-29  3:41     ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87iqvty2e7.fsf@stupidchicken.com \
    --to=cyd@stupidchicken.com \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.