Function: allout-widgets-before-change-handler

allout-widgets-before-change-handler is a byte-compiled function defined in allout-widgets.el.gz.

Signature

(allout-widgets-before-change-handler BEG END)

Documentation

Business to be done before changes in a widgetized allout outline.

Source Code

;; Defined in /usr/src/emacs/lisp/allout-widgets.el.gz
;;;_   , major change handlers:
;;;_    > allout-widgets-before-change-handler
(defun allout-widgets-before-change-handler (beg end)
  "Business to be done before changes in a widgetized allout outline."
  ;; protect against unruly edits to structure:
  (cond
   (undo-in-progress (when (eq (get-text-property beg 'category)
                               'allout-icon-span-category)
                       (save-excursion
                         (goto-char beg)
                         (let* ((item-widget (allout-get-item-widget)))
                           (if item-widget
                               (allout-widgets-exposure-undo-recorder
                                item-widget))))))
   (inhibit-read-only t)
   ((not  (and (boundp 'allout-mode) allout-mode)) t)
   ((equal this-command 'quoted-insert) t)
   ((not (text-property-any beg (if (equal end beg)
                                    (min (1+ beg) (point-max))
                                  end)
                            'field 'structure))
    t)
   ((yes-or-no-p "Unruly edit of outline structure - allow? ")
    (setq allout-widgets-unset-inhibit-read-only (not inhibit-read-only)
          inhibit-read-only t))
   (t
    ;; tell the allout-widgets-post-command-business to reestablish the hook:
    (setq allout-widgets-reenable-before-change-handler t)
    ;; and raise an error to prevent the edit (and disable the hook):
    (error "%s"
     (substitute-command-keys allout-structure-unruly-deletion-message)))))