Function: custom-toggle-hide-variable
custom-toggle-hide-variable is a byte-compiled function defined in
cus-edit.el.gz.
Signature
(custom-toggle-hide-variable VISIBILITY-WIDGET &rest IGNORE)
Documentation
Toggle the visibility of a custom-variable parent widget.
By default, this signals an error if the parent has unsaved
changes. If the parent has a simple :custom-style property,
the present value is saved to its :shown-value property instead.
Source Code
;; Defined in /usr/src/emacs/lisp/cus-edit.el.gz
(defun custom-toggle-hide-variable (visibility-widget &rest _ignore)
"Toggle the visibility of a `custom-variable' parent widget.
By default, this signals an error if the parent has unsaved
changes. If the parent has a `simple' :custom-style property,
the present value is saved to its :shown-value property instead."
(let ((widget (widget-get visibility-widget :parent)))
(unless (eq (widget-type widget) 'custom-variable)
(error "Invalid widget type"))
(custom-load-widget widget)
(let ((state (widget-get widget :custom-state)))
(if (eq state 'hidden)
(widget-put widget :custom-state 'unknown)
;; In normal interface, widget can't be hidden if modified.
(when (memq state '(invalid modified set))
(if (eq (widget-get widget :custom-style) 'simple)
(widget-put widget :shown-value
(list (widget-value
(car-safe
(widget-get widget :children)))))
(message "Note: There are unsaved changes")))
(widget-put widget :documentation-shown nil)
(widget-put widget :custom-state 'hidden))
(custom-redraw widget)
(widget-setup))))