emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r107502: Another tweak to default fac


From: Chong Yidong
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r107502: Another tweak to default face handling in face-spec-reset-face.
Date: Sun, 04 Mar 2012 23:03:51 +0800
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 107502
fixes bug(s): http://debbugs.gnu.org/10748
committer: Chong Yidong <address@hidden>
branch nick: trunk
timestamp: Sun 2012-03-04 23:03:51 +0800
message:
  Another tweak to default face handling in face-spec-reset-face.
  
  * lisp/faces.el (face-spec-reset-face): For the default face, reset the
  attributes to default values.
modified:
  lisp/ChangeLog
  lisp/faces.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-03-04 13:43:13 +0000
+++ b/lisp/ChangeLog    2012-03-04 15:03:51 +0000
@@ -1,3 +1,8 @@
+2012-03-04  Chong Yidong  <address@hidden>
+
+       * faces.el (face-spec-reset-face): For the default face, reset the
+       attributes to default values (Bug#10748).
+
 2012-03-04  Lars Magne Ingebrigtsen  <address@hidden>
 
        * mail/emacsbug.el (report-emacs-bug-hook): Fix up thinko in

=== modified file 'lisp/faces.el'
--- a/lisp/faces.el     2012-01-31 08:38:58 +0000
+++ b/lisp/faces.el     2012-03-04 15:03:51 +0000
@@ -1513,12 +1513,23 @@
 
 (defun face-spec-reset-face (face &optional frame)
   "Reset all attributes of FACE on FRAME to unspecified."
-  (unless (eq face 'default)
-    (let (reset-args)
-      (dolist (attr-and-name face-attribute-name-alist)
-       (push 'unspecified reset-args)
-       (push (car attr-and-name) reset-args))
-      (apply 'set-face-attribute face frame reset-args))))
+  (apply 'set-face-attribute face frame
+        (if (eq face 'default)
+            ;; For the default face, avoid making any attribute
+            ;; unspecifed.  Instead, set attributes to default values
+            ;; (see also realize_default_face in xfaces.c).
+            (append
+             '(:underline nil :overline nil :strike-through nil
+               :box nil :inverse-video nil :stipple nil :inherit nil)
+             (unless (display-graphic-p frame)
+               '(:family "default" :foundry "default" :width normal
+                 :height 1 :weight normal :slant normal
+                 :foreground "unspecified-fg"
+                 :background "unspecified-bg")))
+          ;; For all other faces, unspecify all attributes.
+          (apply 'append
+                 (mapcar (lambda (x) (list (car x) 'unspecified))
+                         face-attribute-name-alist)))))
 
 (defun face-spec-set (face spec &optional for-defface)
   "Set FACE's face spec, which controls its appearance, to SPEC.


reply via email to

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