emacs-devel
[Top][All Lists]
Advanced

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

Re: OSX "new frame" mangles default face


From: Daiki Ueno
Subject: Re: OSX "new frame" mangles default face
Date: Thu, 09 Aug 2007 18:48:27 +0900

>>>>> In <address@hidden> 
>>>>>   YAMAMOTO Mitsuharu <address@hidden> wrote:
> http://lists.gnu.org/archive/html/emacs-devel/2007-07/msg01682.html

> Actually, the following usage of `face-normalize-spec' in
> `frame-set-background-mode' looks strange.

>       (dolist (face (face-list))
>         (when (not (face-spec-match-p face
>                                       (face-normalize-spec
>                                        (face-user-default-spec face))
>                                       (selected-frame)))
>           (push face locally-modified-faces)))

Yes, you are right.  I must have been half asleep when I posted the
patch.  Here is the fix, but I'm not sure which is better to make
face-normalize-spec accept an alist in ((DISPLAY ATTS) ...) form, or to
call (the original) face-normalize-spec after face-spec-choose though.

Index: lisp/faces.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/faces.el,v
retrieving revision 1.373
diff -c -r1.373 faces.el
*** lisp/faces.el       3 Aug 2007 05:49:56 -0000       1.373
--- lisp/faces.el       9 Aug 2007 09:38:07 -0000
***************
*** 1510,1531 ****
    "Return a normalized face-spec of SPEC."
    (let (normalized-spec)
      (while spec
!       (let ((attribute (car spec))
!           (value (car (cdr spec))))
!       ;; Support some old-style attribute names and values.
!       (case attribute
!         (:bold (setq attribute :weight value (if value 'bold 'normal)))
!         (:italic (setq attribute :slant value (if value 'italic 'normal)))
!         ((:foreground :background)
!          ;; Compatibility with 20.x.  Some bogus face specs seem to
!          ;; exist containing things like `:foreground nil'.
!          (if (null value) (setq value 'unspecified)))
!         (t (unless (assq attribute face-x-resources)
!              (setq attribute nil))))
!       (when attribute
!         (push attribute normalized-spec)
!         (push value normalized-spec)))
!       (setq spec (cdr (cdr spec))))
      (nreverse normalized-spec)))
  
  
--- 1510,1537 ----
    "Return a normalized face-spec of SPEC."
    (let (normalized-spec)
      (while spec
!       (let ((display (car (car spec)))
!           (atts (cdr (car spec)))
!           normalized-atts)
!       (while atts
!         (let ((attribute (car atts))
!               (value (car (cdr atts))))
!           ;; Support some old-style attribute names and values.
!           (case attribute
!             (:bold (setq attribute :weight value (if value 'bold 'normal)))
!             (:italic (setq attribute :slant value (if value 'italic 'normal)))
!             ((:foreground :background)
!              ;; Compatibility with 20.x.  Some bogus face specs seem to
!              ;; exist containing things like `:foreground nil'.
!              (if (null value) (setq value 'unspecified)))
!             (t (unless (assq attribute face-x-resources)
!                  (setq attribute nil))))
!           (when attribute
!             (push attribute normalized-atts)
!             (push value normalized-atts)))
!         (setq atts (cdr (cdr atts))))
!       (push (cons display (nreverse normalized-atts)) normalized-spec)
!       (setq spec (cdr spec))))
      (nreverse normalized-spec)))
  
  

Regards,
-- 
Daiki Ueno




reply via email to

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