Function: allout-get-item-widget

allout-get-item-widget is a byte-compiled function defined in allout-widgets.el.gz.

Signature

(allout-get-item-widget &optional CONTAINER)

Documentation

Return the widget for the item at point, or nil if no widget yet exists.

Point must be situated *before* the start of the target item's body, so we don't get an existing containing item when we're in the process of creating an item in the middle of another.

Optional CONTAINER is used to obtain the container item.

Source Code

;; Defined in /usr/src/emacs/lisp/allout-widgets.el.gz
;;;_  : Item widget retrieval (/ high-level creation):
;;;_   > allout-get-item-widget (&optional container)
(defun allout-get-item-widget (&optional container)
  "Return the widget for the item at point, or nil if no widget yet exists.

Point must be situated *before* the start of the target item's
body, so we don't get an existing containing item when we're in
the process of creating an item in the middle of another.

Optional CONTAINER is used to obtain the container item."
  (if (or container (zerop (allout-depth)))
      allout-container-item-widget
    ;; allout-recent-* are calibrated by (allout-depth) if we got here.
    (let ((got (widget-at allout-recent-prefix-beginning)))
      (if (and got (listp got))
          (if (marker-position (widget-get got :from))
              (and
               (>= (point) (widget-apply got :actual-position :from))
               (<= (point) (widget-apply got :actual-position :body-start))
               got)
            ;; a wacky residual item - undecorate and disregard:
            (allout-widgets-undecorate-item got)
            nil)))))