Mercurial > hg > xemacs-beta
comparison lisp/custom.el @ 4744:17f7e9191c0b
Rationalise duplicated functionality, #'custom-quote, #'quote-maybe.
src/ChangeLog addition:
2009-11-15 Aidan Kehoe <kehoea@parhasard.net>
* eval.c (Fquote_maybe):
Move this function here from callint.c; make it more comprehensive
about which types are self-quoting.
* lisp.h: Declare Fquote_maybe here, since it's now used in
callint.c and defined in eval.c
* callint.c (Fquote_maybe): Remove this function from this file.
lisp/ChangeLog addition:
2009-11-15 Aidan Kehoe <kehoea@parhasard.net>
* custom.el (custom-quote):
Define this as an alias for `quote-maybe', which is in C and more
comprehensive; packages still use this name in places.
(customize-mark-to-save, customize-mark-as-set): Use
`quote-maybe', not `custom-quote'.
* cus-edit.el (customize-set-variable, customize-save-variable)
(custom-variable-value-create, custom-variable-set)
(custom-variable-pre-save):
Remove a version of `custom-quote' specific to this file; use
`quote-maybe' universally instead.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Sun, 15 Nov 2009 14:59:53 +0000 |
parents | 061e030e3270 |
children | 7d06a8bf47d2 |
comparison
equal
deleted
inserted
replaced
4743:776bbf454f3a | 4744:17f7e9191c0b |
---|---|
818 (if custom-local-buffer | 818 (if custom-local-buffer |
819 (with-current-buffer custom-local-buffer | 819 (with-current-buffer custom-local-buffer |
820 (set variable value)) | 820 (set variable value)) |
821 (set-default variable value))) | 821 (set-default variable value))) |
822 | 822 |
823 (defun custom-quote (sexp) | 823 ;; Now in C, but the old name is still used by some packages: |
824 "Quote SEXP iff it is not self quoting." | 824 (defalias 'custom-quote 'quote-maybe) |
825 (if (or (memq sexp '(t nil)) | |
826 (keywordp sexp) | |
827 (and (listp sexp) | |
828 (memq (car sexp) '(lambda))) | |
829 (stringp sexp) | |
830 (numberp sexp) | |
831 (vectorp sexp) | |
832 ;;; (and (fboundp 'characterp) | |
833 ;;; (characterp sexp)) | |
834 ) | |
835 sexp | |
836 (list 'quote sexp))) | |
837 | 825 |
838 (defun customize-mark-to-save (symbol) | 826 (defun customize-mark-to-save (symbol) |
839 "Mark SYMBOL for later saving. | 827 "Mark SYMBOL for later saving. |
840 | 828 |
841 If the default value of SYMBOL is different from the standard value, | 829 If the default value of SYMBOL is different from the standard value, |
853 ;; Save default value iff different from standard value. | 841 ;; Save default value iff different from standard value. |
854 (if (or (null standard) | 842 (if (or (null standard) |
855 (not (equal value (condition-case nil | 843 (not (equal value (condition-case nil |
856 (eval (car standard)) | 844 (eval (car standard)) |
857 (error nil))))) | 845 (error nil))))) |
858 (put symbol 'saved-value (list (custom-quote value))) | 846 (put symbol 'saved-value (list (quote-maybe value))) |
859 (put symbol 'saved-value nil)) | 847 (put symbol 'saved-value nil)) |
860 ;; Clear customized information (set, but not saved). | 848 ;; Clear customized information (set, but not saved). |
861 (put symbol 'customized-value nil) | 849 (put symbol 'customized-value nil) |
862 ;; Save any comment that might have been set. | 850 ;; Save any comment that might have been set. |
863 (when comment | 851 (when comment |
880 ;; Mark default value as set iff different from old value. | 868 ;; Mark default value as set iff different from old value. |
881 (if (or (null old) | 869 (if (or (null old) |
882 (not (equal value (condition-case nil | 870 (not (equal value (condition-case nil |
883 (eval (car old)) | 871 (eval (car old)) |
884 (error nil))))) | 872 (error nil))))) |
885 (put symbol 'customized-value (list (custom-quote value))) | 873 (put symbol 'customized-value (list (quote-maybe value))) |
886 (put symbol 'customized-value nil)) | 874 (put symbol 'customized-value nil)) |
887 ;; Changed? | 875 ;; Changed? |
888 (not (equal customized (get symbol 'customized-value))))) | 876 (not (equal customized (get symbol 'customized-value))))) |
889 | 877 |
890 ;;; Theme Manipulation | 878 ;;; Theme Manipulation |