obarray (lambda (symbol)
(and (boundp symbol)
(or (get symbol 'custom-type)
- (user-variable-p symbol))))
- t nil nil (and v (symbol-name v))))
+ (user-variable-p symbol))))
+ t nil nil (and v (symbol-name v))))
(list (if (equal val "")
(if (symbolp v) v nil)
(intern val)))))
"Set all modified options and save them."
(interactive)
(let ((all-children custom-options)
- children)
+ children)
(mapc (lambda (child)
(when (memq (widget-get child :custom-state) '(modified set))
- (push child children)))
- all-children)
+ (push child children)))
+ all-children)
(let ((the-children children)
- child)
+ child)
(while (setq child (pop the-children))
- (widget-apply child :custom-pre-save)))
+ (widget-apply child :custom-pre-save)))
(custom-save-all)
(let ((the-children children)
- child)
+ child)
(while (setq child (pop the-children))
- (widget-apply child :custom-post-save)))
+ (widget-apply child :custom-post-save)))
))
(defvar custom-reset-menu
"Reset all modified, set, or saved group members to their standard settings."
(interactive)
(let ((all-children custom-options)
- children must-save)
+ children must-save)
(mapc (lambda (child)
(when (memq (widget-get child :custom-state) '(modified set saved))
- (push child children)))
- all-children)
+ (push child children)))
+ all-children)
(let ((the-children children)
- child)
+ child)
(while (setq child (pop the-children))
- (and (widget-apply child :custom-pre-reset-standard)
- (setq must-save t))))
+ (and (widget-apply child :custom-pre-reset-standard)
+ (setq must-save t))))
(and must-save (custom-save-all))
(let ((the-children children)
- child)
+ child)
(while (setq child (pop the-children))
- (widget-apply child :custom-post-reset-standard)))
+ (widget-apply child :custom-post-reset-standard)))
))
\f
(and version
(or (null since-version)
(customize-version-lessp since-version
- version))))
+ version))))
(push (list symbol 'custom-variable) found))))
(unless found
(error "No user options have changed defaults %s"
(return-from custom-load nil)))
#'(lambda ()
(load (expand-file-name "custom-defines" dir))))))
- ;; we get here only from the `return-from'; see above
+ ;; we get here only from the `return-from'; see above
(load source))))
(defun custom-load-widget (widget)
(defvar custom-variable-menu
`(("Set for Current Session" custom-variable-set
,#'(lambda (widget)
- (eq (widget-get widget :custom-state) 'modified)))
+ (eq (widget-get widget :custom-state) 'modified)))
("Save for Future Sessions" custom-variable-save
,#'(lambda (widget)
- (memq (widget-get widget :custom-state)
- '(modified set changed rogue))))
+ (memq (widget-get widget :custom-state)
+ '(modified set changed rogue))))
("Reset to Current" custom-redraw
,#'(lambda (widget)
- (and (default-boundp (widget-value widget))
- (memq (widget-get widget :custom-state) '(modified changed)))))
+ (and (default-boundp (widget-value widget))
+ (memq (widget-get widget :custom-state) '(modified changed)))))
("Reset to Saved" custom-variable-reset-saved
,#'(lambda (widget)
- (and (or (get (widget-value widget) 'saved-value)
- (get (widget-value widget) 'saved-variable-comment))
- (memq (widget-get widget :custom-state)
- '(modified set changed rogue)))))
+ (and (or (get (widget-value widget) 'saved-value)
+ (get (widget-value widget) 'saved-variable-comment))
+ (memq (widget-get widget :custom-state)
+ '(modified set changed rogue)))))
("Reset to Standard Settings" custom-variable-reset-standard
,#'(lambda (widget)
- (and (get (widget-value widget) 'standard-value)
- (memq (widget-get widget :custom-state)
- '(modified set changed saved rogue)))))
+ (and (get (widget-value widget) 'standard-value)
+ (memq (widget-get widget :custom-state)
+ '(modified set changed saved rogue)))))
("---" ignore ignore)
("Add Comment" custom-comment-show custom-comment-invisible-p)
("---" ignore ignore)
("Don't show as Lisp expression" custom-variable-edit
,#'(lambda (widget)
- (eq (widget-get widget :custom-form) 'lisp)))
+ (eq (widget-get widget :custom-form) 'lisp)))
("Show as Lisp expression" custom-variable-edit-lisp
,#'(lambda (widget)
- (eq (widget-get widget :custom-form) 'edit))))
+ (eq (widget-get widget :custom-form) 'edit))))
"Alist of actions for the `custom-variable' widget.
Each entry has the form (NAME ACTION FILTER) where NAME is the name of
the menu entry, ACTION is the function to call on the widget when the
:sample-face 'custom-face-tag-face
:help-echo "Set or reset this face"
:documentation-property #'(lambda (face)
- (face-doc-string face))
+ (face-doc-string face))
:value-create 'custom-face-value-create
:action 'custom-face-action
:custom-category 'face
("Save for Future Sessions" custom-face-save)
("Reset to Saved" custom-face-reset-saved
,#'(lambda (widget)
- (or (get (widget-value widget) 'saved-face)
- (get (widget-value widget) 'saved-face-comment))))
+ (or (get (widget-value widget) 'saved-face)
+ (get (widget-value widget) 'saved-face-comment))))
("Reset to Standard Setting" custom-face-reset-standard
,#'(lambda (widget)
- (get (widget-value widget) 'face-defface-spec)))
+ (get (widget-value widget) 'face-defface-spec)))
("---" ignore ignore)
("Add Comment" custom-comment-show custom-comment-invisible-p)
("---" ignore ignore)
("Show all display specs" custom-face-edit-all
,#'(lambda (widget)
- (not (eq (widget-get widget :custom-form) 'all))))
+ (not (eq (widget-get widget :custom-form) 'all))))
("Just current attributes" custom-face-edit-selected
,#'(lambda (widget)
- (not (eq (widget-get widget :custom-form) 'selected))))
+ (not (eq (widget-get widget :custom-form) 'selected))))
("Show as Lisp expression" custom-face-edit-lisp
,#'(lambda (widget)
- (not (eq (widget-get widget :custom-form) 'lisp)))))
+ (not (eq (widget-get widget :custom-form) 'lisp)))))
"Alist of actions for the `custom-face' widget.
Each entry has the form (NAME ACTION FILTER) where NAME is the name of
the menu entry, ACTION is the function to call on the widget when the
(defun custom-face-post-reset-standard (widget)
"Finish restoring the face edited by WIDGET to its standard settings."
(let* ((symbol (widget-value widget))
- (child (car (widget-get widget :children)))
- (value (get symbol 'face-defface-spec))
- (comment-widget (widget-get widget :comment-widget)))
+ (child (car (widget-get widget :children)))
+ (value (get symbol 'face-defface-spec))
+ (comment-widget (widget-get widget :comment-widget)))
(face-spec-set symbol value nil '(custom))
(put symbol 'face-comment nil)
(widget-value-set child value)
(defvar custom-group-menu
`(("Set for Current Session" custom-group-set
,#'(lambda (widget)
- (eq (widget-get widget :custom-state) 'modified)))
+ (eq (widget-get widget :custom-state) 'modified)))
("Save for Future Sessions" custom-group-save
,#'(lambda (widget)
- (memq (widget-get widget :custom-state) '(modified set))))
+ (memq (widget-get widget :custom-state) '(modified set))))
("Reset to Current" custom-group-reset-current
,#'(lambda (widget)
- (memq (widget-get widget :custom-state) '(modified))))
+ (memq (widget-get widget :custom-state) '(modified))))
("Reset to Saved" custom-group-reset-saved
,#'(lambda (widget)
- (memq (widget-get widget :custom-state) '(modified set))))
+ (memq (widget-get widget :custom-state) '(modified set))))
("Reset to standard setting" custom-group-reset-standard
,#'(lambda (widget)
- (memq (widget-get widget :custom-state) '(modified set saved)))))
+ (memq (widget-get widget :custom-state) '(modified set saved)))))
"Alist of actions for the `custom-group' widget.
Each entry has the form (NAME ACTION FILTER) where NAME is the name of
the menu entry, ACTION is the function to call on the widget when the
"Prepare for saving all modified group members."
(let ((children (widget-get widget :children)))
(mapc (lambda (child)
- (when (memq (widget-get child :custom-state) '(modified set))
- (widget-apply child :custom-pre-save)))
- children)))
+ (when (memq (widget-get child :custom-state) '(modified set))
+ (widget-apply child :custom-pre-save)))
+ children)))
(defun custom-group-post-save (widget)
"Save all modified group members."
(defun custom-group-pre-reset-standard (widget)
"Prepare for resetting all modified, set, or saved group members."
(let ((children (widget-get widget :children))
- must-save)
+ must-save)
(mapc (lambda (child)
- (when (memq (widget-get child :custom-state)
- '(modified set saved))
- (and (widget-apply child :custom-pre-reset-standard)
- (setq must-save t))))
- children)
+ (when (memq (widget-get child :custom-state)
+ '(modified set saved))
+ (and (widget-apply child :custom-pre-reset-standard)
+ (setq must-save t))))
+ children)
must-save
))
(goto-char (point-min))
(condition-case nil
(while (not (eobp))
- (let ((sexp (read (current-buffer))))
- (when (and (listp sexp)
- (memq (car sexp) symbols))
- (delete-region (save-excursion
- (backward-sexp)
- (point))
- (point))
- (while (and (eolp) (not (eobp)))
- (delete-region (point) (prog2 (forward-line 1) (point))))
- )))
+ (let ((sexp (read (current-buffer))))
+ (when (and (listp sexp)
+ (memq (car sexp) symbols))
+ (delete-region (save-excursion
+ (backward-sexp)
+ (point))
+ (point))
+ (while (and (eolp) (not (eobp)))
+ (delete-region (point) (prog2 (forward-line 1) (point))))
+ )))
(end-of-file nil)))
(defsubst custom-save-variable-p (symbol)
"Return non-nil if symbol SYMBOL is a customized variable."
(and (symbolp symbol)
(let ((spec (car-safe (get symbol 'theme-value))))
- (or (and spec (eq (car spec) 'user)
- (eq (second spec) 'set))
- (get symbol 'saved-variable-comment)
- ;; support non-themed vars
- (and (null spec) (get symbol 'saved-value))))))
+ (or (and spec (eq (car spec) 'user)
+ (eq (second spec) 'set))
+ (get symbol 'saved-variable-comment)
+ ;; support non-themed vars
+ (and (null spec) (get symbol 'saved-value))))))
(defun custom-save-variable-internal (symbol)
"Print variable SYMBOL to the standard output.
SYMBOL must be a customized variable."
(let ((requests (get symbol 'custom-requests))
- (now (not (or (get symbol 'standard-value)
- (and (not (boundp symbol))
- (not (eq (get symbol 'force-value)
- 'rogue))))))
- (comment (get symbol 'saved-variable-comment))
- ;; Print everything, no placeholders `...'
- (print-level nil)
- (print-length nil))
+ (now (not (or (get symbol 'standard-value)
+ (and (not (boundp symbol))
+ (not (eq (get symbol 'force-value)
+ 'rogue))))))
+ (comment (get symbol 'saved-variable-comment))
+ ;; Print everything, no placeholders `...'
+ (print-level nil)
+ (print-length nil))
(unless (custom-save-variable-p symbol)
(error 'wrong-type-argument "Not a customized variable" symbol))
(princ "\n '(")
;; (prin1 (third spec))
;; XEmacs -- pretty-print value if available
(if (and custom-save-pretty-print
- (fboundp 'pp))
- ;; To suppress bytecompiler warning
- (with-fboundp 'pp
- (pp (car (get symbol 'saved-value))))
+ (fboundp 'pp))
+ ;; To suppress bytecompiler warning
+ (with-fboundp 'pp
+ (pp (car (get symbol 'saved-value))))
(prin1 (car (get symbol 'saved-value))))
(when (or now requests comment)
(princ (if now " t" " nil")))
(custom-save-loaded-themes)
(custom-save-resets 'theme-value 'custom-reset-variables nil)
(let ((standard-output (current-buffer))
- (sorted-list ()))
+ (sorted-list ()))
;; First create a sorted list of saved variables.
(mapatoms
- (lambda (symbol)
- (when (custom-save-variable-p symbol)
- (push symbol sorted-list))))
+ (lambda (symbol)
+ (when (custom-save-variable-p symbol)
+ (push symbol sorted-list))))
(setq sorted-list (sort sorted-list 'string<))
(unless (bolp)
(princ "\n"))
(princ "(custom-set-variables")
(mapc 'custom-save-variable-internal
- sorted-list)
+ sorted-list)
(princ ")")
(unless (looking-at "\n")
(princ "\n")))))
(let ((theme-spec (car-safe (get symbol 'theme-face)))
(comment (get symbol 'saved-face-comment)))
(or (and (not (memq symbol custom-save-face-ignoring))
- ;; Don't print default face here.
- (or (and theme-spec
- (eq (car theme-spec) 'user)
- (eq (second theme-spec) 'set))
- ;; cope with non-themed faces
- (and (null theme-spec)
- (get symbol 'saved-face))))
- comment)))
+ ;; Don't print default face here.
+ (or (and theme-spec
+ (eq (car theme-spec) 'user)
+ (eq (second theme-spec) 'set))
+ ;; cope with non-themed faces
+ (and (null theme-spec)
+ (get symbol 'saved-face))))
+ comment)))
(defun custom-save-face-internal (symbol)
"Print face SYMBOL to the standard output.
(now (not (or (get symbol 'face-defface-spec)
(and (not (find-face symbol))
(not (eq (get symbol 'force-face) 'rogue))))))
- ;; Print everything, no placeholders `...'
- (print-level nil)
- (print-length nil))
+ ;; Print everything, no placeholders `...'
+ (print-level nil)
+ (print-length nil))
(if (memq symbol custom-save-face-ignoring)
- ;; Do nothing
- nil
+ ;; Do nothing
+ nil
;; Print face
(unless (custom-save-face-p symbol)
- (error 'wrong-type-argument "Not a customized face" symbol))
+ (error 'wrong-type-argument "Not a customized face" symbol))
(princ "\n '(")
(prin1 symbol)
(princ " ")
;; 'custom-set-faces)
(custom-save-resets 'theme-face 'custom-reset-faces '(default))
(let ((standard-output (current-buffer))
- (sorted-list ()))
+ (sorted-list ()))
;; Create a sorted list of faces
(mapatoms
(lambda (symbol)
- (when (custom-save-face-p symbol)
- (push symbol sorted-list))))
+ (when (custom-save-face-p symbol)
+ (push symbol sorted-list))))
(setq sorted-list (sort sorted-list 'string<))
(unless (bolp)
(princ "\n"))
(princ "(custom-set-faces")
;; The default face must be first, since it affects the others.
(when (custom-save-face-p 'default)
- (custom-save-face-internal 'default))
+ (custom-save-face-internal 'default))
(let ((custom-save-face-ignoring '(default)))
(mapc 'custom-save-face-internal
- sorted-list))
+ sorted-list))
(princ ")")
(unless (looking-at "\n")
(princ "\n")))))
"Create a mapper for `custom-save-resets'."
`(lambda (object)
(let ((spec (car-safe (get object (quote ,property))))
- (print-level nil)
- (print-length nil))
+ (print-level nil)
+ (print-length nil))
(with-boundp '(ignored-special started-writing)
- (when (and (not (memq object ignored-special))
- (eq (car spec) 'user)
- (eq (second 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 (third spec))
- (princ ")")))))))
+ (when (and (not (memq object ignored-special))
+ (eq (car spec) 'user)
+ (eq (second 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 (third spec))
+ (princ ")")))))))
(defconst custom-save-resets-mapper-alist
(eval-when-compile
(list (list 'theme-value 'custom-reset-variables
- (byte-compile
- (make-custom-save-resets-mapper
- 'theme-value 'custom-reset-variables)))
- (list 'theme-face 'custom-reset-faces
- (byte-compile
- (make-custom-save-resets-mapper
- 'theme-face 'custom-reset-faces)))))
+ (byte-compile
+ (make-custom-save-resets-mapper
+ 'theme-value 'custom-reset-variables)))
+ (list 'theme-face 'custom-reset-faces
+ (byte-compile
+ (make-custom-save-resets-mapper
+ 'theme-face 'custom-reset-faces)))))
"Never use it.
Hashes several heavily used functions for `custom-save-resets'")
;; (custom-save-delete setter) Done by caller
(let ((standard-output (current-buffer))
(mapper (let ((triple (assq property custom-save-resets-mapper-alist)))
- (if (and triple (eq (second triple) setter))
- (third triple)
- (make-custom-save-resets-mapper property setter)))))
+ (if (and triple (eq (second triple) setter))
+ (third triple)
+ (make-custom-save-resets-mapper property setter)))))
(mapc mapper special)
(setq ignored-special special)
(mapatoms mapper)
(defun custom-save-loaded-themes ()
(let ((themes (reverse (get 'user 'theme-loads-themes)))
(standard-output (current-buffer))
- (print-level nil)
- (print-length nil))
+ (print-level nil)
+ (print-length nil))
(when themes
(unless (bolp) (princ "\n"))
(princ "(custom-load-themes")
Invoke button under point. \\[widget-button-press]
Set all modifications. \\[Custom-set]
Make all modifications default. \\[Custom-save]
-Reset all modified options. \\[Custom-reset-current]
+Reset all modified options. \\[Custom-reset-current]
Reset all modified or set options. \\[Custom-reset-saved]
Reset all options. \\[Custom-reset-standard]