549 |
(set variable value)) |
(set variable value)) |
550 |
(set-default variable value))) |
(set-default variable value))) |
551 |
|
|
552 |
|
(defun custom-quote (sexp) |
553 |
|
"Quote SEXP iff it is not self quoting." |
554 |
|
(if (or (memq sexp '(t nil)) |
555 |
|
(keywordp sexp) |
556 |
|
(and (listp sexp) |
557 |
|
(memq (car sexp) '(lambda))) |
558 |
|
(stringp sexp) |
559 |
|
(numberp sexp) |
560 |
|
(vectorp sexp) |
561 |
|
;;; (and (fboundp 'characterp) |
562 |
|
;;; (characterp sexp)) |
563 |
|
) |
564 |
|
sexp |
565 |
|
(list 'quote sexp))) |
566 |
|
|
567 |
|
(defun customize-mark-to-save (symbol) |
568 |
|
"Mark SYMBOL for later saving. |
569 |
|
|
570 |
|
If the default value of SYMBOL is different from the standard value, |
571 |
|
set the `saved-value' property to a list whose car evaluates to the |
572 |
|
default value. Otherwise, set it til nil. |
573 |
|
|
574 |
|
To actually save the value, call `custom-save-all'. |
575 |
|
|
576 |
|
Return non-nil iff the `saved-value' property actually changed." |
577 |
|
(let* ((get (or (get symbol 'custom-get) 'default-value)) |
578 |
|
(value (funcall get symbol)) |
579 |
|
(saved (get symbol 'saved-value)) |
580 |
|
(standard (get symbol 'standard-value)) |
581 |
|
(comment (get symbol 'customized-variable-comment))) |
582 |
|
;; Save default value iff different from standard value. |
583 |
|
(if (or (null standard) |
584 |
|
(not (equal value (condition-case nil |
585 |
|
(eval (car standard)) |
586 |
|
(error nil))))) |
587 |
|
(put symbol 'saved-value (list (custom-quote value))) |
588 |
|
(put symbol 'saved-value nil)) |
589 |
|
;; Clear customized information (set, but not saved). |
590 |
|
(put symbol 'customized-value nil) |
591 |
|
;; Save any comment that might have been set. |
592 |
|
(when comment |
593 |
|
(put symbol 'saved-variable-comment comment)) |
594 |
|
(not (equal saved (get symbol 'saved-value))))) |
595 |
|
|
596 |
|
(defun customize-mark-as-set (symbol) |
597 |
|
"Mark current value of SYMBOL as being set from customize. |
598 |
|
|
599 |
|
If the default value of SYMBOL is different from the saved value if any, |
600 |
|
or else if it is different from the standard value, set the |
601 |
|
`customized-value' property to a list whose car evaluates to the |
602 |
|
default value. Otherwise, set it til nil. |
603 |
|
|
604 |
|
Return non-nil iff the `customized-value' property actually changed." |
605 |
|
(let* ((get (or (get symbol 'custom-get) 'default-value)) |
606 |
|
(value (funcall get symbol)) |
607 |
|
(customized (get symbol 'customized-value)) |
608 |
|
(old (or (get symbol 'saved-value) (get symbol 'standard-value)))) |
609 |
|
;; Mark default value as set iff different from old value. |
610 |
|
(if (or (null old) |
611 |
|
(not (equal value (condition-case nil |
612 |
|
(eval (car old)) |
613 |
|
(error nil))))) |
614 |
|
(put symbol 'customized-value (list (custom-quote value))) |
615 |
|
(put symbol 'customized-value nil)) |
616 |
|
;; Changed? |
617 |
|
(not (equal customized (get symbol 'customized-value))))) |
618 |
|
|
619 |
;;; The End. |
;;; The End. |
620 |
|
|
621 |
;; Process the defcustoms for variables loaded before this file. |
;; Process the defcustoms for variables loaded before this file. |