Mercurial > emacs
comparison lisp/cus-edit.el @ 68139:058a6e577709
(custom-reset-menu, custom-buffer-create-internal)
(custom-variable-menu, custom-face-menu, custom-group-menu)
(Custom-mode-menu): Change names of menu items. (As discussed on emacs-devel.)
(custom-face-menu): Add "Undo Edits" item.
author | Luc Teirlinck <teirllm@auburn.edu> |
---|---|
date | Thu, 12 Jan 2006 02:25:59 +0000 |
parents | d42505f2ff8c |
children | 08dc54e52e8e |
comparison
equal
deleted
inserted
replaced
68138:d47ecb3cad92 | 68139:058a6e577709 |
---|---|
86 ;; when the variable is first initialized, this is only relevant for the | 86 ;; when the variable is first initialized, this is only relevant for the |
87 ;; saved (and standard) values, but affect others values for | 87 ;; saved (and standard) values, but affect others values for |
88 ;; compatibility. | 88 ;; compatibility. |
89 | 89 |
90 ;; You can see (and modify and save) this unevaluated value by selecting | 90 ;; You can see (and modify and save) this unevaluated value by selecting |
91 ;; "Show initial Lisp expression" from the Lisp interface. This will | 91 ;; "Show Saved Lisp Expression" from the Lisp interface. This will |
92 ;; give you the unevaluated saved value, if any, otherwise the | 92 ;; give you the unevaluated saved value, if any, otherwise the |
93 ;; unevaluated standard value. | 93 ;; unevaluated standard value. |
94 | 94 |
95 ;; The possible states for a customize widget are: | 95 ;; The possible states for a customize widget are: |
96 | 96 |
768 children) | 768 children) |
769 (custom-save-all)) | 769 (custom-save-all)) |
770 (message "Aborted"))) | 770 (message "Aborted"))) |
771 | 771 |
772 (defvar custom-reset-menu | 772 (defvar custom-reset-menu |
773 '(("Reset to current settings" . Custom-reset-current) | 773 '(("Undo Edits" . Custom-reset-current) |
774 ("Reset to saved settings" . Custom-reset-saved) | 774 ("Reset to Saved" . Custom-reset-saved) |
775 ("Erase Customization (use standard values)" . Custom-reset-standard)) | 775 ("Erase Customization (use standard values)" . Custom-reset-standard)) |
776 "Alist of actions for the `Reset' button. | 776 "Alist of actions for the `Reset' button. |
777 The key is a string containing the name of the action, the value is a | 777 The key is a string containing the name of the action, the value is a |
778 Lisp function taking the widget as an element which will be called | 778 Lisp function taking the widget as an element which will be called |
779 when the action is chosen.") | 779 when the action is chosen.") |
1507 :mouse-down-action (lambda (&rest junk) t) | 1507 :mouse-down-action (lambda (&rest junk) t) |
1508 :action (lambda (widget &optional event) | 1508 :action (lambda (widget &optional event) |
1509 (custom-reset event)))) | 1509 (custom-reset event)))) |
1510 (widget-insert "\n ") | 1510 (widget-insert "\n ") |
1511 (widget-create 'push-button | 1511 (widget-create 'push-button |
1512 :tag "Reset to Current" | 1512 :tag "Undo Edits" |
1513 :help-echo "\ | 1513 :help-echo "\ |
1514 Reset all edited text in this buffer to reflect current values." | 1514 Reset all edited text in this buffer to reflect current values." |
1515 :action 'Custom-reset-current) | 1515 :action 'Custom-reset-current) |
1516 (widget-insert " ") | 1516 (widget-insert " ") |
1517 (widget-create 'push-button | 1517 (widget-create 'push-button |
2626 | 2626 |
2627 (defun custom-variable-standard-value (widget) | 2627 (defun custom-variable-standard-value (widget) |
2628 (get (widget-value widget) 'standard-value)) | 2628 (get (widget-value widget) 'standard-value)) |
2629 | 2629 |
2630 (defvar custom-variable-menu | 2630 (defvar custom-variable-menu |
2631 `(("Set for current session" custom-variable-set | 2631 `(("Set for Current Session" custom-variable-set |
2632 (lambda (widget) | 2632 (lambda (widget) |
2633 (eq (widget-get widget :custom-state) 'modified))) | 2633 (eq (widget-get widget :custom-state) 'modified))) |
2634 ,@(when (or custom-file user-init-file) | 2634 ,@(when (or custom-file user-init-file) |
2635 '(("Save for future sessions" custom-variable-save | 2635 '(("Save for Future Sessions" custom-variable-save |
2636 (lambda (widget) | 2636 (lambda (widget) |
2637 (memq (widget-get widget :custom-state) | 2637 (memq (widget-get widget :custom-state) |
2638 '(modified set changed rogue)))))) | 2638 '(modified set changed rogue)))))) |
2639 ("---" ignore ignore) | 2639 ("Undo Edits" custom-redraw |
2640 ("Reset to current value" custom-redraw | |
2641 (lambda (widget) | 2640 (lambda (widget) |
2642 (and (default-boundp (widget-value widget)) | 2641 (and (default-boundp (widget-value widget)) |
2643 (memq (widget-get widget :custom-state) '(modified changed))))) | 2642 (memq (widget-get widget :custom-state) '(modified changed))))) |
2644 ("Reset to saved value" custom-variable-reset-saved | 2643 ("Reset to Saved" custom-variable-reset-saved |
2645 (lambda (widget) | 2644 (lambda (widget) |
2646 (and (or (get (widget-value widget) 'saved-value) | 2645 (and (or (get (widget-value widget) 'saved-value) |
2647 (get (widget-value widget) 'saved-variable-comment)) | 2646 (get (widget-value widget) 'saved-variable-comment)) |
2648 (memq (widget-get widget :custom-state) | 2647 (memq (widget-get widget :custom-state) |
2649 '(modified set changed rogue))))) | 2648 '(modified set changed rogue))))) |
2650 ("Reset to backup value" custom-variable-reset-backup | |
2651 (lambda (widget) | |
2652 (get (widget-value widget) 'backup-value))) | |
2653 ,@(when (or custom-file user-init-file) | 2649 ,@(when (or custom-file user-init-file) |
2654 '(("Erase customization" custom-variable-reset-standard | 2650 '(("Erase Customization" custom-variable-reset-standard |
2655 (lambda (widget) | 2651 (lambda (widget) |
2656 (and (get (widget-value widget) 'standard-value) | 2652 (and (get (widget-value widget) 'standard-value) |
2657 (memq (widget-get widget :custom-state) | 2653 (memq (widget-get widget :custom-state) |
2658 '(modified set changed saved rogue))))))) | 2654 '(modified set changed saved rogue))))))) |
2655 ("Set to Backup Value" custom-variable-reset-backup | |
2656 (lambda (widget) | |
2657 (get (widget-value widget) 'backup-value))) | |
2659 ("---" ignore ignore) | 2658 ("---" ignore ignore) |
2660 ("Add comment" custom-comment-show custom-comment-invisible-p) | 2659 ("Add Comment" custom-comment-show custom-comment-invisible-p) |
2661 ("Show value widget" custom-variable-edit | 2660 ("---" ignore ignore) |
2661 ("Show Current Value" custom-variable-edit | |
2662 (lambda (widget) | 2662 (lambda (widget) |
2663 (eq (widget-get widget :custom-form) 'lisp))) | 2663 (eq (widget-get widget :custom-form) 'lisp))) |
2664 ("Show Lisp expression" custom-variable-edit-lisp | 2664 ("Show Saved Lisp Expression" custom-variable-edit-lisp |
2665 (lambda (widget) | 2665 (lambda (widget) |
2666 (eq (widget-get widget :custom-form) 'edit)))) | 2666 (eq (widget-get widget :custom-form) 'edit)))) |
2667 "Alist of actions for the `custom-variable' widget. | 2667 "Alist of actions for the `custom-variable' widget. |
2668 Each entry has the form (NAME ACTION FILTER) where NAME is the name of | 2668 Each entry has the form (NAME ACTION FILTER) where NAME is the name of |
2669 the menu entry, ACTION is the function to call on the widget when the | 2669 the menu entry, ACTION is the function to call on the widget when the |
3300 (push edit children) | 3300 (push edit children) |
3301 (widget-put widget :children children)) | 3301 (widget-put widget :children children)) |
3302 (message "Creating face editor...done")))))) | 3302 (message "Creating face editor...done")))))) |
3303 | 3303 |
3304 (defvar custom-face-menu | 3304 (defvar custom-face-menu |
3305 `(("Set for current session" custom-face-set) | 3305 `(("Set for Current Session" custom-face-set) |
3306 ,@(when (or custom-file user-init-file) | 3306 ,@(when (or custom-file user-init-file) |
3307 '(("Save for future sessions" custom-face-save-command))) | 3307 '(("Save for Future Sessions" custom-face-save-command))) |
3308 ("---" ignore ignore) | 3308 ("Undo Edits" custom-redraw |
3309 ("Reset to saved face" custom-face-reset-saved | 3309 (lambda (widget) |
3310 (memq (widget-get widget :custom-state) '(modified changed)))) | |
3311 ("Reset to Saved" custom-face-reset-saved | |
3310 (lambda (widget) | 3312 (lambda (widget) |
3311 (or (get (widget-value widget) 'saved-face) | 3313 (or (get (widget-value widget) 'saved-face) |
3312 (get (widget-value widget) 'saved-face-comment)))) | 3314 (get (widget-value widget) 'saved-face-comment)))) |
3313 ,@(when (or custom-file user-init-file) | 3315 ,@(when (or custom-file user-init-file) |
3314 '(("Erase customization" custom-face-reset-standard | 3316 '(("Erase Customization" custom-face-reset-standard |
3315 (lambda (widget) | 3317 (lambda (widget) |
3316 (get (widget-value widget) 'face-defface-spec))))) | 3318 (get (widget-value widget) 'face-defface-spec))))) |
3317 ("---" ignore ignore) | 3319 ("---" ignore ignore) |
3318 ("Add comment" custom-comment-show custom-comment-invisible-p) | 3320 ("Add Comment" custom-comment-show custom-comment-invisible-p) |
3319 ("Show all attributes" custom-face-edit-all | 3321 ("---" ignore ignore) |
3322 ("For Current Display" custom-face-edit-selected | |
3323 (lambda (widget) | |
3324 (not (eq (widget-get widget :custom-form) 'selected)))) | |
3325 ("For All Kinds of Displays" custom-face-edit-all | |
3320 (lambda (widget) | 3326 (lambda (widget) |
3321 (not (eq (widget-get widget :custom-form) 'all)))) | 3327 (not (eq (widget-get widget :custom-form) 'all)))) |
3322 ("Show current attributes" custom-face-edit-selected | 3328 ("Show Lisp Expression" custom-face-edit-lisp |
3323 (lambda (widget) | |
3324 (not (eq (widget-get widget :custom-form) 'selected)))) | |
3325 ("Show Lisp expression" custom-face-edit-lisp | |
3326 (lambda (widget) | 3329 (lambda (widget) |
3327 (not (eq (widget-get widget :custom-form) 'lisp))))) | 3330 (not (eq (widget-get widget :custom-form) 'lisp))))) |
3328 "Alist of actions for the `custom-face' widget. | 3331 "Alist of actions for the `custom-face' widget. |
3329 Each entry has the form (NAME ACTION FILTER) where NAME is the name of | 3332 Each entry has the form (NAME ACTION FILTER) where NAME is the name of |
3330 the menu entry, ACTION is the function to call on the widget when the | 3333 the menu entry, ACTION is the function to call on the widget when the |
3898 (insert "\\- " (widget-get widget :tag) " group end ") | 3901 (insert "\\- " (widget-get widget :tag) " group end ") |
3899 (insert-char ?- (- 75 (current-column) (* custom-buffer-indent level))) | 3902 (insert-char ?- (- 75 (current-column) (* custom-buffer-indent level))) |
3900 (insert "/\n"))))) | 3903 (insert "/\n"))))) |
3901 | 3904 |
3902 (defvar custom-group-menu | 3905 (defvar custom-group-menu |
3903 `(("Set for current session" custom-group-set | 3906 `(("Set for Current Session" custom-group-set |
3904 (lambda (widget) | 3907 (lambda (widget) |
3905 (eq (widget-get widget :custom-state) 'modified))) | 3908 (eq (widget-get widget :custom-state) 'modified))) |
3906 ,@(when (or custom-file user-init-file) | 3909 ,@(when (or custom-file user-init-file) |
3907 '(("Save for future sessions" custom-group-save | 3910 '(("Save for Future Sessions" custom-group-save |
3908 (lambda (widget) | 3911 (lambda (widget) |
3909 (memq (widget-get widget :custom-state) '(modified set)))))) | 3912 (memq (widget-get widget :custom-state) '(modified set)))))) |
3910 ("---" ignore ignore) | 3913 ("Undo Edits" custom-group-reset-current |
3911 ("Reset to current settings" custom-group-reset-current | |
3912 (lambda (widget) | 3914 (lambda (widget) |
3913 (memq (widget-get widget :custom-state) '(modified)))) | 3915 (memq (widget-get widget :custom-state) '(modified)))) |
3914 ("Reset to saved settings" custom-group-reset-saved | 3916 ("Reset to Saved" custom-group-reset-saved |
3915 (lambda (widget) | 3917 (lambda (widget) |
3916 (memq (widget-get widget :custom-state) '(modified set)))) | 3918 (memq (widget-get widget :custom-state) '(modified set)))) |
3917 ,@(when (or custom-file user-init-file) | 3919 ,@(when (or custom-file user-init-file) |
3918 '(("Reset to standard settings" custom-group-reset-standard | 3920 '(("Erase Customization" custom-group-reset-standard |
3919 (lambda (widget) | 3921 (lambda (widget) |
3920 (memq (widget-get widget :custom-state) '(modified set saved))))))) | 3922 (memq (widget-get widget :custom-state) '(modified set saved))))))) |
3921 "Alist of actions for the `custom-group' widget. | 3923 "Alist of actions for the `custom-group' widget. |
3922 Each entry has the form (NAME ACTION FILTER) where NAME is the name of | 3924 Each entry has the form (NAME ACTION FILTER) where NAME is the name of |
3923 the menu entry, ACTION is the function to call on the widget when the | 3925 the menu entry, ACTION is the function to call on the widget when the |
4372 "Menu used in customization buffers." | 4374 "Menu used in customization buffers." |
4373 `("Custom" | 4375 `("Custom" |
4374 ,(customize-menu-create 'customize) | 4376 ,(customize-menu-create 'customize) |
4375 ["Set" Custom-set t] | 4377 ["Set" Custom-set t] |
4376 ["Save" Custom-save t] | 4378 ["Save" Custom-save t] |
4377 ["Reset to current settings" Custom-reset-current t] | 4379 ["Undo Edits" Custom-reset-current t] |
4378 ["Reset to saved settings" Custom-reset-saved t] | 4380 ["Reset to Saved" Custom-reset-saved t] |
4379 ["Erase customizations" Custom-reset-standard t] | 4381 ["Erase Customization" Custom-reset-standard t] |
4380 ["Info" (info "(emacs)Easy Customization") t])) | 4382 ["Info" (info "(emacs)Easy Customization") t])) |
4381 | 4383 |
4382 (defun Custom-goto-parent () | 4384 (defun Custom-goto-parent () |
4383 "Go to the parent group listed at the top of this buffer. | 4385 "Go to the parent group listed at the top of this buffer. |
4384 If several parents are listed, go to the first of them." | 4386 If several parents are listed, go to the first of them." |