diff options
author | Chong Yidong <cyd@gnu.org> | 2012-03-04 23:03:51 +0800 |
---|---|---|
committer | Chong Yidong <cyd@gnu.org> | 2012-03-04 23:03:51 +0800 |
commit | c349f4e6ff1aaa8ef11f051d7b32952e705e09d9 (patch) | |
tree | 4970758235c413d51be389de286e2c0286218d5f /lisp/faces.el | |
parent | db976e3cd893e51a370147f2ce5ecceaf609aaf5 (diff) | |
download | emacs-c349f4e6ff1aaa8ef11f051d7b32952e705e09d9.tar.gz |
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.
Fixes: debbugs:10748
Diffstat (limited to 'lisp/faces.el')
-rw-r--r-- | lisp/faces.el | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/lisp/faces.el b/lisp/faces.el index cd7f92bfad4..0011e0357a1 100644 --- a/lisp/faces.el +++ b/lisp/faces.el @@ -1513,12 +1513,23 @@ If SPEC is nil, return nil." (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. |