changeset 65341:6990826a916f

Custom Theme bugfixes.
author Chong Yidong <cyd@stupidchicken.com>
date Mon, 05 Sep 2005 19:50:02 +0000
parents 2c7c4607da97
children c71b1b2d2d04
files lisp/ChangeLog lisp/cus-theme.el lisp/custom.el
diffstat 3 files changed, 30 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Mon Sep 05 17:39:25 2005 +0000
+++ b/lisp/ChangeLog	Mon Sep 05 19:50:02 2005 +0000
@@ -1,3 +1,15 @@
+2005-09-05  Chong Yidong  <cyd@stupidchicken.com>
+
+	* cus-theme.el (custom-theme-write-faces): Save the current face
+	spec, not the defface spec.
+
+	* custom.el (custom-known-themes): Clarify meaning of "standard".
+	(custom-push-theme): Save old values in the standard theme.
+	(disable-theme): Correct typo.
+	(custom-face-theme-value) Deleted unused function.
+	(custom-theme-recalc-face): Rewritten to treat enable/disable
+	properly.
+
 2005-09-05  Stefan Monnier  <monnier@iro.umontreal.ca>
 
 	* progmodes/compile.el (compilation-goto-locus): Take into account
--- a/lisp/cus-theme.el	Mon Sep 05 17:39:25 2005 +0000
+++ b/lisp/cus-theme.el	Mon Sep 05 19:50:02 2005 +0000
@@ -168,8 +168,9 @@
 		(princ " '(")
 		(prin1 symbol)
 		(princ " ")
-		(prin1 (or (get symbol 'customized-face)
-			   (get symbol 'face-defface-spec)))
+		(prin1 (list (append '(t)
+				     (custom-face-attributes-get
+				      'font-lock-comment-face nil))))
 		(princ ")")))
 	      faces)
       (if (bolp)
--- a/lisp/custom.el	Mon Sep 05 17:39:25 2005 +0000
+++ b/lisp/custom.el	Mon Sep 05 19:50:02 2005 +0000
@@ -583,7 +583,7 @@
 (defvar custom-known-themes '(user standard)
    "Themes that have been defined with `deftheme'.
 The default value is the list (user standard).  The theme `standard'
-contains the Emacs standard settings from the original Lisp files.  The
+contains the settings before custom themes are applied.  The
 theme `user' contains all the settings the user customized and saved.
 Additional themes declared with the `deftheme' macro will be added to
 the front of this list.")
@@ -649,6 +649,16 @@
 	(progn
 	  (setcar (cdr setting) mode)
 	  (setcar (cddr setting) value))
+      (if (null old)
+	  (setq old
+		(list
+		 (list 'standard 'set
+		       (if (eq prop 'theme-value)
+			   (symbol-value symbol)
+			 (list
+			  (append
+			   '(t)
+			   (custom-face-attributes-get symbol nil))))))))
       (put symbol prop (cons (list theme mode value) old)))
     ;; Record, for each theme, all its settings.
     (put theme 'theme-settings
@@ -1117,7 +1127,7 @@
       (let* ((prop (car s))
 	     (symbol (cadr s))
 	     (spec-list (get symbol prop)))
-	(put symbol 'theme-value (assq-delete-all theme spec-list))
+	(put symbol prop (assq-delete-all theme spec-list))
 	(if (eq prop 'theme-value)
 	    (custom-theme-recalc-variable symbol)
 	  (custom-theme-recalc-face symbol)))))
@@ -1156,13 +1166,6 @@
     (if theme-value
 	(custom-theme-value (car (car theme-value)) theme-value))))
 
-(defun custom-face-theme-value (face)
-  "Return the face spec of FACE according to currently enabled custom themes.
-This function returns nil if no custom theme specifies anything for FACE."
-  (let* ((theme-value (get face 'theme-face)))
-    (if theme-value
-	(custom-theme-value (car (car theme-value)) theme-value))))
-
 (defun custom-theme-recalc-variable (variable)
   "Set VARIABLE according to currently enabled custom themes."
   (let ((valspec (custom-variable-theme-value variable)))
@@ -1177,16 +1180,9 @@
 
 (defun custom-theme-recalc-face (face)
   "Set FACE according to currently enabled custom themes."
-  (let ((spec (custom-face-theme-value face)))
-    (when spec
-      (put face 'save-face spec))
-    (unless spec
-      (setq spec (get face 'face-defface-spec)))
-    (when spec
-      (when (or (get face 'force-face) (facep face))
-	(unless (facep face)
-	  (make-empty-face face))
-	(face-spec-set face spec)))))
+  (let ((theme-faces (reverse (get face 'theme-face))))
+    (dolist (spec theme-faces)
+      (face-spec-set face (car (cddr spec))))))
 
 (defun custom-theme-reset-variables (theme &rest args)
   "Reset the specs in THEME of some variables to their values in other themes.