Mercurial > emacs
comparison lisp/cus-edit.el @ 68028:b0c2a07f73f6
(custom-reset-menu, Custom-mode-menu)
(custom-variable-menu, custom-face-menu, custom-group-menu):
Move back to previous ordering.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Wed, 04 Jan 2006 21:23:20 +0000 |
parents | c7ec296cf313 |
children | 742bf2516c24 |
comparison
equal
deleted
inserted
replaced
68027:606e8e24acfe | 68028:b0c2a07f73f6 |
---|---|
777 when the action is chosen.") | 777 when the action is chosen.") |
778 | 778 |
779 (defun custom-reset (event) | 779 (defun custom-reset (event) |
780 "Select item from reset menu." | 780 "Select item from reset menu." |
781 (let* ((completion-ignore-case t) | 781 (let* ((completion-ignore-case t) |
782 (answer (widget-choose "Reset buffer" | 782 (answer (widget-choose "Reset settings" |
783 custom-reset-menu | 783 custom-reset-menu |
784 event))) | 784 event))) |
785 (if answer | 785 (if answer |
786 (funcall answer)))) | 786 (funcall answer)))) |
787 | 787 |
1469 :help-echo "Read the online help." | 1469 :help-echo "Read the online help." |
1470 "(emacs)Easy Customization") | 1470 "(emacs)Easy Customization") |
1471 (widget-insert " for more information.\n\n") | 1471 (widget-insert " for more information.\n\n") |
1472 (widget-insert "Operate on everything in this buffer:\n ")) | 1472 (widget-insert "Operate on everything in this buffer:\n ")) |
1473 (widget-insert " ")) | 1473 (widget-insert " ")) |
1474 (widget-create 'push-button | |
1475 :tag "Set for Current Session" | |
1476 :help-echo "\ | |
1477 Make your editing in this buffer take effect for this session." | |
1478 :action (lambda (widget &optional event) | |
1479 (Custom-set))) | |
1480 (if (not custom-buffer-verbose-help) | |
1481 (progn | |
1482 (widget-insert " ") | |
1483 (widget-create 'info-link | |
1484 :tag "Help" | |
1485 :button-face 'custom-link | |
1486 :mouse-face 'highlight | |
1487 :help-echo "Read the online help." | |
1488 "(emacs)Easy Customization"))) | |
1489 (when (or custom-file user-init-file) | |
1490 (widget-insert " ") | |
1491 (widget-create 'push-button | |
1492 :tag "Save for Future Sessions" | |
1493 :help-echo "\ | |
1494 Make your editing in this buffer take effect for future Emacs sessions. | |
1495 This updates your Emacs initialization file or creates a new one." | |
1496 :action (lambda (widget &optional event) | |
1497 (Custom-save)))) | |
1474 (if custom-reset-button-menu | 1498 (if custom-reset-button-menu |
1475 (progn | 1499 (progn |
1476 (widget-insert " ") | 1500 (widget-insert " ") |
1477 (widget-create 'push-button | 1501 (widget-create 'push-button |
1478 :tag "Reset buffer" | 1502 :tag "Reset buffer" |
1497 (widget-create 'push-button | 1521 (widget-create 'push-button |
1498 :tag "Erase Customization" | 1522 :tag "Erase Customization" |
1499 :help-echo "\ | 1523 :help-echo "\ |
1500 Un-customize all settings in this buffer and save them with standard values." | 1524 Un-customize all settings in this buffer and save them with standard values." |
1501 :action 'Custom-reset-standard))) | 1525 :action 'Custom-reset-standard))) |
1502 (widget-insert "\n ") | |
1503 (widget-create 'push-button | |
1504 :tag "Set for Current Session" | |
1505 :help-echo "\ | |
1506 Make your editing in this buffer take effect for this session." | |
1507 :action (lambda (widget &optional event) | |
1508 (Custom-set))) | |
1509 (if (not custom-buffer-verbose-help) | |
1510 (progn | |
1511 (widget-insert " ") | |
1512 (widget-create 'info-link | |
1513 :tag "Help" | |
1514 :button-face 'custom-link | |
1515 :mouse-face 'highlight | |
1516 :help-echo "Read the online help." | |
1517 "(emacs)Easy Customization"))) | |
1518 (when (or custom-file user-init-file) | |
1519 (widget-insert " ") | |
1520 (widget-create 'push-button | |
1521 :tag "Save for Future Sessions" | |
1522 :help-echo "\ | |
1523 Make your editing in this buffer take effect for future Emacs sessions. | |
1524 This updates your Emacs initialization file or creates a new one." | |
1525 :action (lambda (widget &optional event) | |
1526 (Custom-save)))) | |
1527 (widget-insert " ") | 1526 (widget-insert " ") |
1528 (widget-create 'push-button | 1527 (widget-create 'push-button |
1529 :tag "Finish" | 1528 :tag "Finish" |
1530 :help-echo | 1529 :help-echo |
1531 (lambda (&rest ignore) | 1530 (lambda (&rest ignore) |
2621 | 2620 |
2622 (defun custom-variable-standard-value (widget) | 2621 (defun custom-variable-standard-value (widget) |
2623 (get (widget-value widget) 'standard-value)) | 2622 (get (widget-value widget) 'standard-value)) |
2624 | 2623 |
2625 (defvar custom-variable-menu | 2624 (defvar custom-variable-menu |
2626 `(("Add comment" custom-comment-show custom-comment-invisible-p) | 2625 `(("Set for current session" custom-variable-set |
2627 ("Show value widget" custom-variable-edit | |
2628 (lambda (widget) | 2626 (lambda (widget) |
2629 (eq (widget-get widget :custom-form) 'lisp))) | 2627 (eq (widget-get widget :custom-state) 'modified))) |
2630 ("Show Lisp expression" custom-variable-edit-lisp | 2628 ,@(when (or custom-file user-init-file) |
2631 (lambda (widget) | 2629 '(("Save for future sessions" custom-variable-save |
2632 (eq (widget-get widget :custom-form) 'edit))) | 2630 (lambda (widget) |
2631 (memq (widget-get widget :custom-state) | |
2632 '(modified set changed rogue)))))) | |
2633 ("---" ignore ignore) | 2633 ("---" ignore ignore) |
2634 ("Reset to current value" custom-redraw | 2634 ("Reset to current value" custom-redraw |
2635 (lambda (widget) | 2635 (lambda (widget) |
2636 (and (default-boundp (widget-value widget)) | 2636 (and (default-boundp (widget-value widget)) |
2637 (memq (widget-get widget :custom-state) '(modified changed))))) | 2637 (memq (widget-get widget :custom-state) '(modified changed))))) |
2642 (memq (widget-get widget :custom-state) | 2642 (memq (widget-get widget :custom-state) |
2643 '(modified set changed rogue))))) | 2643 '(modified set changed rogue))))) |
2644 ("Reset to backup value" custom-variable-reset-backup | 2644 ("Reset to backup value" custom-variable-reset-backup |
2645 (lambda (widget) | 2645 (lambda (widget) |
2646 (get (widget-value widget) 'backup-value))) | 2646 (get (widget-value widget) 'backup-value))) |
2647 ("---" ignore ignore) | |
2648 ,@(when (or custom-file user-init-file) | 2647 ,@(when (or custom-file user-init-file) |
2649 '(("Erase customization" custom-variable-reset-standard | 2648 '(("Erase customization" custom-variable-reset-standard |
2650 (lambda (widget) | 2649 (lambda (widget) |
2651 (and (get (widget-value widget) 'standard-value) | 2650 (and (get (widget-value widget) 'standard-value) |
2652 (memq (widget-get widget :custom-state) | 2651 (memq (widget-get widget :custom-state) |
2653 '(modified set changed saved rogue))))))) | 2652 '(modified set changed saved rogue))))))) |
2654 ("Set for current session" custom-variable-set | 2653 ("---" ignore ignore) |
2654 ("Add comment" custom-comment-show custom-comment-invisible-p) | |
2655 ("Show value widget" custom-variable-edit | |
2655 (lambda (widget) | 2656 (lambda (widget) |
2656 (eq (widget-get widget :custom-state) 'modified))) | 2657 (eq (widget-get widget :custom-form) 'lisp))) |
2657 ,@(when (or custom-file user-init-file) | 2658 ("Show Lisp expression" custom-variable-edit-lisp |
2658 '(("Save for future sessions" custom-variable-save | 2659 (lambda (widget) |
2659 (lambda (widget) | 2660 (eq (widget-get widget :custom-form) 'edit)))) |
2660 (memq (widget-get widget :custom-state) | |
2661 '(modified set changed rogue))))))) | |
2662 "Alist of actions for the `custom-variable' widget. | 2661 "Alist of actions for the `custom-variable' widget. |
2663 Each entry has the form (NAME ACTION FILTER) where NAME is the name of | 2662 Each entry has the form (NAME ACTION FILTER) where NAME is the name of |
2664 the menu entry, ACTION is the function to call on the widget when the | 2663 the menu entry, ACTION is the function to call on the widget when the |
2665 menu is selected, and FILTER is a predicate which takes a `custom-variable' | 2664 menu is selected, and FILTER is a predicate which takes a `custom-variable' |
2666 widget as an argument, and returns non-nil if ACTION is valid on that | 2665 widget as an argument, and returns non-nil if ACTION is valid on that |
3294 (push edit children) | 3293 (push edit children) |
3295 (widget-put widget :children children)) | 3294 (widget-put widget :children children)) |
3296 (message "Creating face editor...done")))))) | 3295 (message "Creating face editor...done")))))) |
3297 | 3296 |
3298 (defvar custom-face-menu | 3297 (defvar custom-face-menu |
3299 `(("Add comment" custom-comment-show custom-comment-invisible-p) | 3298 `(("Set for current session" custom-face-set) |
3300 ("Show all attributes" custom-face-edit-all | 3299 ,@(when (or custom-file user-init-file) |
3301 (lambda (widget) | 3300 '(("Save for future sessions" custom-face-save-command))) |
3302 (not (eq (widget-get widget :custom-form) 'all)))) | |
3303 ("Show current attributes" custom-face-edit-selected | |
3304 (lambda (widget) | |
3305 (not (eq (widget-get widget :custom-form) 'selected)))) | |
3306 ("Show Lisp expression" custom-face-edit-lisp | |
3307 (lambda (widget) | |
3308 (not (eq (widget-get widget :custom-form) 'lisp)))) | |
3309 ("---" ignore ignore) | 3301 ("---" ignore ignore) |
3310 ("Reset to saved face" custom-face-reset-saved | 3302 ("Reset to saved face" custom-face-reset-saved |
3311 (lambda (widget) | 3303 (lambda (widget) |
3312 (or (get (widget-value widget) 'saved-face) | 3304 (or (get (widget-value widget) 'saved-face) |
3313 (get (widget-value widget) 'saved-face-comment)))) | 3305 (get (widget-value widget) 'saved-face-comment)))) |
3314 ,@(when (or custom-file user-init-file) | 3306 ,@(when (or custom-file user-init-file) |
3315 '(("Erase customization" custom-face-reset-standard | 3307 '(("Erase customization" custom-face-reset-standard |
3316 (lambda (widget) | 3308 (lambda (widget) |
3317 (get (widget-value widget) 'face-defface-spec))))) | 3309 (get (widget-value widget) 'face-defface-spec))))) |
3318 ("Set for current session" custom-face-set) | 3310 ("---" ignore ignore) |
3319 ,@(when (or custom-file user-init-file) | 3311 ("Add comment" custom-comment-show custom-comment-invisible-p) |
3320 '(("Save for future sessions" custom-face-save-command)))) | 3312 ("Show all attributes" custom-face-edit-all |
3313 (lambda (widget) | |
3314 (not (eq (widget-get widget :custom-form) 'all)))) | |
3315 ("Show current attributes" custom-face-edit-selected | |
3316 (lambda (widget) | |
3317 (not (eq (widget-get widget :custom-form) 'selected)))) | |
3318 ("Show Lisp expression" custom-face-edit-lisp | |
3319 (lambda (widget) | |
3320 (not (eq (widget-get widget :custom-form) 'lisp))))) | |
3321 "Alist of actions for the `custom-face' widget. | 3321 "Alist of actions for the `custom-face' widget. |
3322 Each entry has the form (NAME ACTION FILTER) where NAME is the name of | 3322 Each entry has the form (NAME ACTION FILTER) where NAME is the name of |
3323 the menu entry, ACTION is the function to call on the widget when the | 3323 the menu entry, ACTION is the function to call on the widget when the |
3324 menu is selected, and FILTER is a predicate which takes a `custom-face' | 3324 menu is selected, and FILTER is a predicate which takes a `custom-face' |
3325 widget as an argument, and returns non-nil if ACTION is valid on that | 3325 widget as an argument, and returns non-nil if ACTION is valid on that |
3891 (insert "\\- " (widget-get widget :tag) " group end ") | 3891 (insert "\\- " (widget-get widget :tag) " group end ") |
3892 (insert-char ?- (- 75 (current-column) (* custom-buffer-indent level))) | 3892 (insert-char ?- (- 75 (current-column) (* custom-buffer-indent level))) |
3893 (insert "/\n"))))) | 3893 (insert "/\n"))))) |
3894 | 3894 |
3895 (defvar custom-group-menu | 3895 (defvar custom-group-menu |
3896 `(("Reset to current settings" custom-group-reset-current | 3896 `(("Set for current session" custom-group-set |
3897 (lambda (widget) | |
3898 (eq (widget-get widget :custom-state) 'modified))) | |
3899 ,@(when (or custom-file user-init-file) | |
3900 '(("Save for future sessions" custom-group-save | |
3901 (lambda (widget) | |
3902 (memq (widget-get widget :custom-state) '(modified set)))))) | |
3903 ("---" ignore ignore) | |
3904 ("Reset to current settings" custom-group-reset-current | |
3897 (lambda (widget) | 3905 (lambda (widget) |
3898 (memq (widget-get widget :custom-state) '(modified)))) | 3906 (memq (widget-get widget :custom-state) '(modified)))) |
3899 ("Reset to saved settings" custom-group-reset-saved | 3907 ("Reset to saved settings" custom-group-reset-saved |
3900 (lambda (widget) | 3908 (lambda (widget) |
3901 (memq (widget-get widget :custom-state) '(modified set)))) | 3909 (memq (widget-get widget :custom-state) '(modified set)))) |
3902 ,@(when (or custom-file user-init-file) | 3910 ,@(when (or custom-file user-init-file) |
3903 '(("Reset to standard settings" custom-group-reset-standard | 3911 '(("Reset to standard settings" custom-group-reset-standard |
3904 (lambda (widget) | 3912 (lambda (widget) |
3905 (memq (widget-get widget :custom-state) '(modified set saved)))))) | 3913 (memq (widget-get widget :custom-state) '(modified set saved))))))) |
3906 ("---" ignore ignore) | |
3907 ("Set for current session" custom-group-set | |
3908 (lambda (widget) | |
3909 (eq (widget-get widget :custom-state) 'modified))) | |
3910 ,@(when (or custom-file user-init-file) | |
3911 '(("Save for future sessions" custom-group-save | |
3912 (lambda (widget) | |
3913 (memq (widget-get widget :custom-state) '(modified set))))))) | |
3914 "Alist of actions for the `custom-group' widget. | 3914 "Alist of actions for the `custom-group' widget. |
3915 Each entry has the form (NAME ACTION FILTER) where NAME is the name of | 3915 Each entry has the form (NAME ACTION FILTER) where NAME is the name of |
3916 the menu entry, ACTION is the function to call on the widget when the | 3916 the menu entry, ACTION is the function to call on the widget when the |
3917 menu is selected, and FILTER is a predicate which takes a `custom-group' | 3917 menu is selected, and FILTER is a predicate which takes a `custom-group' |
3918 widget as an argument, and returns non-nil if ACTION is valid on that | 3918 widget as an argument, and returns non-nil if ACTION is valid on that |