Commit d358aa10 authored by Chong Yidong's avatar Chong Yidong
Browse files

* 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.
parent 55262b16
2006-01-01 Chong Yidong <cyd@stupidchicken.com>
* 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.
2006-01-01 Richard M. Stallman <rms@gnu.org>
 
* cus-edit.el (Custom-set, Custom-save): Ask for confirmation.
......
......@@ -2578,15 +2578,13 @@ Otherwise, look up symbol in `custom-guess-type-alist'."
(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 @@ becomes the backup value, so you can get it again."
(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 @@ This operation eliminates any saved setting for the variable,
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 @@ widget. If FILTER is nil, ACTION is always valid.")
(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 @@ restoring it to the state of a face that has never been customized."
(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 @@ This function does not save the buffer."
(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 @@ This function does not save the buffer."
(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 @@ This function does not save the buffer."
(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 @@ This function does not save the buffer."
(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.
......
......@@ -350,17 +350,20 @@ FACE's list property `theme-face' \(using `custom-push-theme')."
(custom-push-theme 'theme-face face theme 'set spec))
(setq args (cdr (cdr args))))))))
;; XEmacs compability function. In XEmacs, when you reset a Custom
;; Theme, you have to specify the theme to reset it to. We just apply
;; the next theme.
;;;###autoload
(defun custom-theme-reset-faces (theme &rest args)
"Reset the specs in THEME of some faces to their specs in other themes.
Each of the arguments ARGS has this form:
(FACE FROM-THEME)
(FACE IGNORED)
This means reset FACE to its value in FROM-THEME."
This means reset FACE. The argument IGNORED is ignored."
(custom-check-theme theme)
(dolist (arg args)
(custom-push-theme 'theme-face (car arg) theme 'reset (cadr arg))))
(custom-push-theme 'theme-face (car arg) theme 'reset)))
;;;###autoload
(defun custom-reset-faces (&rest args)
......
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment