Function: magit-todos--insert-todos
magit-todos--insert-todos is a natively compiled function defined in
magit-todos.el.
Signature
(magit-todos--insert-todos)
Documentation
Insert to-do items into current buffer.
This function should be called from inside a ‘magit-status’ buffer.
Source Code
;; Defined in /nix/store/xy37aj9089qvbs5clw0qszpi3hrh3mxx-emacs-packages-deps/share/emacs/site-lisp/elpa/magit-todos-20250928.1611/magit-todos.el
(defun magit-todos--insert-todos ()
"Insert to-do items into current buffer.
This function should be called from inside a ‘magit-status’ buffer."
(declare (indent defun))
(when (or magit-todos-update-remote
magit-todos-updating
(not (file-remote-p default-directory)))
(when magit-todos-active-scan
;; Avoid running multiple scans for a single magit-status buffer.
(let ((buffer (process-buffer magit-todos-active-scan)))
(when (process-live-p magit-todos-active-scan)
(delete-process magit-todos-active-scan))
(when (buffer-live-p buffer)
(kill-buffer buffer)))
(setq magit-todos-active-scan nil))
(pcase magit-todos-update
((or 't ; Automatic
;; Manual and updating now
(and 'nil (guard magit-todos-updating))
;; Caching and cache expired
(and (pred integerp) (guard (or magit-todos-updating ; Forced update
(>= (float-time
(time-subtract (current-time)
magit-todos-last-update-time))
magit-todos-update)
(null magit-todos-last-update-time)))))
;; Scan and insert.
;; HACK: I don't like setting a special var here, because it seems like lexically binding a
;; special var should follow down the chain, but it isn't working, so we'll do this.
(setq magit-todos-updating t)
(setq magit-todos-active-scan (funcall magit-todos-scanner
:callback #'magit-todos--insert-items
:magit-status-buffer (current-buffer)
:directory default-directory
:depth magit-todos-depth))
(magit-todos--maybe-insert-branch-todos 'rescan))
(_ ; Caching and cache not expired, or not automatic and not manually updating now
(magit-todos--insert-items (current-buffer) magit-todos-item-cache)
(magit-todos--maybe-insert-branch-todos 'cached)))))