Mercurial > hg > xemacs-beta
comparison lisp/cus-edit.el @ 4289:20accccbebd6
[xemacs-hg @ 2007-11-27 22:15:32 by aidan]
Byte compile defcustom init values; save the Lisp values for correct
editing, correct some comments and indentation, and expose some lambda
expressions to the byte compile; make custom-initialize-changed a defubst,
since it's only called from one place and calls to that place cluster.
author | aidan |
---|---|
date | Tue, 27 Nov 2007 22:15:34 +0000 |
parents | ef6c55ab3090 |
children | 12ff8dc2b57e |
comparison
equal
deleted
inserted
replaced
4288:9eb558ffe8ff | 4289:20accccbebd6 |
---|---|
823 | 823 |
824 ;;;###autoload | 824 ;;;###autoload |
825 (defun customize-changed-options (since-version) | 825 (defun customize-changed-options (since-version) |
826 "Customize all user option variables whose default values changed recently. | 826 "Customize all user option variables whose default values changed recently. |
827 This means, in other words, variables defined with a `:version' keyword." | 827 This means, in other words, variables defined with a `:version' keyword." |
828 (interactive "sCustomize options changed, since version (default all versions): ") | 828 (interactive |
829 "sCustomize options changed, since version (default all versions): ") | |
829 (if (equal since-version "") | 830 (if (equal since-version "") |
830 (setq since-version nil)) | 831 (setq since-version nil)) |
831 (let ((found nil)) | 832 (let ((found nil)) |
832 (mapatoms (lambda (symbol) | 833 (mapatoms (lambda (symbol) |
833 (and (boundp symbol) | 834 (and (boundp symbol) |
834 (let ((version (get symbol 'custom-version))) | 835 (let ((version (get symbol 'custom-version))) |
835 (and version | 836 (and version |
836 (or (null since-version) | 837 (or (null since-version) |
837 (customize-version-lessp since-version version)))) | 838 (customize-version-lessp since-version |
839 version)))) | |
838 (push (list symbol 'custom-variable) found)))) | 840 (push (list symbol 'custom-variable) found)))) |
839 (unless found | 841 (unless found |
840 (error "No user options have changed defaults %s" | 842 (error "No user options have changed defaults %s" |
841 (if since-version | 843 (if since-version |
842 (format "since XEmacs %s" since-version) | 844 (format "since XEmacs %s" since-version) |
2201 'changed)) | 2203 'changed)) |
2202 (t 'rogue)))) | 2204 (t 'rogue)))) |
2203 (widget-put widget :custom-state state))) | 2205 (widget-put widget :custom-state state))) |
2204 | 2206 |
2205 (defvar custom-variable-menu | 2207 (defvar custom-variable-menu |
2206 '(("Set for Current Session" custom-variable-set | 2208 `(("Set for Current Session" custom-variable-set |
2207 (lambda (widget) | 2209 ,#'(lambda (widget) |
2208 (eq (widget-get widget :custom-state) 'modified))) | 2210 (eq (widget-get widget :custom-state) 'modified))) |
2209 ("Save for Future Sessions" custom-variable-save | 2211 ("Save for Future Sessions" custom-variable-save |
2210 (lambda (widget) | 2212 ,#'(lambda (widget) |
2211 (memq (widget-get widget :custom-state) '(modified set changed rogue)))) | 2213 (memq (widget-get widget :custom-state) |
2214 '(modified set changed rogue)))) | |
2212 ("Reset to Current" custom-redraw | 2215 ("Reset to Current" custom-redraw |
2213 (lambda (widget) | 2216 ,#'(lambda (widget) |
2214 (and (default-boundp (widget-value widget)) | 2217 (and (default-boundp (widget-value widget)) |
2215 (memq (widget-get widget :custom-state) '(modified changed))))) | 2218 (memq (widget-get widget :custom-state) '(modified changed))))) |
2216 ("Reset to Saved" custom-variable-reset-saved | 2219 ("Reset to Saved" custom-variable-reset-saved |
2217 (lambda (widget) | 2220 ,#'(lambda (widget) |
2218 (and (or (get (widget-value widget) 'saved-value) | 2221 (and (or (get (widget-value widget) 'saved-value) |
2219 (get (widget-value widget) 'saved-variable-comment)) | 2222 (get (widget-value widget) 'saved-variable-comment)) |
2220 (memq (widget-get widget :custom-state) | 2223 (memq (widget-get widget :custom-state) |
2221 '(modified set changed rogue))))) | 2224 '(modified set changed rogue))))) |
2222 ("Reset to Standard Settings" custom-variable-reset-standard | 2225 ("Reset to Standard Settings" custom-variable-reset-standard |
2223 (lambda (widget) | 2226 ,#'(lambda (widget) |
2224 (and (get (widget-value widget) 'standard-value) | 2227 (and (get (widget-value widget) 'standard-value) |
2225 (memq (widget-get widget :custom-state) | 2228 (memq (widget-get widget :custom-state) |
2226 '(modified set changed saved rogue))))) | 2229 '(modified set changed saved rogue))))) |
2227 ("---" ignore ignore) | 2230 ("---" ignore ignore) |
2228 ("Add Comment" custom-comment-show custom-comment-invisible-p) | 2231 ("Add Comment" custom-comment-show custom-comment-invisible-p) |
2229 ("---" ignore ignore) | 2232 ("---" ignore ignore) |
2230 ("Don't show as Lisp expression" custom-variable-edit | 2233 ("Don't show as Lisp expression" custom-variable-edit |
2231 (lambda (widget) | 2234 ,#'(lambda (widget) |
2232 (eq (widget-get widget :custom-form) 'lisp))) | 2235 (eq (widget-get widget :custom-form) 'lisp))) |
2233 ("Show as Lisp expression" custom-variable-edit-lisp | 2236 ("Show as Lisp expression" custom-variable-edit-lisp |
2234 (lambda (widget) | 2237 ,#'(lambda (widget) |
2235 (eq (widget-get widget :custom-form) 'edit)))) | 2238 (eq (widget-get widget :custom-form) 'edit)))) |
2236 "Alist of actions for the `custom-variable' widget. | 2239 "Alist of actions for the `custom-variable' widget. |
2237 Each entry has the form (NAME ACTION FILTER) where NAME is the name of | 2240 Each entry has the form (NAME ACTION FILTER) where NAME is the name of |
2238 the menu entry, ACTION is the function to call on the widget when the | 2241 the menu entry, ACTION is the function to call on the widget when the |
2239 menu is selected, and FILTER is a predicate which takes a `custom-variable' | 2242 menu is selected, and FILTER is a predicate which takes a `custom-variable' |
2240 widget as an argument, and returns non-nil if ACTION is valid on that | 2243 widget as an argument, and returns non-nil if ACTION is valid on that |
2692 (push edit children) | 2695 (push edit children) |
2693 (widget-put widget :children children)) | 2696 (widget-put widget :children children)) |
2694 (message "Creating face editor...done")))))) | 2697 (message "Creating face editor...done")))))) |
2695 | 2698 |
2696 (defvar custom-face-menu | 2699 (defvar custom-face-menu |
2697 '(("Set for Current Session" custom-face-set) | 2700 `(("Set for Current Session" custom-face-set) |
2698 ("Save for Future Sessions" custom-face-save) | 2701 ("Save for Future Sessions" custom-face-save) |
2699 ("Reset to Saved" custom-face-reset-saved | 2702 ("Reset to Saved" custom-face-reset-saved |
2700 (lambda (widget) | 2703 ,#'(lambda (widget) |
2701 (or (get (widget-value widget) 'saved-face) | 2704 (or (get (widget-value widget) 'saved-face) |
2702 (get (widget-value widget) 'saved-face-comment)))) | 2705 (get (widget-value widget) 'saved-face-comment)))) |
2703 ("Reset to Standard Setting" custom-face-reset-standard | 2706 ("Reset to Standard Setting" custom-face-reset-standard |
2704 (lambda (widget) | 2707 ,#'(lambda (widget) |
2705 (get (widget-value widget) 'face-defface-spec))) | 2708 (get (widget-value widget) 'face-defface-spec))) |
2706 ("---" ignore ignore) | 2709 ("---" ignore ignore) |
2707 ("Add Comment" custom-comment-show custom-comment-invisible-p) | 2710 ("Add Comment" custom-comment-show custom-comment-invisible-p) |
2708 ("---" ignore ignore) | 2711 ("---" ignore ignore) |
2709 ("Show all display specs" custom-face-edit-all | 2712 ("Show all display specs" custom-face-edit-all |
2710 (lambda (widget) | 2713 ,#'(lambda (widget) |
2711 (not (eq (widget-get widget :custom-form) 'all)))) | 2714 (not (eq (widget-get widget :custom-form) 'all)))) |
2712 ("Just current attributes" custom-face-edit-selected | 2715 ("Just current attributes" custom-face-edit-selected |
2713 (lambda (widget) | 2716 ,#'(lambda (widget) |
2714 (not (eq (widget-get widget :custom-form) 'selected)))) | 2717 (not (eq (widget-get widget :custom-form) 'selected)))) |
2715 ("Show as Lisp expression" custom-face-edit-lisp | 2718 ("Show as Lisp expression" custom-face-edit-lisp |
2716 (lambda (widget) | 2719 ,#'(lambda (widget) |
2717 (not (eq (widget-get widget :custom-form) 'lisp))))) | 2720 (not (eq (widget-get widget :custom-form) 'lisp))))) |
2718 "Alist of actions for the `custom-face' widget. | 2721 "Alist of actions for the `custom-face' widget. |
2719 Each entry has the form (NAME ACTION FILTER) where NAME is the name of | 2722 Each entry has the form (NAME ACTION FILTER) where NAME is the name of |
2720 the menu entry, ACTION is the function to call on the widget when the | 2723 the menu entry, ACTION is the function to call on the widget when the |
2721 menu is selected, and FILTER is a predicate which takes a `custom-face' | 2724 menu is selected, and FILTER is a predicate which takes a `custom-face' |
2722 widget as an argument, and returns non-nil if ACTION is valid on that | 2725 widget as an argument, and returns non-nil if ACTION is valid on that |
3334 (insert "\\- " (widget-get widget :tag) " group end ") | 3337 (insert "\\- " (widget-get widget :tag) " group end ") |
3335 (insert-char ?- (- 75 (current-column) (* custom-buffer-indent level))) | 3338 (insert-char ?- (- 75 (current-column) (* custom-buffer-indent level))) |
3336 (insert "/\n"))))) | 3339 (insert "/\n"))))) |
3337 | 3340 |
3338 (defvar custom-group-menu | 3341 (defvar custom-group-menu |
3339 '(("Set for Current Session" custom-group-set | 3342 `(("Set for Current Session" custom-group-set |
3340 (lambda (widget) | 3343 ,#'(lambda (widget) |
3341 (eq (widget-get widget :custom-state) 'modified))) | 3344 (eq (widget-get widget :custom-state) 'modified))) |
3342 ("Save for Future Sessions" custom-group-save | 3345 ("Save for Future Sessions" custom-group-save |
3343 (lambda (widget) | 3346 ,#'(lambda (widget) |
3344 (memq (widget-get widget :custom-state) '(modified set)))) | 3347 (memq (widget-get widget :custom-state) '(modified set)))) |
3345 ("Reset to Current" custom-group-reset-current | 3348 ("Reset to Current" custom-group-reset-current |
3346 (lambda (widget) | 3349 ,#'(lambda (widget) |
3347 (memq (widget-get widget :custom-state) '(modified)))) | 3350 (memq (widget-get widget :custom-state) '(modified)))) |
3348 ("Reset to Saved" custom-group-reset-saved | 3351 ("Reset to Saved" custom-group-reset-saved |
3349 (lambda (widget) | 3352 ,#'(lambda (widget) |
3350 (memq (widget-get widget :custom-state) '(modified set)))) | 3353 (memq (widget-get widget :custom-state) '(modified set)))) |
3351 ("Reset to standard setting" custom-group-reset-standard | 3354 ("Reset to standard setting" custom-group-reset-standard |
3352 (lambda (widget) | 3355 ,#'(lambda (widget) |
3353 (memq (widget-get widget :custom-state) '(modified set saved))))) | 3356 (memq (widget-get widget :custom-state) '(modified set saved))))) |
3354 "Alist of actions for the `custom-group' widget. | 3357 "Alist of actions for the `custom-group' widget. |
3355 Each entry has the form (NAME ACTION FILTER) where NAME is the name of | 3358 Each entry has the form (NAME ACTION FILTER) where NAME is the name of |
3356 the menu entry, ACTION is the function to call on the widget when the | 3359 the menu entry, ACTION is the function to call on the widget when the |
3357 menu is selected, and FILTER is a predicate which takes a `custom-group' | 3360 menu is selected, and FILTER is a predicate which takes a `custom-group' |
3358 widget as an argument, and returns non-nil if ACTION is valid on that | 3361 widget as an argument, and returns non-nil if ACTION is valid on that |