emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Faces applies to new frames


From: Chong Yidong
Subject: Faces applies to new frames
Date: Thu, 26 Jun 2008 18:50:56 -0400

I took a look at the problem that several people have reported regarding
default faces not being applied to new frames (e.g. 47 and 120 in the
bug tracker).

AFAICT, the problem is that the default face is controlled by the `font'
frame parameter, but this is not saved to default-frame-alist by
internal-set-lisp-face-attribute.  In comparison, the foreground-color
and background-color frame attributes are saved properly (see
xfaces.c:3415 and 3470).  It doesn't seem practical to fix
internal-set-lisp-face-attribute, but I think we can patch it up in
faces.el.

Could someone check whether this reasoning makes sense, and whether the
attached patch to set-face-attribute makes things work properly?

(BTW, this doesn't affect default faces set under customize under some
circumstances, because that changes the defface spec directly instead of
using set-face-attribute.)


*** trunk/lisp/faces.el.~1.415.~        2008-06-25 18:27:01.000000000 -0400
--- trunk/lisp/faces.el 2008-06-26 18:41:07.000000000 -0400
***************
*** 700,706 ****
  VALUE is the name of a face from which to inherit attributes, or a list
  of face names.  Attributes from inherited faces are merged into the face
  like an underlying face would be, with higher priority than underlying faces."
!   (let ((where (if (null frame) 0 frame)))
      (setq args (purecopy args))
      ;; If we set the new-frame defaults, this face is modified outside Custom.
      (if (memq where '(0 t))
--- 700,716 ----
  VALUE is the name of a face from which to inherit attributes, or a list
  of face names.  Attributes from inherited faces are merged into the face
  like an underlying face would be, with higher priority than underlying faces."
!   (let* ((where (if (null frame) 0 frame))
!        (save-modified-font
!         (and (eq where 0)
!              (eq face 'default)
!              (or (plist-member args :family)
!                  (plist-member args :height)
!                  (plist-member args :weight)
!                  (plist-member args :slant)
!                  (plist-member args :width)
!                  (plist-member args :bold)
!                  (plist-member args :italic)))))
      (setq args (purecopy args))
      ;; If we set the new-frame defaults, this face is modified outside Custom.
      (if (memq where '(0 t))
***************
*** 723,729 ****
          (internal-set-lisp-face-attribute face (car args)
                                            (purecopy (cadr args))
                                            where)))
!       (setq args (cdr (cdr args))))))
  
  
  (defun make-face-bold (face &optional frame noerror)
--- 733,744 ----
          (internal-set-lisp-face-attribute face (car args)
                                            (purecopy (cadr args))
                                            where)))
!       (setq args (cdr (cdr args))))
! 
!     (when save-modified-font
!       (setq default-frame-alist
!                   (cons (cons 'font (frame-parameter (selected-frame) 'font))
!                         (assq-delete-all 'font default-frame-alist))))))
  
  
  (defun make-face-bold (face &optional frame noerror)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]