Function: treemacs--apply-annotations-deferred

treemacs--apply-annotations-deferred is a byte-compiled function defined in treemacs-annotations.el.

Signature

(treemacs--apply-annotations-deferred BTN PATH BUFFER GIT-FUTURE)

Documentation

Deferred application for annotations for BTN and PATH.

Runs on a timer after BTN was expanded and will apply annotations for all of BTN's *immediate* children.

Change will happen in BUFFER, given that it is alive.

GIT-FUTURE is only awaited when deferred git-mode is used.

BTN: Button PATH: Node Path BUFFER: Buffer GIT-FUTURE: Pfuture

Source Code

;; Defined in ~/.emacs.d/elpa/treemacs-20251226.1307/treemacs-annotations.el
(defun treemacs--apply-annotations-deferred (btn path buffer git-future)
  "Deferred application for annotations for BTN and PATH.

Runs on a timer after BTN was expanded and will apply annotations for all of
BTN's *immediate* children.

Change will happen in BUFFER, given that it is alive.

GIT-FUTURE is only awaited when `deferred' git-mode is used.

BTN: Button
PATH: Node Path
BUFFER: Buffer
GIT-FUTURE: Pfuture"
  (when (eq 'deferred treemacs--git-mode)
    (ht-set! treemacs--git-cache path
             (treemacs--get-or-parse-git-result git-future)))
  (when (buffer-live-p buffer)
    (with-current-buffer buffer
      (save-excursion
        (treemacs-with-writable-buffer
         (let* ((depth (1+ (treemacs-button-get btn :depth)))
                (git-info (or (ht-get treemacs--git-cache (treemacs-button-get btn :key))
                              treemacs--empty-table)))
           ;; the depth check ensures that we only iterate over the nodes that
           ;; are below parent-btn and stop when we've moved on to nodes that
           ;; are above or belong to the next project
           (while (and (setq btn (next-button btn))
                       (>= (treemacs-button-get btn :depth) depth))
             (when (= depth (treemacs-button-get btn :depth))
               (treemacs--do-apply-annotation
                btn
                (ht-get git-info (treemacs-button-get btn :key)))))))))))