Commit 192e44fc authored by Juri Linkov's avatar Juri Linkov
Browse files

(custom-buffer-create-internal): Use widget type

`custom-manual' instead of `info-link' and don't set properties
`button-face' and `mouse-face' explicitly.
(custom-browse-group-tag, custom-browse-variable-tag)
(custom-browse-face-tag): Inherit from widget class
`custom-group-link' instead of `push-button'.
(custom-button-unraised): Inherit from `underline' face.
(custom-link): Inherit from `link' face.  Fix doc and group.
(custom-add-parent-links, custom-group-value-create): Don't set
properties `button-face' and `mouse-face' explicitly for
`custom-group-link' widget.
(custom-group-link): Add properties `button-face' and `mouse-face'
to widget definition.
(custom-field-keymap): New variable.  Put `custom-field-keymap' to
editable-field's :keymap property.
(custom-mode): Fix docstring: substitute keybindings for
`widget-forward' and `widget-backward' from `widget-keymap',
`widget-complete' from `custom-field-keymap', replace old
`Custom-move-and-invoke' with `widget-move-and-invoke'.  Untabify.
parent de8ad208
...@@ -1470,18 +1470,14 @@ See " ...@@ -1470,18 +1470,14 @@ See "
(if custom-raised-buttons (if custom-raised-buttons
"`Raised' text indicates" "`Raised' text indicates"
"Square brackets indicate"))) "Square brackets indicate")))
(widget-create 'info-link (widget-create 'custom-manual
:tag "Custom file" :tag "Custom file"
:button-face 'custom-link
:mouse-face 'highlight
"(emacs)Saving Customizations") "(emacs)Saving Customizations")
(widget-insert (widget-insert
" for information on how to save in a different file.\n " for information on how to save in a different file.\n
See ") See ")
(widget-create 'info-link (widget-create 'custom-manual
:tag "Help" :tag "Help"
:button-face 'custom-link
:mouse-face 'highlight
:help-echo "Read the online help." :help-echo "Read the online help."
"(emacs)Easy Customization") "(emacs)Easy Customization")
(widget-insert " for more information.\n\n") (widget-insert " for more information.\n\n")
...@@ -1497,10 +1493,8 @@ Make your editing in this buffer take effect for this session." ...@@ -1497,10 +1493,8 @@ Make your editing in this buffer take effect for this session."
(if (not custom-buffer-verbose-help) (if (not custom-buffer-verbose-help)
(progn (progn
(widget-insert " ") (widget-insert " ")
(widget-create 'info-link (widget-create 'custom-manual
:tag "Help" :tag "Help"
:button-face 'custom-link
:mouse-face 'highlight
:help-echo "Read the online help." :help-echo "Read the online help."
"(emacs)Easy Customization"))) "(emacs)Easy Customization")))
(when (or custom-file user-init-file) (when (or custom-file user-init-file)
...@@ -1648,7 +1642,7 @@ item in another window.\n\n")) ...@@ -1648,7 +1642,7 @@ item in another window.\n\n"))
(let ((custom-buffer-style 'tree)) (let ((custom-buffer-style 'tree))
(custom-toggle-parent widget))) (custom-toggle-parent widget)))
(define-widget 'custom-browse-group-tag 'push-button (define-widget 'custom-browse-group-tag 'custom-group-link
"Show parent in other window when activated." "Show parent in other window when activated."
:tag "Group" :tag "Group"
:tag-glyph "folder" :tag-glyph "folder"
...@@ -1658,7 +1652,7 @@ item in another window.\n\n")) ...@@ -1658,7 +1652,7 @@ item in another window.\n\n"))
(let ((parent (widget-get widget :parent))) (let ((parent (widget-get widget :parent)))
(customize-group-other-window (widget-value parent)))) (customize-group-other-window (widget-value parent))))
(define-widget 'custom-browse-variable-tag 'push-button (define-widget 'custom-browse-variable-tag 'custom-group-link
"Show parent in other window when activated." "Show parent in other window when activated."
:tag "Option" :tag "Option"
:tag-glyph "option" :tag-glyph "option"
...@@ -1668,7 +1662,7 @@ item in another window.\n\n")) ...@@ -1668,7 +1662,7 @@ item in another window.\n\n"))
(let ((parent (widget-get widget :parent))) (let ((parent (widget-get widget :parent)))
(customize-variable-other-window (widget-value parent)))) (customize-variable-other-window (widget-value parent))))
(define-widget 'custom-browse-face-tag 'push-button (define-widget 'custom-browse-face-tag 'custom-group-link
"Show parent in other window when activated." "Show parent in other window when activated."
:tag "Face" :tag "Face"
:tag-glyph "face" :tag-glyph "face"
...@@ -2010,13 +2004,7 @@ and `face'." ...@@ -2010,13 +2004,7 @@ and `face'."
:group 'custom-faces) :group 'custom-faces)
(defface custom-button-unraised (defface custom-button-unraised
'((((min-colors 88) '((t :inherit underline))
(class color) (background light)) :foreground "blue1" :underline t)
(((class color) (background light)) :foreground "blue" :underline t)
(((min-colors 88)
(class color) (background dark)) :foreground "cyan1" :underline t)
(((class color) (background dark)) :foreground "cyan" :underline t)
(t :underline t))
"Face for custom buffer buttons if `custom-raised-buttons' is nil." "Face for custom buffer buttons if `custom-raised-buttons' is nil."
:version "22.1" :version "22.1"
:group 'custom-faces) :group 'custom-faces)
...@@ -2071,15 +2059,10 @@ and `face'." ...@@ -2071,15 +2059,10 @@ and `face'."
(put 'custom-state-face 'face-alias 'custom-state) (put 'custom-state-face 'face-alias 'custom-state)
(defface custom-link (defface custom-link
'((((min-colors 88) '((t :inherit link))
(class color) (background light)) :foreground "blue1" :underline t) "Face for links in customization buffers."
(((class color) (background light)) :foreground "blue" :underline t) :version "22.1"
(((min-colors 88) :group 'custom-faces)
(class color) (background dark)) :foreground "cyan1" :underline t)
(((class color) (background dark)) :foreground "cyan" :underline t)
(t :underline t))
"Face for Info links in customization buffers."
:group 'info)
(define-widget 'custom 'default (define-widget 'custom 'default
"Customize a user option." "Customize a user option."
...@@ -2246,8 +2229,6 @@ If INITIAL-STRING is non-nil, use that rather than \"Parent groups:\"." ...@@ -2246,8 +2229,6 @@ If INITIAL-STRING is non-nil, use that rather than \"Parent groups:\"."
(insert " ") (insert " ")
(push (widget-create-child-and-convert (push (widget-create-child-and-convert
widget 'custom-group-link widget 'custom-group-link
:button-face 'custom-link
:mouse-face 'highlight
:tag (custom-unlispify-tag-name symbol) :tag (custom-unlispify-tag-name symbol)
symbol) symbol)
buttons) buttons)
...@@ -3607,6 +3588,8 @@ restoring it to the state of a face that has never been customized." ...@@ -3607,6 +3588,8 @@ restoring it to the state of a face that has never been customized."
(define-widget 'custom-group-link 'link (define-widget 'custom-group-link 'link
"Show parent in other window when activated." "Show parent in other window when activated."
:button-face 'custom-link
:mouse-face 'highlight
:help-echo "Create customization buffer for this group." :help-echo "Create customization buffer for this group."
:action 'custom-group-link-action) :action 'custom-group-link-action)
...@@ -3805,8 +3788,6 @@ If GROUPS-ONLY non-nil, return only those members that are groups." ...@@ -3805,8 +3788,6 @@ If GROUPS-ONLY non-nil, return only those members that are groups."
(if (eq custom-buffer-style 'links) (if (eq custom-buffer-style 'links)
(push (widget-create-child-and-convert (push (widget-create-child-and-convert
widget 'custom-group-link widget 'custom-group-link
:button-face 'custom-link
:mouse-face 'highlight
:tag "Go to Group" :tag "Go to Group"
symbol) symbol)
buttons) buttons)
...@@ -4400,6 +4381,15 @@ The format is suitable for use with `easy-menu-define'." ...@@ -4400,6 +4381,15 @@ The format is suitable for use with `easy-menu-define'."
["Erase Customization" Custom-reset-standard t] ["Erase Customization" Custom-reset-standard t]
["Info" (info "(emacs)Easy Customization") t])) ["Info" (info "(emacs)Easy Customization") t]))
(defvar custom-field-keymap
(let ((map (copy-keymap widget-field-keymap)))
(define-key map "\C-c\C-c" 'Custom-set)
(define-key map "\C-x\C-s" 'Custom-save)
map)
"Keymap used inside editable fields in customization buffers.")
(widget-put (get 'editable-field 'widget-type) :keymap custom-field-keymap)
(defun Custom-goto-parent () (defun Custom-goto-parent ()
"Go to the parent group listed at the top of this buffer. "Go to the parent group listed at the top of this buffer.
If several parents are listed, go to the first of them." If several parents are listed, go to the first of them."
...@@ -4425,17 +4415,18 @@ If several parents are listed, go to the first of them." ...@@ -4425,17 +4415,18 @@ If several parents are listed, go to the first of them."
The following commands are available: The following commands are available:
Move to next button or editable field. \\[widget-forward] \\<widget-keymap>\
Move to previous button or editable field. \\[widget-backward] Move to next button, link or editable field. \\[widget-forward]
\\<widget-field-keymap>\ Move to previous button, link or editable field. \\[widget-backward]
\\<custom-field-keymap>\
Complete content of editable text field. \\[widget-complete] Complete content of editable text field. \\[widget-complete]
\\<custom-mode-map>\ \\<custom-mode-map>\
Invoke button under the mouse pointer. \\[Custom-move-and-invoke] Invoke button under the mouse pointer. \\[widget-move-and-invoke]
Invoke button under point. \\[widget-button-press] Invoke button under point. \\[widget-button-press]
Set all options from current text. \\[Custom-set] Set all options from current text. \\[Custom-set]
Make values in current text permanent. \\[Custom-save] Make values in current text permanent. \\[Custom-save]
Make text match actual option values. \\[Custom-reset-current] Make text match actual option values. \\[Custom-reset-current]
Reset options to permanent settings. \\[Custom-reset-saved] Reset options to permanent settings. \\[Custom-reset-saved]
Erase customizations; set options Erase customizations; set options
and buffer text to the standard values. \\[Custom-reset-standard] and buffer text to the standard values. \\[Custom-reset-standard]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment