diff lisp/cus-edit.el @ 67977:03ee9bccbfeb

* custom.el: Move Custom Themes commentary to start of theme code. (custom-known-themes): Rename `standard' theme to `changed'. (custom-push-theme): Caller no longer specifies what theme to use when doing `reset'---the setting is simply removed from the theme. Delete MODE from `theme-value' and `theme-settings' properties. (custom-declare-theme): Ignore &rest args since we don't use them. (custom-loaded-themes): Delete variable. (custom-theme-load-themes, custom-theme-loaded-p) (custom-theme-value): Delete functions. (custom-declare-theme): Signal error on invalid theme names. (provide-theme): custom-loaded-themes was deleted. (load-theme): Load the file unconditionally. (enable-theme): Call `load-theme' if theme is undefined. (custom-enabled-themes): Only update value for successful loads. (disable-theme): Complete from enabled themes when interactive. (custom-variable-theme-value): Calculate theme value directly. (custom-theme-reset-variables, custom-reset-variables): Mark as XEmacs compatibility functions. We don't actually use these. * cus-edit.el (custom-variable-state-set): Use custom-variable-theme-value instead of custom-theme-value. (custom-face-state-set): Rename `standard' theme to `changed'. (custom-save-variables, custom-save-faces): Delete unneeded references to custom-reset-variables. (custom-save-resets): Delete function. (custom-save-variables, custom-save-faces): MODE argument deleted. (custom-save-variables, custom-save-faces): Ignore theme values. * cus-face.el (custom-theme-reset-faces): Mark as XEmacs compatibility function.
author Chong Yidong <cyd@stupidchicken.com>
date Mon, 02 Jan 2006 15:11:14 +0000
parents 078134944b46
children eea3a49a9d6c
line wrap: on
line diff
--- a/lisp/cus-edit.el	Mon Jan 02 05:25:13 2006 +0000
+++ b/lisp/cus-edit.el	Mon Jan 02 15:11:14 2006 +0000
@@ -2578,15 +2578,13 @@
 		       (if (condition-case nil
 			       (and (equal comment temp)
 				    (equal value
-					   (eval (car
-						  (custom-theme-value
-						   (caar tmp) tmp)))))
+					   (eval
+					    (car (custom-variable-theme-value
+						  symbol)))))
 			     (error nil))
 			   (cond
-			    ((eq 'user (caar (get symbol 'theme-value)))
-			     'saved)
-			    ((eq 'standard (caar (get symbol 'theme-value)))
-			     'changed)
+			    ((eq (caar tmp) 'user) 'saved)
+			    ((eq (caar tmp) 'changed) 'changed)
 			    (t 'themed))
 			 'changed))
 		      ((setq tmp (get symbol 'standard-value))
@@ -2772,7 +2770,7 @@
     (cond ((or value comment)
 	   (put symbol 'variable-comment comment)
 	   (custom-variable-backup-value widget)
-	   (custom-push-theme 'theme-value symbol 'user 'set value)
+	   (custom-push-theme 'theme-value symbol 'user 'set (car-safe value))
 	   (condition-case nil
 	       (funcall set symbol (eval (car value)))
 	     (error nil)))
@@ -2790,15 +2788,14 @@
 restoring it to the state of a variable that has never been customized.
 The value that was current before this operation
 becomes the backup value, so you can get it again."
-  (let* ((symbol (widget-value widget))
-	 (set (or (get symbol 'custom-set) 'set-default)))
+  (let* ((symbol (widget-value widget)))
     (if (get symbol 'standard-value)
 	(custom-variable-backup-value widget)
       (error "No standard setting known for %S" symbol))
     (put symbol 'variable-comment nil)
     (put symbol 'customized-value nil)
     (put symbol 'customized-variable-comment nil)
-    (custom-push-theme 'theme-value symbol 'user 'reset nil)
+    (custom-push-theme 'theme-value symbol 'user 'reset)
     (custom-theme-recalc-variable symbol)
     (when (or (get symbol 'saved-value) (get symbol 'saved-variable-comment))
       (put symbol 'saved-value nil)
@@ -3345,7 +3342,7 @@
 		     (cond
 		      ((eq 'user (caar (get symbol 'theme-face)))
 		       'saved)
-		      ((eq 'standard (caar (get symbol 'theme-face)))
+		      ((eq 'changed (caar (get symbol 'theme-face)))
 		       'changed)
 		      (t 'themed))
 		   'changed))
@@ -3467,7 +3464,7 @@
       (error "No standard setting for this face"))
     (put symbol 'customized-face nil)
     (put symbol 'customized-face-comment nil)
-    (custom-push-theme 'theme-face symbol 'user 'reset nil)
+    (custom-push-theme 'theme-face symbol 'user 'reset)
     (custom-theme-recalc-face symbol)
     (when (or (get symbol 'saved-face) (get symbol 'saved-face-comment))
       (put symbol 'saved-face nil)
@@ -4123,16 +4120,15 @@
 (defun custom-save-variables ()
   "Save all customized variables in `custom-file'."
   (save-excursion
-    (custom-save-delete 'custom-reset-variables)
     (custom-save-delete 'custom-set-variables)
-    (custom-save-resets 'theme-value 'custom-reset-variables nil)
     (let ((standard-output (current-buffer))
 	  (saved-list (make-list 1 0))
 	  sort-fold-case)
       ;; First create a sorted list of saved variables.
       (mapatoms
        (lambda (symbol)
-	 (if (get symbol 'saved-value)
+	 (if (and (get symbol 'saved-value)
+		  (eq 'user (car (car-safe (get symbol 'theme-value)))))
 	     (nconc saved-list (list symbol)))))
       (setq saved-list (sort (cdr saved-list) 'string<))
       (unless (bolp)
@@ -4156,9 +4152,7 @@
 	    (when (and (symbolp request) (not (featurep request)))
 	      (message "Unknown requested feature: %s" request)
 	      (setq requests (delq request requests))))
-	  (when (or (and spec
-			 (eq (nth 0 spec) 'user)
-			 (eq (nth 1 spec) 'set))
+	  (when (or (and spec (eq (car spec) 'user))
 		    comment
 		    (and (null spec) (get symbol 'saved-value)))
 	    (unless (bolp)
@@ -4183,46 +4177,19 @@
       (unless (looking-at "\n")
 	(princ "\n")))))
 
-(defun custom-save-resets (property setter special)
-  (let (started-writing ignored-special)
-    ;; (custom-save-delete setter) Done by caller
-    (let ((standard-output (current-buffer))
-	  (mapper `(lambda (object)
-		    (let ((spec (car-safe (get object (quote ,property)))))
-		      (when (and (not (memq object ignored-special))
-				 (eq (nth 0 spec) 'user)
-				 (eq (nth 1 spec) 'reset))
-			;; Do not write reset statements unless necessary.
-			(unless started-writing
-			  (setq started-writing t)
-			  (unless (bolp)
-			    (princ "\n"))
-			(princ "(")
-			(princ (quote ,setter))
-			(princ "\n '(")
-			(prin1 object)
-			(princ " ")
-			(prin1 (nth 3 spec))
-			(princ ")")))))))
-      (mapc mapper special)
-      (setq ignored-special special)
-      (mapatoms mapper)
-      (when started-writing
-	(princ ")\n")))))
-
 (defun custom-save-faces ()
   "Save all customized faces in `custom-file'."
   (save-excursion
     (custom-save-delete 'custom-reset-faces)
     (custom-save-delete 'custom-set-faces)
-    (custom-save-resets 'theme-face 'custom-reset-faces '(default))
     (let ((standard-output (current-buffer))
 	  (saved-list (make-list 1 0))
 	  sort-fold-case)
       ;; First create a sorted list of saved faces.
       (mapatoms
        (lambda (symbol)
-	 (if (get symbol 'saved-face)
+	 (if (and (get symbol 'saved-face)
+		  (eq 'user (car (car-safe (get symbol 'theme-face)))))
 	     (nconc saved-list (list symbol)))))
       (setq saved-list (sort (cdr saved-list) 'string<))
       ;; The default face must be first, since it affects the others.
@@ -4242,9 +4209,7 @@
 			    (and (not (custom-facep symbol))
 				 (not (get symbol 'force-face))))))
 	      (comment (get symbol 'saved-face-comment)))
-	  (when (or (and spec
-			 (eq (nth 0 spec) 'user)
-			 (eq (nth 1 spec) 'set))
+	  (when (or (and spec (eq (nth 0 spec) 'user))
 		    comment
 		    (and (null spec) (get symbol 'saved-face)))
 	    ;; Don't print default face here.