Function: treemacs--recursive-refresh-descent
treemacs--recursive-refresh-descent is a byte-compiled function
defined in treemacs-rendering.el.
Signature
(treemacs--recursive-refresh-descent NODE PROJECT)
Documentation
Recursively refresh by descending the dom starting from NODE.
If NODE under PROJECT is marked for refresh and in an open state (since it could have been collapsed in the meantime) it will simply be collapsed and re-expanded. If NODE is node marked its children will be recursively investigated instead. Additionally all the refreshed nodes are collected and returned so their parents' git status can be updated.
Source Code
;; Defined in ~/.emacs.d/elpa/treemacs-20251226.1307/treemacs-rendering.el
;; TODO(201/10/30): update of parents
(defun treemacs--recursive-refresh-descent (node project)
"Recursively refresh by descending the dom starting from NODE.
If NODE under PROJECT is marked for refresh and in an open state (since it could
have been collapsed in the meantime) it will simply be collapsed and
re-expanded. If NODE is node marked its children will be recursively
investigated instead.
Additionally all the refreshed nodes are collected and returned so their
parents' git status can be updated."
(let ((recurse t)
(refreshed-nodes nil))
(-when-let (change-list (treemacs-dom-node->refresh-flag node))
(setf (treemacs-dom-node->refresh-flag node) nil)
(push node refreshed-nodes)
(if (> (length change-list) 8)
(progn
(setf recurse nil)
(if (null (treemacs-dom-node->parent node))
(treemacs-project->refresh! project)
(treemacs--refresh-dir (treemacs-dom-node->key node) project)))
(dolist (change change-list)
(-let [(path . type) change]
(pcase type
('deleted
(treemacs-do-delete-single-node path project))
('changed
(treemacs-do-update-node path)
(treemacs-update-single-file-git-state path))
('created
(treemacs-do-insert-single-node path (treemacs-dom-node->key node)))
('force-refresh
(setf recurse nil)
(if (null (treemacs-dom-node->parent node))
(treemacs-project->refresh! project)
(treemacs--refresh-dir (treemacs-dom-node->key node) project)))
(_
;; Renaming is handled as a combination of delete+create, so
;; this case should never be taken
(treemacs-log-failure "Unknown change event: %s" change)
(setf recurse nil)
(if (null (treemacs-dom-node->parent node))
(treemacs-project->refresh! project)
(treemacs--refresh-dir (treemacs-dom-node->key node) project))))))))
(when recurse
(dolist (child (treemacs-dom-node->children node))
(setq refreshed-nodes
(nconc refreshed-nodes
(treemacs--recursive-refresh-descent child project)))))
;; TODO(2019/07/30): add as little as possible
refreshed-nodes))