;; Author: Ken Manheimer <ken dot manheimer at gmail...>
;; Maintainer: Ken Manheimer <ken dot manheimer at gmail...>
;; Author: Ken Manheimer <ken dot manheimer at gmail...>
;; Maintainer: Ken Manheimer <ken dot manheimer at gmail...>
(defvar allout-widgets-tally nil
"Hash-table of existing allout widgets, for debugging.
(defvar allout-widgets-tally nil
"Hash-table of existing allout widgets, for debugging.
The table contents will be out of sync if any widgets are created
or deleted while this variable is nil.")
The table contents will be out of sync if any widgets are created
or deleted while this variable is nil.")
"If non-nil, show cursor position of each item decoration.
This is for debugging purposes, and generally set at need in a
"If non-nil, show cursor position of each item decoration.
This is for debugging purposes, and generally set at need in a
-buffer rather than as a prevailing configuration \(but it's handy
-to publicize it by making it a customization variable\)."
+buffer rather than as a prevailing configuration (but it's handy
+to publicize it by making it a customization variable)."
"Cache allout icon images, as an association list.
`allout-fetch-icon-image' uses this cache transparently, keying
"Cache allout icon images, as an association list.
`allout-fetch-icon-image' uses this cache transparently, keying
found on the `load-path') and the icon name.
Set this variable to `nil' to empty the cache, and have it replenish from the
found on the `load-path') and the icon name.
Set this variable to `nil' to empty the cache, and have it replenish from the
;;;_ = allout-span-to-category
(defvar allout-span-to-category
'((:guides-span . allout-guides-span-category)
;;;_ = allout-span-to-category
(defvar allout-span-to-category
'((:guides-span . allout-guides-span-category)
The bullet-icon and guide line graphics provide keybindings and mouse
bindings for easy outline navigation and exposure control, extending
The bullet-icon and guide line graphics provide keybindings and mouse
bindings for easy outline navigation and exposure control, extending
(set-buffer-modified-p was-modified))))
;;;_ > allout-widgets-mode-off
(defun allout-widgets-mode-off ()
(set-buffer-modified-p was-modified))))
;;;_ > allout-widgets-mode-off
(defun allout-widgets-mode-off ()
(allout-widgets-mode -1))
;;;_ > allout-widgets-mode-off
(defun allout-widgets-mode-on ()
(allout-widgets-mode -1))
;;;_ > allout-widgets-mode-off
(defun allout-widgets-mode-on ()
(defvar allout-container-item-widget nil
"A widget for the current outline's overarching container as an item.
(defvar allout-container-item-widget nil
"A widget for the current outline's overarching container as an item.
icon/bullet.")
(make-variable-buffer-local 'allout-container-item-widget)
;;;_ . Hooks and hook helpers
;;;_ , major command-loop business:
;;;_ > allout-widgets-pre-command-business (&optional recursing)
icon/bullet.")
(make-variable-buffer-local 'allout-container-item-widget)
;;;_ . Hooks and hook helpers
;;;_ , major command-loop business:
;;;_ > allout-widgets-pre-command-business (&optional recursing)
-(defun allout-widgets-pre-command-business (&optional recursing)
- "Handle actions pending before allout-mode activity."
+(defun allout-widgets-pre-command-business (&optional _recursing)
+ "Handle actions pending before `allout-mode' activity."
-(defun allout-widgets-post-command-business (&optional recursing)
- "Handle actions pending after any allout-mode commands.
+(defun allout-widgets-post-command-business (&optional _recursing)
+ "Handle actions pending after any `allout-mode' commands.
Optional RECURSING is for internal use, to limit recursion."
;; - check changed text for nesting discontinuities and escape anything
;; that's: (1) asterisks at bol or (2) excessively nested.
Optional RECURSING is for internal use, to limit recursion."
;; - check changed text for nesting discontinuities and escape anything
;; that's: (1) asterisks at bol or (2) excessively nested.
(error
(substitute-command-keys allout-structure-unruly-deletion-message)))))
;;;_ > allout-widgets-after-change-handler
(error
(substitute-command-keys allout-structure-unruly-deletion-message)))))
;;;_ > allout-widgets-after-change-handler
"Reconcile what needs to be reconciled for allout widgets after edits."
)
;;;_ > allout-current-decorated-p ()
"Reconcile what needs to be reconciled for allout widgets after edits."
)
;;;_ > allout-current-decorated-p ()
;; have to distinguish between concealing and exposing so that, eg,
;; `allout-expose-topic's mix is handled properly.
handled-expose
;; have to distinguish between concealing and exposing so that, eg,
;; `allout-expose-topic's mix is handled properly.
handled-expose
(defun allout-widgets-after-copy-or-kill-function ()
"Do allout-widgets processing of text just placed in the kill ring.
(defun allout-widgets-after-copy-or-kill-function ()
"Do allout-widgets processing of text just placed in the kill ring.
(if (car kill-ring)
(setcar kill-ring (allout-widgets-undecorate-text (car kill-ring)))))
;;;_ > allout-widgets-after-undo-function ()
(defun allout-widgets-after-undo-function ()
"Do allout-widgets processing of text after an undo.
(if (car kill-ring)
(setcar kill-ring (allout-widgets-undecorate-text (car kill-ring)))))
;;;_ > allout-widgets-after-undo-function ()
(defun allout-widgets-after-undo-function ()
"Do allout-widgets processing of text after an undo.
(let* ((allout-undo-exposure-in-progress t)
;; inhibit undo recording while twiddling exposure to track undo:
(widgets allout-widgets-undo-exposure-record)
(let* ((allout-undo-exposure-in-progress t)
;; inhibit undo recording while twiddling exposure to track undo:
(widgets allout-widgets-undo-exposure-record)
(list (if included-from t) new-ranges)))
;;;_ > allout-test-range-overlaps ()
(defun allout-test-range-overlaps ()
(list (if included-from t) new-ranges)))
;;;_ > allout-test-range-overlaps ()
(defun allout-test-range-overlaps ()
;;;_ > allout-decorate-item-and-context (item-widget &optional redecorate
;;; blank-container parent)
(defun allout-decorate-item-and-context (item-widget &optional redecorate
;;;_ > allout-decorate-item-and-context (item-widget &optional redecorate
;;; blank-container parent)
(defun allout-decorate-item-and-context (item-widget &optional redecorate
"Create or adjust widget decorations for ITEM-WIDGET and neighbors at point.
The neighbors include its siblings and parent.
"Create or adjust widget decorations for ITEM-WIDGET and neighbors at point.
The neighbors include its siblings and parent.
If you're only trying to get or create a widget for an item, use
`allout-get-or-create-item-widget'. If you have the item-widget, applying
If you're only trying to get or create a widget for an item, use
`allout-get-or-create-item-widget'. If you have the item-widget, applying
Optional BLANK-CONTAINER is for internal use. It is used to fabricate a
container widget for an empty-bodied container, in the course of decorating
Optional BLANK-CONTAINER is for internal use. It is used to fabricate a
container widget for an empty-bodied container, in the course of decorating
Optional REDECORATE causes redecoration of the item-widget and
its siblings, even if already decorated in this cycle of the command loop.
Optional REDECORATE causes redecoration of the item-widget and
its siblings, even if already decorated in this cycle of the command loop.
(setq reverse-siblings-chart (list allout-recent-prefix-beginning))
(while (allout-next-sibling)
(push allout-recent-prefix-beginning reverse-siblings-chart)))
(setq reverse-siblings-chart (list allout-recent-prefix-beginning))
(while (allout-next-sibling)
(push allout-recent-prefix-beginning reverse-siblings-chart)))
(if (equal (char-after body-start) ? )
(setq body-start (1+ body-start)))
(widget-put item-widget :body-start body-start)
(if (equal (char-after body-start) ? )
(setq body-start (1+ body-start)))
(widget-put item-widget :body-start body-start)
;; has a subsequent item:
(not (= body-end (point-max)))
;; subsequent item is deeper:
;; has a subsequent item:
(not (= body-end (point-max)))
;; subsequent item is deeper:
;; note :expanded - true if widget item's content is currently visible?
(widget-put item-widget :expanded
(and has-subitems
;; note :expanded - true if widget item's content is currently visible?
(widget-put item-widget :expanded
(and has-subitems
(goto-char allout-recent-prefix-beginning)
(not (allout-hidden-p)))))))
;;;_ > allout-set-boundary-marker (boundary position &optional current-marker)
(goto-char allout-recent-prefix-beginning)
(not (allout-hidden-p)))))))
;;;_ > allout-set-boundary-marker (boundary position &optional current-marker)
"Set or create item widget BOUNDARY type marker at POSITION.
Optional CURRENT-MARKER is the marker currently being used for
"Set or create item widget BOUNDARY type marker at POSITION.
Optional CURRENT-MARKER is the marker currently being used for
&optional parent-widget has-successor)
"Add ITEM-WIDGET guide icon-prefix descender and connector text properties.
&optional parent-widget has-successor)
"Add ITEM-WIDGET guide icon-prefix descender and connector text properties.
-Optional arguments provide context for deriving the guides. In
-their absence, the current guide column flags are used.
+Optional arguments provide context for deriving the guides.
+In their absence, the current guide column flags are used.
(parent-flags (and parent-widget
(widget-get parent-widget :guide-column-flags)))
(parent-flags-depth (length parent-flags))
(parent-flags (and parent-widget
(widget-get parent-widget :guide-column-flags)))
(parent-flags-depth (length parent-flags))
(let* ((cue-start (or (widget-get item-widget :distinctive-end)
(widget-get item-widget :icon-end)))
(body-start (widget-get item-widget :body-start))
(let* ((cue-start (or (widget-get item-widget :distinctive-end)
(widget-get item-widget :icon-end)))
(body-start (widget-get item-widget :body-start))
- (expanded (widget-get item-widget :expanded))
- (has-subitems (widget-get item-widget :has-subitems))
+ ;(expanded (widget-get item-widget :expanded))
+ ;(has-subitems (widget-get item-widget :has-subitems))
(let* ((allout-inhibit-body-modification-hook t)
(body-start (widget-get item-widget :body-start))
(body-end (widget-get item-widget :body-end))
(let* ((allout-inhibit-body-modification-hook t)
(body-start (widget-get item-widget :body-start))
(body-end (widget-get item-widget :body-end))
When the START and END are passed, return the distance that the
start of the item moved. We return 0 if the span was not
previously established or is not moved."
When the START and END are passed, return the distance that the
start of the item moved. We return 0 if the span was not
previously established or is not moved."
(cond ((not overlay) (when start
(setq overlay (make-overlay start end nil t nil))
(overlay-put overlay 'button item-widget)
(cond ((not overlay) (when start
(setq overlay (make-overlay start end nil t nil))
(overlay-put overlay 'button item-widget)
Optional BLANK-CONTAINER is for internal use, to fabricate a
meta-container item with an empty body when the first proper
Optional BLANK-CONTAINER is for internal use, to fabricate a
meta-container item with an empty body when the first proper
of the buffer."
;; use existing widget, if there, else establish it
(if (or (bobp) (and (not (allout-ascend))
of the buffer."
;; use existing widget, if there, else establish it
(if (or (bobp) (and (not (allout-ascend))
(allout-get-or-create-item-widget redecorate 'blank-container)
(allout-get-or-create-item-widget redecorate)))
;;;_ : X- Item ancillaries
;;;_ >X allout-body-modification-handler (beg end)
(allout-get-or-create-item-widget redecorate 'blank-container)
(allout-get-or-create-item-widget redecorate)))
;;;_ : X- Item ancillaries
;;;_ >X allout-body-modification-handler (beg end)
"Do routine processing of body text before and after modification.
Operation is inhibited by `allout-inhibit-body-modification-handler'."
"Do routine processing of body text before and after modification.
Operation is inhibited by `allout-inhibit-body-modification-handler'."
;; items, recognizing that item structure is being preserved, including
;; escaping of item-prefix-like text within bodies. See
;; `allout-before-modification-handler' and
;; items, recognizing that item structure is being preserved, including
;; escaping of item-prefix-like text within bodies. See
;; `allout-before-modification-handler' and
;; operation.
(cond (allout-inhibit-body-modification-hook nil)))
;;;_ >X allout-graphics-modification-handler (beg end)
;; operation.
(cond (allout-inhibit-body-modification-hook nil)))
;;;_ >X allout-graphics-modification-handler (beg end)