diff options
| author | Chong Yidong | 2012-03-04 23:03:51 +0800 |
|---|---|---|
| committer | Chong Yidong | 2012-03-04 23:03:51 +0800 |
| commit | c349f4e6ff1aaa8ef11f051d7b32952e705e09d9 (patch) | |
| tree | 4970758235c413d51be389de286e2c0286218d5f | |
| parent | db976e3cd893e51a370147f2ce5ecceaf609aaf5 (diff) | |
| download | emacs-c349f4e6ff1aaa8ef11f051d7b32952e705e09d9.tar.gz emacs-c349f4e6ff1aaa8ef11f051d7b32952e705e09d9.zip | |
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
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/faces.el | 23 |
2 files changed, 22 insertions, 6 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e338a6d2ebf..12488b0cd52 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2012-03-04 Chong Yidong <cyd@gnu.org> | ||
| 2 | |||
| 3 | * faces.el (face-spec-reset-face): For the default face, reset the | ||
| 4 | attributes to default values (Bug#10748). | ||
| 5 | |||
| 1 | 2012-03-04 Lars Magne Ingebrigtsen <larsi@gnus.org> | 6 | 2012-03-04 Lars Magne Ingebrigtsen <larsi@gnus.org> |
| 2 | 7 | ||
| 3 | * mail/emacsbug.el (report-emacs-bug-hook): Fix up thinko in | 8 | * mail/emacsbug.el (report-emacs-bug-hook): Fix up thinko in |
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." | |||
| 1513 | 1513 | ||
| 1514 | (defun face-spec-reset-face (face &optional frame) | 1514 | (defun face-spec-reset-face (face &optional frame) |
| 1515 | "Reset all attributes of FACE on FRAME to unspecified." | 1515 | "Reset all attributes of FACE on FRAME to unspecified." |
| 1516 | (unless (eq face 'default) | 1516 | (apply 'set-face-attribute face frame |
| 1517 | (let (reset-args) | 1517 | (if (eq face 'default) |
| 1518 | (dolist (attr-and-name face-attribute-name-alist) | 1518 | ;; For the default face, avoid making any attribute |
| 1519 | (push 'unspecified reset-args) | 1519 | ;; unspecifed. Instead, set attributes to default values |
| 1520 | (push (car attr-and-name) reset-args)) | 1520 | ;; (see also realize_default_face in xfaces.c). |
| 1521 | (apply 'set-face-attribute face frame reset-args)))) | 1521 | (append |
| 1522 | '(:underline nil :overline nil :strike-through nil | ||
| 1523 | :box nil :inverse-video nil :stipple nil :inherit nil) | ||
| 1524 | (unless (display-graphic-p frame) | ||
| 1525 | '(:family "default" :foundry "default" :width normal | ||
| 1526 | :height 1 :weight normal :slant normal | ||
| 1527 | :foreground "unspecified-fg" | ||
| 1528 | :background "unspecified-bg"))) | ||
| 1529 | ;; For all other faces, unspecify all attributes. | ||
| 1530 | (apply 'append | ||
| 1531 | (mapcar (lambda (x) (list (car x) 'unspecified)) | ||
| 1532 | face-attribute-name-alist))))) | ||
| 1522 | 1533 | ||
| 1523 | (defun face-spec-set (face spec &optional for-defface) | 1534 | (defun face-spec-set (face spec &optional for-defface) |
| 1524 | "Set FACE's face spec, which controls its appearance, to SPEC. | 1535 | "Set FACE's face spec, which controls its appearance, to SPEC. |