Function: widget-editable-list-delete-at

widget-editable-list-delete-at is a byte-compiled function defined in wid-edit.el.gz.

Signature

(widget-editable-list-delete-at WIDGET CHILD)

Documentation

Delete the widget CHILD from the known children of widget WIDGET.

Save CHILD into the :last-deleted list, so it can be inserted later.

Source Code

;; Defined in /usr/src/emacs/lisp/wid-edit.el.gz
(defun widget-editable-list-delete-at (widget child)
  "Delete the widget CHILD from the known children of widget WIDGET.

Save CHILD into the :last-deleted list, so it can be inserted later."
  ;; Save the current value of CHILD, to use if the user later inserts the
  ;; widget.
  (widget-put child :value (widget-apply child :value-get))
  (let ((lst (widget-get widget :last-deleted)))
    (push child lst)
    (widget-put widget :last-deleted lst))
  ;; Delete child from list of children.
  (save-excursion
    (let ((buttons (copy-sequence (widget-get widget :buttons)))
	  button
	  (inhibit-read-only t)
	  (inhibit-modification-hooks t))
      (while buttons
	(setq button (car buttons)
	      buttons (cdr buttons))
	(when (eq (widget-get button :widget) child)
	  (widget-put widget
		      :buttons (delq button (widget-get widget :buttons)))
	  (widget-delete button))))
    (let ((entry-from (widget-get child :entry-from))
	  (entry-to (widget-get child :entry-to))
	  (inhibit-read-only t)
	  (inhibit-modification-hooks t))
      (widget-delete child)
      (delete-region entry-from entry-to)
      (set-marker entry-from nil)
      (set-marker entry-to nil))
    (widget-put widget :children (delq child (widget-get widget :children))))
  (widget-setup)
  (widget-apply widget :notify widget))