Function: allout-parse-item-at-point
allout-parse-item-at-point is a byte-compiled function defined in
allout-widgets.el.gz.
Signature
(allout-parse-item-at-point ITEM-WIDGET &optional AT-BEGINNING BLANK-CONTAINER)
Documentation
Set widget ITEM-WIDGET layout parameters per item-at-point's actual layout.
If optional AT-BEGINNING is t, then point is assumed to be at the start of the item prefix.
If optional BLANK-CONTAINER is true, then the parameters of a container which has an empty body are set. (Though the body is blank, the object may have subitems.)
Source Code
;; Defined in /usr/src/emacs/lisp/allout-widgets.el.gz
;;;_ > allout-parse-item-at-point (item-widget &optional at-beginning
;;; blank-container)
(defun allout-parse-item-at-point (item-widget &optional at-beginning
blank-container)
"Set widget ITEM-WIDGET layout parameters per item-at-point's actual layout.
If optional AT-BEGINNING is t, then point is assumed to be at the start of
the item prefix.
If optional BLANK-CONTAINER is true, then the parameters of a container
which has an empty body are set. (Though the body is blank, the object
may have subitems.)"
;; Uncomment this sit-for to notice where decoration is happening:
;; (sit-for .1)
(let* ((depth (allout-depth))
(depth (if blank-container 0 depth))
(is-container (or blank-container (zerop depth)))
(does-encrypt (and (not is-container)
(allout-encrypted-type-prefix)))
(is-encrypted (and does-encrypt (allout-encrypted-topic-p)))
(icon-end allout-recent-prefix-end)
(icon-start (1- icon-end))
body-start
body-end
has-subitems
)
(widget-put item-widget :depth depth)
(if is-container
(progn
(widget-put item-widget :from (allout-set-boundary-marker
:from (point-min)
(widget-get item-widget :from)))
(widget-put item-widget :icon-end nil)
(widget-put item-widget :icon-start nil)
(setq body-start (widget-put item-widget :body-start 1)))
;; not container:
(widget-put item-widget :from (allout-set-boundary-marker
:from (if at-beginning
(point)
allout-recent-prefix-beginning)
(widget-get item-widget :from)))
(widget-put item-widget :icon-start icon-start)
(widget-put item-widget :icon-end icon-end)
(when does-encrypt
(widget-put item-widget :does-encrypt t)
(widget-put item-widget :is-encrypted is-encrypted))
;; cue area:
(setq body-start icon-end)
(widget-put item-widget :bullet (allout-get-bullet))
(if (equal (char-after body-start) ? )
(setq body-start (1+ body-start)))
(widget-put item-widget :body-start body-start)
)
;; Both container and regular items:
;; :body-end (doesn't include a trailing blank line, if any) -
(widget-put item-widget :body-end (setq body-end
(if blank-container
1
(allout-end-of-entry))))
(widget-put item-widget :to (allout-set-boundary-marker
:to (if blank-container
(point-min)
(or (allout-pre-next-prefix)
(goto-char (point-max))))
(widget-get item-widget :to)))
(widget-put item-widget :has-subitems
(setq has-subitems
(and
;; has a subsequent item:
(not (= body-end (point-max)))
;; subsequent item is deeper:
(< depth (allout-recent-depth)))))
;; note :expanded - true if widget item's content is currently visible?
(widget-put item-widget :expanded
(and has-subitems
;; subsequent item is or isn't visible:
(save-excursion
(goto-char allout-recent-prefix-beginning)
(not (allout-hidden-p)))))))