diff options
| author | Chong Yidong | 2012-04-22 21:58:00 +0800 |
|---|---|---|
| committer | Chong Yidong | 2012-04-22 21:58:00 +0800 |
| commit | cf20dee0248049a925275f54381cf63bb2017e35 (patch) | |
| tree | 0a7922c4ea3258733023c58cf50d8fe1a60e7b43 /lisp/cus-edit.el | |
| parent | 583e23bd57621892cce187359afd952f7850e7bc (diff) | |
| download | emacs-cf20dee0248049a925275f54381cf63bb2017e35.tar.gz emacs-cf20dee0248049a925275f54381cf63bb2017e35.zip | |
Tweaks to Customize interface. Set custom-reset-button-menu to t.
* cus-edit.el (custom-commands, custom-reset-menu)
(Custom-reset-standard): Tweak labels.
(custom-reset-button-menu): Change default to t.
(custom-buffer-create-internal): For the custom-reset-button-menu
case, put the revert button first.
(custom-group-subtitle): New face.
(custom-group-value-create): Align docstring to a specific column.
* wid-edit.el (widget-documentation-link-add): Don't handle
indentation in this function.
(widget-documentation-string-indent-to): New function.
(widget-documentation-string-value-create): Use it.
* autorevert.el (auto-revert):
* epg-config.el (epg):
* ibuffer.el (ibuffer):
* mpc.el (mpc):
* ses.el (ses):
* eshell/eshell.el (eshell):
* net/ange-ftp.el (ange-ftp):
* progmodes/ebnf2ps.el (postscript):
* progmodes/flymake.el (flymake):
* progmodes/prolog.el (prolog):
* progmodes/verilog-mode.el (verilog-mode):
* progmodes/which-func.el (which-func):
* textmodes/picture.el (picture):
* textmodes/tildify.el (tildify):
* vc/ediff.el (ediff): Tweak defgroups to improve presentation in
customization buffers.
Diffstat (limited to 'lisp/cus-edit.el')
| -rw-r--r-- | lisp/cus-edit.el | 137 |
1 files changed, 73 insertions, 64 deletions
diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el index 4ed72be06fb..d20403ad341 100644 --- a/lisp/cus-edit.el +++ b/lisp/cus-edit.el | |||
| @@ -223,7 +223,7 @@ | |||
| 223 | :group 'emacs) | 223 | :group 'emacs) |
| 224 | 224 | ||
| 225 | (defgroup languages nil | 225 | (defgroup languages nil |
| 226 | "Specialized modes for editing programming languages." | 226 | "Modes for editing programming languages." |
| 227 | :group 'programming) | 227 | :group 'programming) |
| 228 | 228 | ||
| 229 | (defgroup lisp nil | 229 | (defgroup lisp nil |
| @@ -255,7 +255,7 @@ | |||
| 255 | :group 'applications) | 255 | :group 'applications) |
| 256 | 256 | ||
| 257 | (defgroup news nil | 257 | (defgroup news nil |
| 258 | "Support for netnews reading and posting." | 258 | "Reading and posting to newsgroups." |
| 259 | :link '(custom-manual "(gnus)") | 259 | :link '(custom-manual "(gnus)") |
| 260 | :group 'applications) | 260 | :group 'applications) |
| 261 | 261 | ||
| @@ -297,7 +297,7 @@ | |||
| 297 | :group 'environment) | 297 | :group 'environment) |
| 298 | 298 | ||
| 299 | (defgroup unix nil | 299 | (defgroup unix nil |
| 300 | "Front-ends/assistants for, or emulators of, UNIX features." | 300 | "Interfaces, assistants, and emulators for UNIX features." |
| 301 | :group 'environment) | 301 | :group 'environment) |
| 302 | 302 | ||
| 303 | (defgroup i18n nil | 303 | (defgroup i18n nil |
| @@ -544,12 +544,6 @@ WIDGET is the widget to apply the filter entries of MENU on." | |||
| 544 | (erase-buffer) | 544 | (erase-buffer) |
| 545 | (princ symbol (current-buffer)) | 545 | (princ symbol (current-buffer)) |
| 546 | (goto-char (point-min)) | 546 | (goto-char (point-min)) |
| 547 | ;; FIXME: Boolean variables are not predicates, so they shouldn't | ||
| 548 | ;; end with `-p'. -stef | ||
| 549 | ;; (when (and (eq (get symbol 'custom-type) 'boolean) | ||
| 550 | ;; (re-search-forward "-p\\'" nil t)) | ||
| 551 | ;; (replace-match "" t t) | ||
| 552 | ;; (goto-char (point-min))) | ||
| 553 | (if custom-unlispify-remove-prefixes | 547 | (if custom-unlispify-remove-prefixes |
| 554 | (let ((prefixes custom-prefix-list) | 548 | (let ((prefixes custom-prefix-list) |
| 555 | prefix) | 549 | prefix) |
| @@ -732,26 +726,26 @@ groups after non-groups, if nil do not order groups at all." | |||
| 732 | ;; `custom-buffer-create-internal' if `custom-buffer-verbose-help' is non-nil. | 726 | ;; `custom-buffer-create-internal' if `custom-buffer-verbose-help' is non-nil. |
| 733 | 727 | ||
| 734 | (defvar custom-commands | 728 | (defvar custom-commands |
| 735 | '((" Set for current session " Custom-set t | 729 | '((" Apply " Custom-set t |
| 736 | "Apply all settings in this buffer to the current session" | 730 | "Apply settings (for the current session only)" |
| 737 | "index" | 731 | "index" |
| 738 | "Apply") | 732 | "Apply") |
| 739 | (" Save for future sessions " Custom-save | 733 | (" Apply and Save " Custom-save |
| 740 | (or custom-file user-init-file) | 734 | (or custom-file user-init-file) |
| 741 | "Apply all settings in this buffer and save them for future Emacs sessions." | 735 | "Apply settings and save for future sessions." |
| 742 | "save" | 736 | "save" |
| 743 | "Save") | 737 | "Save") |
| 744 | (" Undo edits " Custom-reset-current t | 738 | (" Undo Edits " Custom-reset-current t |
| 745 | "Restore all settings in this buffer to reflect their current values." | 739 | "Restore customization buffer to reflect existing settings." |
| 746 | "refresh" | 740 | "refresh" |
| 747 | "Undo") | 741 | "Undo") |
| 748 | (" Reset to saved " Custom-reset-saved t | 742 | (" Reset Customizations " Custom-reset-saved t |
| 749 | "Restore all settings in this buffer to their saved values (if any)." | 743 | "Undo any settings applied only for the current session." |
| 750 | "undo" | 744 | "undo" |
| 751 | "Reset") | 745 | "Reset") |
| 752 | (" Erase customizations " Custom-reset-standard | 746 | (" Erase Customizations " Custom-reset-standard |
| 753 | (or custom-file user-init-file) | 747 | (or custom-file user-init-file) |
| 754 | "Un-customize all settings in this buffer and save them with standard values." | 748 | "Un-customize settings in this and future sessions." |
| 755 | "delete" | 749 | "delete" |
| 756 | "Uncustomize") | 750 | "Uncustomize") |
| 757 | (" Help for Customize " Custom-help t | 751 | (" Help for Customize " Custom-help t |
| @@ -766,9 +760,9 @@ groups after non-groups, if nil do not order groups at all." | |||
| 766 | (info "(emacs)Easy Customization")) | 760 | (info "(emacs)Easy Customization")) |
| 767 | 761 | ||
| 768 | (defvar custom-reset-menu | 762 | (defvar custom-reset-menu |
| 769 | '(("Undo Edits" . Custom-reset-current) | 763 | '(("Undo Edits in Customization Buffer" . Custom-reset-current) |
| 770 | ("Reset to Saved" . Custom-reset-saved) | 764 | ("Revert This Session's Customizations" . Custom-reset-saved) |
| 771 | ("Erase Customizations (use standard values)" . Custom-reset-standard)) | 765 | ("Erase Customizations" . Custom-reset-standard)) |
| 772 | "Alist of actions for the `Reset' button. | 766 | "Alist of actions for the `Reset' button. |
| 773 | The key is a string containing the name of the action, the value is a | 767 | The key is a string containing the name of the action, the value is a |
| 774 | Lisp function taking the widget as an element which will be called | 768 | Lisp function taking the widget as an element which will be called |
| @@ -901,7 +895,8 @@ making them as if they had never been customized at all." | |||
| 901 | (memq (widget-get widget :custom-state) | 895 | (memq (widget-get widget :custom-state) |
| 902 | '(modified set changed saved rogue)) | 896 | '(modified set changed saved rogue)) |
| 903 | (widget-apply widget :custom-mark-to-reset-standard))) | 897 | (widget-apply widget :custom-mark-to-reset-standard))) |
| 904 | "Erase all customizations for settings in this buffer? " t) | 898 | "The settings will revert to their default values, in this |
| 899 | and future sessions. Really erase customizations? " t) | ||
| 905 | (custom-reset-standard-save-and-update))) | 900 | (custom-reset-standard-save-and-update))) |
| 906 | 901 | ||
| 907 | ;;; The Customize Commands | 902 | ;;; The Customize Commands |
| @@ -1552,11 +1547,12 @@ that option." | |||
| 1552 | (switch-to-buffer-other-window (custom-get-fresh-buffer name)) | 1547 | (switch-to-buffer-other-window (custom-get-fresh-buffer name)) |
| 1553 | (custom-buffer-create-internal options description)) | 1548 | (custom-buffer-create-internal options description)) |
| 1554 | 1549 | ||
| 1555 | (defcustom custom-reset-button-menu nil | 1550 | (defcustom custom-reset-button-menu t |
| 1556 | "If non-nil, only show a single reset button in customize buffers. | 1551 | "If non-nil, only show a single reset button in customize buffers. |
| 1557 | This button will have a menu with all three reset operations." | 1552 | This button will have a menu with all three reset operations." |
| 1558 | :type 'boolean | 1553 | :type 'boolean |
| 1559 | :group 'custom-buffer) | 1554 | :group 'custom-buffer |
| 1555 | :version "24.2") | ||
| 1560 | 1556 | ||
| 1561 | (defcustom custom-buffer-verbose-help t | 1557 | (defcustom custom-buffer-verbose-help t |
| 1562 | "If non-nil, include explanatory text in the customization buffer." | 1558 | "If non-nil, include explanatory text in the customization buffer." |
| @@ -1651,29 +1647,30 @@ or a regular expression.") | |||
| 1651 | ;; So now the buttons are always inserted in the buffer. (Bug#1326) | 1647 | ;; So now the buttons are always inserted in the buffer. (Bug#1326) |
| 1652 | (if custom-buffer-verbose-help | 1648 | (if custom-buffer-verbose-help |
| 1653 | (widget-insert " | 1649 | (widget-insert " |
| 1654 | Operate on all settings in this buffer:\n")) | 1650 | Operate on all settings in this buffer:\n")) |
| 1655 | (let ((button (lambda (tag action active help _icon _label) | 1651 | (let ((button (lambda (tag action active help _icon _label) |
| 1656 | (widget-insert " ") | 1652 | (widget-insert " ") |
| 1657 | (if (eval active) | 1653 | (if (eval active) |
| 1658 | (widget-create 'push-button :tag tag | 1654 | (widget-create 'push-button :tag tag |
| 1659 | :help-echo help :action action)))) | 1655 | :help-echo help :action action)))) |
| 1660 | (commands custom-commands)) | 1656 | (commands custom-commands)) |
| 1661 | (apply button (pop commands)) ; Set for current session | ||
| 1662 | (apply button (pop commands)) ; Save for future sessions | ||
| 1663 | (if custom-reset-button-menu | 1657 | (if custom-reset-button-menu |
| 1664 | (progn | 1658 | (progn |
| 1665 | (widget-insert " ") | ||
| 1666 | (widget-create 'push-button | 1659 | (widget-create 'push-button |
| 1667 | :tag "Reset buffer" | 1660 | :tag " Revert... " |
| 1668 | :help-echo "Show a menu with reset operations." | 1661 | :help-echo "Show a menu with reset operations." |
| 1669 | :mouse-down-action 'ignore | 1662 | :mouse-down-action 'ignore |
| 1670 | :action 'custom-reset)) | 1663 | :action 'custom-reset) |
| 1664 | (apply button (pop commands)) ; Apply | ||
| 1665 | (apply button (pop commands))) ; Apply and Save | ||
| 1666 | (apply button (pop commands)) ; Apply | ||
| 1667 | (apply button (pop commands)) ; Apply and Save | ||
| 1671 | (widget-insert "\n") | 1668 | (widget-insert "\n") |
| 1672 | (apply button (pop commands)) ; Undo edits | 1669 | (apply button (pop commands)) ; Undo |
| 1673 | (apply button (pop commands)) ; Reset to saved | 1670 | (apply button (pop commands)) ; Reset |
| 1674 | (apply button (pop commands)) ; Erase customization | 1671 | (apply button (pop commands)) ; Erase |
| 1675 | (widget-insert " ") | 1672 | (widget-insert " ") |
| 1676 | (pop commands) ; Help (omitted) | 1673 | (pop commands) ; Help (omitted) |
| 1677 | (apply button (pop commands)))) ; Exit | 1674 | (apply button (pop commands)))) ; Exit |
| 1678 | (widget-insert "\n\n")) | 1675 | (widget-insert "\n\n")) |
| 1679 | 1676 | ||
| @@ -2824,7 +2821,7 @@ If STATE is nil, the value is computed by `custom-variable-state'." | |||
| 2824 | (lambda (widget) | 2821 | (lambda (widget) |
| 2825 | (and (default-boundp (widget-value widget)) | 2822 | (and (default-boundp (widget-value widget)) |
| 2826 | (memq (widget-get widget :custom-state) '(modified changed))))) | 2823 | (memq (widget-get widget :custom-state) '(modified changed))))) |
| 2827 | ("Reset to Saved" custom-variable-reset-saved | 2824 | ("Revert This Session's Customization" custom-variable-reset-saved |
| 2828 | (lambda (widget) | 2825 | (lambda (widget) |
| 2829 | (and (or (get (widget-value widget) 'saved-value) | 2826 | (and (or (get (widget-value widget) 'saved-value) |
| 2830 | (get (widget-value widget) 'saved-variable-comment)) | 2827 | (get (widget-value widget) 'saved-variable-comment)) |
| @@ -3620,7 +3617,7 @@ the present value is saved to its :shown-value property instead." | |||
| 3620 | ("Undo Edits" custom-redraw | 3617 | ("Undo Edits" custom-redraw |
| 3621 | (lambda (widget) | 3618 | (lambda (widget) |
| 3622 | (memq (widget-get widget :custom-state) '(modified changed)))) | 3619 | (memq (widget-get widget :custom-state) '(modified changed)))) |
| 3623 | ("Reset to Saved" custom-face-reset-saved | 3620 | ("Revert This Session's Customization" custom-face-reset-saved |
| 3624 | (lambda (widget) | 3621 | (lambda (widget) |
| 3625 | (or (get (widget-value widget) 'saved-face) | 3622 | (or (get (widget-value widget) 'saved-face) |
| 3626 | (get (widget-value widget) 'saved-face-comment)))) | 3623 | (get (widget-value widget) 'saved-face-comment)))) |
| @@ -3940,8 +3937,6 @@ restoring it to the state of a face that has never been customized." | |||
| 3940 | ;;; The `custom-group' Widget. | 3937 | ;;; The `custom-group' Widget. |
| 3941 | 3938 | ||
| 3942 | (defcustom custom-group-tag-faces nil | 3939 | (defcustom custom-group-tag-faces nil |
| 3943 | ;; In XEmacs, this ought to play games with font size. | ||
| 3944 | ;; Fixme: make it do so in Emacs. | ||
| 3945 | "Face used for group tags. | 3940 | "Face used for group tags. |
| 3946 | The first member is used for level 1 groups, the second for level 2, | 3941 | The first member is used for level 1 groups, the second for level 2, |
| 3947 | and so forth. The remaining group tags are shown with `custom-group-tag'." | 3942 | and so forth. The remaining group tags are shown with `custom-group-tag'." |
| @@ -3978,6 +3973,13 @@ and so forth. The remaining group tags are shown with `custom-group-tag'." | |||
| 3978 | :group 'custom-faces) | 3973 | :group 'custom-faces) |
| 3979 | (define-obsolete-face-alias 'custom-group-tag-face 'custom-group-tag "22.1") | 3974 | (define-obsolete-face-alias 'custom-group-tag-face 'custom-group-tag "22.1") |
| 3980 | 3975 | ||
| 3976 | (defface custom-group-subtitle | ||
| 3977 | `((t (:weight bold))) | ||
| 3978 | "Face for the \"Subgroups:\" subtitle in Custom buffers." | ||
| 3979 | :group 'custom-faces) | ||
| 3980 | |||
| 3981 | (defvar custom-group-doc-align-col 20) | ||
| 3982 | |||
| 3981 | (define-widget 'custom-group 'custom | 3983 | (define-widget 'custom-group 'custom |
| 3982 | "Customize group." | 3984 | "Customize group." |
| 3983 | :format "%v" | 3985 | :format "%v" |
| @@ -4043,11 +4045,9 @@ If GROUPS-ONLY non-nil, return only those members that are groups." | |||
| 4043 | (custom-browse-insert-prefix prefix) | 4045 | (custom-browse-insert-prefix prefix) |
| 4044 | (push (widget-create-child-and-convert | 4046 | (push (widget-create-child-and-convert |
| 4045 | widget 'custom-browse-visibility | 4047 | widget 'custom-browse-visibility |
| 4046 | ;; :tag-glyph "plus" | ||
| 4047 | :tag "+") | 4048 | :tag "+") |
| 4048 | buttons) | 4049 | buttons) |
| 4049 | (insert "-- ") | 4050 | (insert "-- ") |
| 4050 | ;; (widget-glyph-insert nil "-- " "horizontal") | ||
| 4051 | (push (widget-create-child-and-convert | 4051 | (push (widget-create-child-and-convert |
| 4052 | widget 'custom-browse-group-tag) | 4052 | widget 'custom-browse-group-tag) |
| 4053 | buttons) | 4053 | buttons) |
| @@ -4057,8 +4057,6 @@ If GROUPS-ONLY non-nil, return only those members that are groups." | |||
| 4057 | (zerop (length members))) | 4057 | (zerop (length members))) |
| 4058 | (custom-browse-insert-prefix prefix) | 4058 | (custom-browse-insert-prefix prefix) |
| 4059 | (insert "[ ]-- ") | 4059 | (insert "[ ]-- ") |
| 4060 | ;; (widget-glyph-insert nil "[ ]" "empty") | ||
| 4061 | ;; (widget-glyph-insert nil "-- " "horizontal") | ||
| 4062 | (push (widget-create-child-and-convert | 4060 | (push (widget-create-child-and-convert |
| 4063 | widget 'custom-browse-group-tag) | 4061 | widget 'custom-browse-group-tag) |
| 4064 | buttons) | 4062 | buttons) |
| @@ -4136,7 +4134,8 @@ If GROUPS-ONLY non-nil, return only those members that are groups." | |||
| 4136 | :action 'custom-toggle-parent | 4134 | :action 'custom-toggle-parent |
| 4137 | (not (eq state 'hidden))) | 4135 | (not (eq state 'hidden))) |
| 4138 | buttons)) | 4136 | buttons)) |
| 4139 | (insert " : ") | 4137 | (if (>= (current-column) custom-group-doc-align-col) |
| 4138 | (insert " ")) | ||
| 4140 | ;; Create magic button. | 4139 | ;; Create magic button. |
| 4141 | (let ((magic (widget-create-child-and-convert | 4140 | (let ((magic (widget-create-child-and-convert |
| 4142 | widget 'custom-magic nil))) | 4141 | widget 'custom-magic nil))) |
| @@ -4146,7 +4145,8 @@ If GROUPS-ONLY non-nil, return only those members that are groups." | |||
| 4146 | (widget-put widget :buttons buttons) | 4145 | (widget-put widget :buttons buttons) |
| 4147 | ;; Insert documentation. | 4146 | ;; Insert documentation. |
| 4148 | (if (and (eq custom-buffer-style 'links) (> level 1)) | 4147 | (if (and (eq custom-buffer-style 'links) (> level 1)) |
| 4149 | (widget-put widget :documentation-indent 0)) | 4148 | (widget-put widget :documentation-indent |
| 4149 | custom-group-doc-align-col)) | ||
| 4150 | (widget-add-documentation-string-button | 4150 | (widget-add-documentation-string-button |
| 4151 | widget :visibility-widget 'custom-visibility)) | 4151 | widget :visibility-widget 'custom-visibility)) |
| 4152 | 4152 | ||
| @@ -4224,25 +4224,34 @@ If GROUPS-ONLY non-nil, return only those members that are groups." | |||
| 4224 | (count 0) | 4224 | (count 0) |
| 4225 | (reporter (make-progress-reporter | 4225 | (reporter (make-progress-reporter |
| 4226 | "Creating group entries..." 0 len)) | 4226 | "Creating group entries..." 0 len)) |
| 4227 | (have-subtitle (and (not (eq symbol 'emacs)) | ||
| 4228 | (eq custom-buffer-order-groups 'last))) | ||
| 4229 | prev-type | ||
| 4227 | children) | 4230 | children) |
| 4228 | (setq children | 4231 | |
| 4229 | (mapcar | 4232 | (dolist (entry members) |
| 4230 | (lambda (entry) | 4233 | (unless (eq prev-type 'custom-group) |
| 4231 | (widget-insert "\n") | 4234 | (widget-insert "\n")) |
| 4232 | (progress-reporter-update reporter (setq count (1+ count))) | 4235 | (progress-reporter-update reporter (setq count (1+ count))) |
| 4233 | (let ((sym (nth 0 entry)) | 4236 | (let ((sym (nth 0 entry)) |
| 4234 | (type (nth 1 entry))) | 4237 | (type (nth 1 entry))) |
| 4235 | (prog1 | 4238 | (when (and have-subtitle (eq type 'custom-group)) |
| 4236 | (widget-create-child-and-convert | 4239 | (setq have-subtitle nil) |
| 4237 | widget type | 4240 | (widget-insert |
| 4238 | :group widget | 4241 | (propertize "Subgroups:\n" 'face 'custom-group-subtitle))) |
| 4239 | :tag (custom-unlispify-tag-name sym) | 4242 | (setq prev-type type) |
| 4240 | :custom-prefixes custom-prefix-list | 4243 | (push (widget-create-child-and-convert |
| 4241 | :custom-level (1+ level) | 4244 | widget type |
| 4242 | :value sym) | 4245 | :group widget |
| 4243 | (unless (eq (preceding-char) ?\n) | 4246 | :tag (custom-unlispify-tag-name sym) |
| 4244 | (widget-insert "\n"))))) | 4247 | :custom-prefixes custom-prefix-list |
| 4245 | members)) | 4248 | :custom-level (1+ level) |
| 4249 | :value sym) | ||
| 4250 | children) | ||
| 4251 | (unless (eq (preceding-char) ?\n) | ||
| 4252 | (widget-insert "\n")))) | ||
| 4253 | |||
| 4254 | (setq children (nreverse children)) | ||
| 4246 | (mapc 'custom-magic-reset children) | 4255 | (mapc 'custom-magic-reset children) |
| 4247 | (widget-put widget :children children) | 4256 | (widget-put widget :children children) |
| 4248 | (custom-group-state-update widget) | 4257 | (custom-group-state-update widget) |
| @@ -4267,7 +4276,7 @@ If GROUPS-ONLY non-nil, return only those members that are groups." | |||
| 4267 | ("Undo Edits" custom-group-reset-current | 4276 | ("Undo Edits" custom-group-reset-current |
| 4268 | (lambda (widget) | 4277 | (lambda (widget) |
| 4269 | (memq (widget-get widget :custom-state) '(modified)))) | 4278 | (memq (widget-get widget :custom-state) '(modified)))) |
| 4270 | ("Reset to Saved" custom-group-reset-saved | 4279 | ("Revert This Session's Customizations" custom-group-reset-saved |
| 4271 | (lambda (widget) | 4280 | (lambda (widget) |
| 4272 | (memq (widget-get widget :custom-state) '(modified set)))) | 4281 | (memq (widget-get widget :custom-state) '(modified set)))) |
| 4273 | ,@(when (or custom-file init-file-user) | 4282 | ,@(when (or custom-file init-file-user) |