Function: custom-toggle-hide-icon

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

Signature

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

Documentation

Toggle the visibility of a custom-icon parent widget.

By default, this signals an error if the parent has unsaved changes.

Source Code

;; Defined in /usr/src/emacs/lisp/cus-edit.el.gz
(defun custom-toggle-hide-icon (visibility-widget &rest _ignore)
  "Toggle the visibility of a `custom-icon' parent widget.
By default, this signals an error if the parent has unsaved
changes."
  (let ((widget (widget-get visibility-widget :parent)))
    (unless (eq (widget-type widget) 'custom-icon)
      (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))
	  (error "There are unsaved changes"))
	(widget-put widget :custom-state 'hidden))
      (custom-redraw widget)
      (widget-setup))))