Function: custom-toggle-hide-face

custom-toggle-hide-face is a byte-compiled function defined in cus-edit.el.gz.

Signature

(custom-toggle-hide-face VISIBILITY-WIDGET &rest IGNORE)

Documentation

Toggle the visibility of a custom-face 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-face (visibility-widget &rest _ignore)
  "Toggle the visibility of a `custom-face' 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-face)
      (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
			  (custom-face-widget-to-spec widget))
	    (error "There are unsaved changes")))
	(widget-put widget :documentation-shown nil)
	(widget-put widget :custom-state 'hidden))
      (custom-redraw widget)
      (widget-setup))))