Function: allout-overlay-interior-modification-handler

allout-overlay-interior-modification-handler is a byte-compiled function defined in allout.el.gz.

Signature

(allout-overlay-interior-modification-handler OL AFTER BEG END &optional PRELEN)

Documentation

Get confirmation before making arbitrary changes to invisible text.

We expose the invisible text and ask for confirmation. Refusal or keyboard-quit abandons the changes, with keyboard-quit additionally reclosing the opened text.

No confirmation is necessary when inhibit-read-only is set -- eg, allout internal functions use this feature cohesively bunch changes.

Source Code

;; Defined in /usr/src/emacs/lisp/allout.el.gz
;;;_  > allout-overlay-interior-modification-handler (ol after beg end
;;;                                                      &optional prelen)
(defun allout-overlay-interior-modification-handler (ol after beg end
                                                        &optional _prelen)
  "Get confirmation before making arbitrary changes to invisible text.

We expose the invisible text and ask for confirmation.  Refusal or
`keyboard-quit' abandons the changes, with keyboard-quit additionally
reclosing the opened text.

No confirmation is necessary when `inhibit-read-only' is set -- eg, allout
internal functions use this feature cohesively bunch changes."

  (when (and (not inhibit-read-only) (not after))
    (let ((start (point))
          (ol-start (overlay-start ol))
          (ol-end (overlay-end ol))
          first)
      (goto-char beg)
      (while (< (point) end)
        (when (allout-hidden-p)
          (allout-show-to-offshoot)
          (if (allout-hidden-p)
              (save-excursion (forward-char 1)
                              (allout-show-to-offshoot)))
          (when (not first)
            (setq first (point))))
        (goto-char (next-char-property-change (1+ (point)) end)))
      (when first
        (goto-char first)
        (condition-case nil
            (if (not
                 (yes-or-no-p
                  (substitute-command-keys
                   (concat "Modify concealed text?  (\"no\" just aborts,"
                           " \\[keyboard-quit] also reconceals) "))))
                (progn (goto-char start)
                       (error "Concealed-text change refused")))
          (quit (allout-flag-region ol-start ol-end nil)
                (allout-flag-region ol-start ol-end t)
                (error "Concealed-text change abandoned, text reconcealed"))))
      (goto-char start))))