Mercurial > emacs
comparison lisp/cus-edit.el @ 18460:a2be4f4ac8ed
(Custom-move-and-invoke): New command.
(custom-mode-map): Bind Custom-move-and-invoke to mouse-1.
(custom-buffer-create-internal): Update buffer help text.
(custom-variable-menu): Clarify menu item names.
(custom-buffer-create-internal): Clarify button names.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Fri, 27 Jun 1997 06:03:11 +0000 |
parents | 8eb08560287b |
children | 0e65e5074881 |
comparison
equal
deleted
inserted
replaced
18459:688c725c6b23 | 18460:a2be4f4ac8ed |
---|---|
1004 | 1004 |
1005 (defun custom-buffer-create-internal (options) | 1005 (defun custom-buffer-create-internal (options) |
1006 (message "Creating customization buffer...") | 1006 (message "Creating customization buffer...") |
1007 (custom-mode) | 1007 (custom-mode) |
1008 (widget-insert "This is a customization buffer. | 1008 (widget-insert "This is a customization buffer. |
1009 Square brackets show active fields; type RET or click mouse-2 | 1009 Square brackets show active fields; type RET or click mouse-1 |
1010 on an active field to invoke its action. Invoke ") | 1010 on an active field to invoke its action. Invoke ") |
1011 (widget-create 'info-link | 1011 (widget-create 'info-link |
1012 :tag "Help" | 1012 :tag "Help" |
1013 :help-echo "Read the online help." | 1013 :help-echo "Read the online help." |
1014 "(emacs)Easy Customization") | 1014 "(emacs)Easy Customization") |
1015 (widget-insert " for more information.\n\n") | 1015 (widget-insert " for more information.\n\n") |
1016 (message "Creating customization buttons...") | 1016 (message "Creating customization buttons...") |
1017 (widget-insert "Operate on everything in this buffer:\n ") | 1017 (widget-insert "Operate on everything in this buffer:\n ") |
1018 (widget-create 'push-button | 1018 (widget-create 'push-button |
1019 :tag "Set" | 1019 :tag "Set for Current Session" |
1020 :help-echo "\ | 1020 :help-echo "\ |
1021 Make your editing in this buffer take effect for this session." | 1021 Make your editing in this buffer take effect for this session." |
1022 :action (lambda (widget &optional event) | 1022 :action (lambda (widget &optional event) |
1023 (Custom-set))) | 1023 (Custom-set))) |
1024 (widget-insert " ") | 1024 (widget-insert " ") |
1025 (widget-create 'push-button | 1025 (widget-create 'push-button |
1026 :tag "Save" | 1026 :tag "Save for Future Sessions" |
1027 :help-echo "\ | 1027 :help-echo "\ |
1028 Make your editing in this buffer take effect for future Emacs sessions." | 1028 Make your editing in this buffer take effect for future Emacs sessions." |
1029 :action (lambda (widget &optional event) | 1029 :action (lambda (widget &optional event) |
1030 (Custom-save))) | 1030 (Custom-save))) |
1031 (widget-insert " ") | |
1032 (if custom-reset-button-menu | 1031 (if custom-reset-button-menu |
1033 (widget-create 'push-button | 1032 (progn |
1034 :tag "Reset" | 1033 (widget-insert " ") |
1035 :help-echo "Show a menu with reset operations." | 1034 (widget-create 'push-button |
1036 :mouse-down-action (lambda (&rest junk) t) | 1035 :tag "Reset" |
1037 :action (lambda (widget &optional event) | 1036 :help-echo "Show a menu with reset operations." |
1038 (custom-reset event))) | 1037 :mouse-down-action (lambda (&rest junk) t) |
1038 :action (lambda (widget &optional event) | |
1039 (custom-reset event)))) | |
1040 (widget-insert "\n ") | |
1039 (widget-create 'push-button | 1041 (widget-create 'push-button |
1040 :tag "Reset" | 1042 :tag "Reset" |
1041 :help-echo "\ | 1043 :help-echo "\ |
1042 Reset all edited text in this buffer to reflect current values." | 1044 Reset all edited text in this buffer to reflect current values." |
1043 :action 'Custom-reset-current) | 1045 :action 'Custom-reset-current) |
1854 'changed)) | 1856 'changed)) |
1855 (t 'rogue)))) | 1857 (t 'rogue)))) |
1856 (widget-put widget :custom-state state))) | 1858 (widget-put widget :custom-state state))) |
1857 | 1859 |
1858 (defvar custom-variable-menu | 1860 (defvar custom-variable-menu |
1859 '(("Set" custom-variable-set | 1861 '(("Set for Current Session" custom-variable-set |
1860 (lambda (widget) | 1862 (lambda (widget) |
1861 (eq (widget-get widget :custom-state) 'modified))) | 1863 (eq (widget-get widget :custom-state) 'modified))) |
1862 ("Save" custom-variable-save | 1864 ("Save for Future Sessions" custom-variable-save |
1863 (lambda (widget) | 1865 (lambda (widget) |
1864 (memq (widget-get widget :custom-state) '(modified set changed rogue)))) | 1866 (memq (widget-get widget :custom-state) '(modified set changed rogue)))) |
1865 ("Reset to Current" custom-redraw | 1867 ("Reset to Current" custom-redraw |
1866 (lambda (widget) | 1868 (lambda (widget) |
1867 (and (default-boundp (widget-value widget)) | 1869 (and (default-boundp (widget-value widget)) |
3073 (set-keymap-parent custom-mode-map widget-keymap) | 3075 (set-keymap-parent custom-mode-map widget-keymap) |
3074 (suppress-keymap custom-mode-map) | 3076 (suppress-keymap custom-mode-map) |
3075 (define-key custom-mode-map " " 'scroll-up) | 3077 (define-key custom-mode-map " " 'scroll-up) |
3076 (define-key custom-mode-map "\177" 'scroll-down) | 3078 (define-key custom-mode-map "\177" 'scroll-down) |
3077 (define-key custom-mode-map "q" 'bury-buffer) | 3079 (define-key custom-mode-map "q" 'bury-buffer) |
3078 (define-key custom-mode-map "u" 'Custom-goto-parent)) | 3080 (define-key custom-mode-map "u" 'Custom-goto-parent) |
3081 (define-key custom-mode-map [mouse-1] 'Custom-move-and-invoke)) | |
3082 | |
3083 (defun Custom-move-and-invoke (event) | |
3084 "Move to where you click, and if it is an active field, invoke it." | |
3085 (interactive "e") | |
3086 (mouse-set-point event) | |
3087 (if (widget-event-point event) | |
3088 (let* ((pos (widget-event-point event)) | |
3089 (button (get-char-property pos 'button))) | |
3090 (if button | |
3091 (widget-button-click event))))) | |
3079 | 3092 |
3080 (easy-menu-define Custom-mode-menu | 3093 (easy-menu-define Custom-mode-menu |
3081 custom-mode-map | 3094 custom-mode-map |
3082 "Menu used in customization buffers." | 3095 "Menu used in customization buffers." |
3083 `("Custom" | 3096 `("Custom" |
3114 | 3127 |
3115 The following commands are available: | 3128 The following commands are available: |
3116 | 3129 |
3117 Move to next button or editable field. \\[widget-forward] | 3130 Move to next button or editable field. \\[widget-forward] |
3118 Move to previous button or editable field. \\[widget-backward] | 3131 Move to previous button or editable field. \\[widget-backward] |
3119 Invoke button under the mouse pointer. \\[widget-button-click] | 3132 Invoke button under the mouse pointer. \\[Custom-move-and-invoke] |
3120 Invoke button under point. \\[widget-button-press] | 3133 Invoke button under point. \\[widget-button-press] |
3121 Set all modifications. \\[Custom-set] | 3134 Set all modifications. \\[Custom-set] |
3122 Make all modifications default. \\[Custom-save] | 3135 Make all modifications default. \\[Custom-save] |
3123 Reset all modified options. \\[Custom-reset-current] | 3136 Reset all modified options. \\[Custom-reset-current] |
3124 Reset all modified or set options. \\[Custom-reset-saved] | 3137 Reset all modified or set options. \\[Custom-reset-saved] |