Created
November 24, 2014 21:45
-
-
Save rbrito/ba6d206f615dbf7285a5 to your computer and use it in GitHub Desktop.
lisp/{custom,faces}.el: Partial revert of commit aac2b67
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 124b8da812896eee004d9243122781118298f627 Mon Sep 17 00:00:00 2001 | |
From: =?UTF-8?q?Rog=C3=A9rio=20Brito?= <[email protected]> | |
Date: Sun, 23 Nov 2014 16:45:12 -0200 | |
Subject: [PATCH] lisp/{custom,faces}.el: Partial revert of commit aac2b67. | |
There were conflicts and I resolved them in the simplest (and most | |
naive) way, which is probably quite incorrect. | |
Still, this makes Emacs from master work back again for me. | |
--- | |
lisp/ChangeLog | 13 ++--------- | |
lisp/custom.el | 11 ++++------ | |
lisp/faces.el | 69 +++++++++++++++++++++++++++++----------------------------- | |
3 files changed, 40 insertions(+), 53 deletions(-) | |
diff --git a/lisp/ChangeLog b/lisp/ChangeLog | |
index dd8f3ce..7c863e7 100644 | |
--- a/lisp/ChangeLog | |
+++ b/lisp/ChangeLog | |
@@ -9678,21 +9678,12 @@ | |
2013-12-21 Chong Yidong <[email protected]> | |
- * custom.el (custom-theme-recalc-face): Do nothing if the face is | |
- undefined. Thus, theme settings for undefined faces do not take | |
- effect until the faces are defined with defface, the same as with | |
- theme variables. | |
- | |
- * faces.el (face-spec-set): Use face-spec-recalc in all cases. | |
- (face-spec-reset-face): Don't assign extra properties in temacs. | |
- (face-spec-recalc): Apply X resources too. | |
- | |
-2013-12-21 Chong Yidong <[email protected]> | |
- | |
* faces.el (face-spec-set): | |
* cus-face.el (custom-theme-set-faces, custom-set-faces): | |
* custom.el (defface): Doc fixes (Bug#16203). | |
+2013-12-21 Chong Yidong <[email protected]> | |
+ | |
* indent.el (indent-rigidly-map): Add docstring, and move commands | |
into named functions. | |
(indent-rigidly-left, indent-rigidly-right) | |
diff --git a/lisp/custom.el b/lisp/custom.el | |
index c30ad7c..f7f72c6 100644 | |
--- a/lisp/custom.el | |
+++ b/lisp/custom.el | |
@@ -1461,15 +1461,12 @@ This function returns nil if no custom theme specifies a value for VARIABLE." | |
(eval (car valspec)))))) | |
(defun custom-theme-recalc-face (face) | |
- "Set FACE according to currently enabled custom themes. | |
-If FACE is not initialized as a face, do nothing; otherwise call | |
-`face-spec-recalc' to recalculate the face on all frames." | |
+ "Set FACE according to currently enabled custom themes." | |
(if (get face 'face-alias) | |
(setq face (get face 'face-alias))) | |
- (if (facep face) | |
- ;; Reset the faces for each frame. | |
- (dolist (frame (frame-list)) | |
- (face-spec-recalc face frame)))) | |
+ ;; Reset the faces for each frame. | |
+ (dolist (frame (frame-list)) | |
+ (face-spec-recalc face frame))) | |
;;; XEmacs compatibility functions | |
diff --git a/lisp/faces.el b/lisp/faces.el | |
index 1d4fc9c..09f5aa8 100644 | |
--- a/lisp/faces.el | |
+++ b/lisp/faces.el | |
@@ -1588,16 +1588,16 @@ is given, in which case return its value instead." | |
:box nil :inverse-video nil :stipple nil :inherit nil) | |
;; `display-graphic-p' is unavailable when running | |
;; temacs, prior to loading frame.el. | |
- (when (fboundp 'display-graphic-p) | |
- (unless (display-graphic-p frame) | |
- `(:family "default" :foundry "default" :width normal | |
- :height 1 :weight normal :slant normal | |
- :foreground ,(if (frame-parameter nil 'reverse) | |
- "unspecified-bg" | |
- "unspecified-fg") | |
- :background ,(if (frame-parameter nil 'reverse) | |
- "unspecified-fg" | |
- "unspecified-bg"))))) | |
+ (unless (and (fboundp 'display-graphic-p) | |
+ (display-graphic-p frame)) | |
+ `(:family "default" :foundry "default" :width normal | |
+ :height 1 :weight normal :slant normal | |
+ :foreground ,(if (frame-parameter nil 'reverse) | |
+ "unspecified-bg" | |
+ "unspecified-fg") | |
+ :background ,(if (frame-parameter nil 'reverse) | |
+ "unspecified-fg" | |
+ "unspecified-bg")))) | |
;; For all other faces, unspecify all attributes. | |
(apply 'append | |
(mapcar (lambda (x) (list (car x) 'unspecified)) | |
@@ -1607,13 +1607,13 @@ is given, in which case return its value instead." | |
"Set the face spec SPEC for FACE. | |
See `defface' for the format of SPEC. | |
-The appearance of each face is controlled by its specs (set via | |
-this function), and by the internal frame-specific face | |
-attributes (set via `set-face-attribute'). | |
+The appearance of each face is controlled by its spec, and by the | |
+internal face attributes (which can be frame-specific and can be | |
+set via `set-face-attribute'). This function sets the former. | |
-This function also defines FACE as a valid face name if it is not | |
-already one, and (re)calculates its attributes on existing | |
-frames. | |
+In addition to setting the face spec, this function defines FACE | |
+as a valid face name if it is not already one, and (re)calculates | |
+the face's attributes on existing frames. | |
The argument SPEC-TYPE determines which spec to set: | |
nil or `face-override-spec' means the override spec (which is | |
@@ -1645,10 +1645,20 @@ function for its other effects." | |
;; as far as Custom is concerned. | |
(unless (eq face 'face-override-spec) | |
(put face 'face-modified nil)) | |
- ;; Initialize the face if it does not exist, then recalculate. | |
- (make-empty-face face) | |
- (dolist (frame (frame-list)) | |
- (face-spec-recalc face frame))) | |
+ (if (facep face) | |
+ ;; If the face already exists, recalculate it. | |
+ (dolist (frame (frame-list)) | |
+ (face-spec-recalc face frame)) | |
+ ;; Otherwise, initialize it on all frames. | |
+ (make-empty-face face) | |
+ (let ((value (face-user-default-spec face)) | |
+ (have-window-system (memq initial-window-system '(x w32 ns)))) | |
+ (dolist (frame (frame-list)) | |
+ (face-spec-set-2 face frame value) | |
+ (when (memq (window-system frame) '(x w32 ns)) | |
+ (setq have-window-system t))) | |
+ (if have-window-system | |
+ (make-face-x-resource-internal face))))) | |
(defun face-spec-recalc (face frame) | |
"Reset the face attributes of FACE on FRAME according to its specs. | |
@@ -1674,21 +1684,10 @@ The following sources are applied in this order: | |
(no-match-found 0) | |
spec theme-face-applied) | |
(if theme-faces | |
- (dolist (elt (reverse theme-faces)) | |
- (setq spec (face-spec-choose (cadr elt) frame no-match-found)) | |
- (unless (eq spec no-match-found) | |
- (face-spec-set-2 face frame spec) | |
- (setq theme-face-applied t)))) | |
- ;; If there was a spec applicable to FRAME, that overrides the | |
- ;; defface spec entirely (rather than inheriting from it). If | |
- ;; there was no spec applicable to FRAME, apply the defface spec | |
- ;; as well as any applicable X resources. | |
- (unless theme-face-applied | |
- (setq spec (face-spec-choose (face-default-spec face) frame)) | |
- (face-spec-set-2 face frame spec) | |
- (make-face-x-resource-internal face frame)) | |
- (setq spec (face-spec-choose (get face 'face-override-spec) frame)) | |
- (face-spec-set-2 face frame spec))) | |
+ (dolist (spec (reverse theme-faces)) | |
+ (face-spec-set-2 face frame (cadr spec))) | |
+ (face-spec-set-2 face frame (face-default-spec face)))) | |
+ (face-spec-set-2 face frame (get face 'face-override-spec))) | |
(defun face-spec-set-2 (face frame spec) | |
"Set the face attributes of FACE on FRAME according to SPEC." | |
-- | |
2.1.3 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment