Function: allout-widgets-exposure-change-processor
allout-widgets-exposure-change-processor is a byte-compiled function
defined in allout-widgets.el.gz.
Signature
(allout-widgets-exposure-change-processor CHANGES)
Documentation
Widgetize and adjust item widgets tracking allout outline exposure changes.
Generally invoked via allout-exposure-change-functions.
Source Code
;; Defined in /usr/src/emacs/lisp/allout-widgets.el.gz
;;;_ > allout-widgets-exposure-change-processor (changes)
(defun allout-widgets-exposure-change-processor (changes)
"Widgetize and adjust item widgets tracking allout outline exposure changes.
Generally invoked via `allout-exposure-change-functions'."
(let ((changes (sort changes (lambda (this next)
(< (cadr this) (cadr next)))))
;; have to distinguish between concealing and exposing so that, eg,
;; `allout-expose-topic's mix is handled properly.
handled-expose
handled-conceal
covered
deactivate-mark)
(dolist (change changes)
(let ((from (cadr change))
bucket
(to (caddr change))
(flag (cadddr change))
parent)
;; swap from and to:
(if (< to from) (setq bucket to
to from
from bucket))
;; have we already handled exposure changes in this region?
(cl-callf (lambda (x)
(let ((got (allout-range-overlaps from to x)))
(setq covered (car got))
(cadr got)))
(if flag handled-conceal handled-expose))
(when (not covered)
(save-excursion
(goto-char from)
(cond
;; collapsing:
(flag
(allout-widgets-undecorate-region from to)
(allout-beginning-of-current-line)
(let ((widget (allout-get-item-widget)))
(if (not widget)
(allout-get-or-create-item-widget)
(widget-apply widget :redecorate))))
;; expanding:
(t
(while (< (point) to)
(allout-beginning-of-current-line)
(setq parent (allout-get-item-widget))
(if (not parent)
(setq parent (allout-get-or-create-item-widget))
(widget-apply parent :redecorate))
(allout-next-visible-heading 1)
(if (widget-get parent :has-subitems)
(allout-redecorate-visible-subtree parent))
(if (> (point) to)
;; subtree may be well beyond to - incorporate in ranges:
(setq handled-expose
(allout-range-overlaps from (point) handled-expose)
covered (car handled-expose)
handled-expose (cadr handled-expose)))
(allout-next-visible-heading 1))))))))))