mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
Improvements to the Custom interface.
* cus-edit.el: Resort topmost custom groups. (custom-buffer-sort-alphabetically): Default to t. (customize-apropos): Use apropos-parse-pattern. (custom-search-field): New var. (custom-buffer-create-internal): Add custom-apropos search field. (custom-add-parent-links): Don't display parent doc. (custom-group-value-create): Don't sort top-level custom group. (custom-magic-value-create): Show visibility button before option name. (custom-variable-state): New fun, from custom-variable-state-set. (custom-variable-state-set): Use it. (custom-group-value-create): Hide options with standard values using the :hidden-states property. Use progress reporter. (custom-show): Simplify. (custom-visibility): Disable images by default. (custom-variable): New property :hidden-states. (custom-variable-value-create): Enable images for custom-visibility widgets. Use :hidden-states property to determine initial visibility. * wid-edit.el (widget-image-find): Give images center ascent. (visibility): Add :on-image and :off-image properties. (widget-visibility-value-create): Use them.
This commit is contained in:
parent
e3c5dd1188
commit
647f999385
3 changed files with 377 additions and 317 deletions
|
|
@ -639,8 +639,7 @@ extension (xpm, xbm, gif, jpg, or png) located in
|
|||
(dolist (elt widget-image-conversion)
|
||||
(dolist (ext (cdr elt))
|
||||
(push (list :type (car elt) :file (concat image ext)) specs)))
|
||||
(setq specs (nreverse specs))
|
||||
(find-image specs)))
|
||||
(find-image (nreverse specs))))
|
||||
(t
|
||||
;; Oh well.
|
||||
nil)))
|
||||
|
|
@ -2806,11 +2805,19 @@ Return an alist of (TYPE MATCH)."
|
|||
;;; The `visibility' Widget.
|
||||
|
||||
(define-widget 'visibility 'item
|
||||
"An indicator and manipulator for hidden items."
|
||||
"An indicator and manipulator for hidden items.
|
||||
|
||||
The following properties have special meanings for this widget:
|
||||
:on-image Image filename or spec to display when the item is visible.
|
||||
:on Text shown if the \"on\" image is nil or cannot be displayed.
|
||||
:off-image Image filename or spec to display when the item is hidden.
|
||||
:off Text shown if the \"off\" image is nil cannot be displayed."
|
||||
:format "%[%v%]"
|
||||
:button-prefix ""
|
||||
:button-suffix ""
|
||||
:on-image "down"
|
||||
:on "Hide"
|
||||
:off-image "right"
|
||||
:off "Show"
|
||||
:value-create 'widget-visibility-value-create
|
||||
:action 'widget-toggle-action
|
||||
|
|
@ -2818,21 +2825,17 @@ Return an alist of (TYPE MATCH)."
|
|||
|
||||
(defun widget-visibility-value-create (widget)
|
||||
;; Insert text representing the `on' and `off' states.
|
||||
(let ((on (widget-get widget :on))
|
||||
(off (widget-get widget :off)))
|
||||
(if on
|
||||
(setq on (concat widget-push-button-prefix
|
||||
on
|
||||
widget-push-button-suffix))
|
||||
(setq on ""))
|
||||
(if off
|
||||
(setq off (concat widget-push-button-prefix
|
||||
off
|
||||
widget-push-button-suffix))
|
||||
(setq off ""))
|
||||
(if (widget-value widget)
|
||||
(widget-image-insert widget on "down" "down-pushed")
|
||||
(widget-image-insert widget off "right" "right-pushed"))))
|
||||
(let* ((val (widget-value widget))
|
||||
(text (widget-get widget (if val :on :off)))
|
||||
(img (widget-image-find
|
||||
(widget-get widget (if val :on-image :off-image)))))
|
||||
(widget-image-insert widget
|
||||
(if text
|
||||
(concat widget-push-button-prefix text
|
||||
widget-push-button-suffix)
|
||||
"")
|
||||
(if img
|
||||
(append img '(:ascent center))))))
|
||||
|
||||
;;; The `documentation-link' Widget.
|
||||
;;
|
||||
|
|
@ -2935,7 +2938,7 @@ link for that string."
|
|||
(widget-create-child-and-convert
|
||||
widget (widget-get widget :visibility-widget)
|
||||
:help-echo "Show or hide rest of the documentation."
|
||||
:on "Hide Rest"
|
||||
:on "Hide"
|
||||
:off "More"
|
||||
:always-active t
|
||||
:action 'widget-parent-action
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue