Function: hl-todo-flymake
hl-todo-flymake is a natively compiled function defined in hl-todo.el.
Signature
(hl-todo-flymake REPORT-FN &rest PLIST)
Documentation
Flymake backend for hl-todo-mode(var)/hl-todo-mode(fun).
Diagnostics are reported to REPORT-FN. Use add-hook to
register this function in flymake-diagnostic-functions before
enabling flymake-mode.
Source Code
;; Defined in /nix/store/b97f5zr6snxdbh1bgqmj50mq949vd13i-emacs-packages-deps/share/emacs/site-lisp/elpa/hl-todo-20261001.1547/hl-todo.el
;;;###autoload
(defun hl-todo-flymake (report-fn &rest _plist)
"Flymake backend for `hl-todo-mode'.
Diagnostics are reported to REPORT-FN. Use `add-hook' to
register this function in `flymake-diagnostic-functions' before
enabling `flymake-mode'."
(let ((diags nil)
(buf (current-buffer))
(comment (concat (regexp-quote comment-start) "\\s-+")))
(when hl-todo-mode
(save-excursion
(save-restriction
(save-match-data
(goto-char (point-min))
(while (hl-todo--search)
(let ((keyword (match-string 1))
(beg (match-beginning 0))
(end (pos-eol))
(bol (pos-bol)))
;; Take whole line when keyword is not at the start of comment.
(save-excursion
(goto-char beg)
(unless (looking-back comment bol)
(goto-char bol)
;; Skip whitespace at the beginning of line.
(when (and (not (looking-at-p "\\S-"))
(re-search-forward "\\S-" beg t))
(forward-char -1))
;; Skip comment.
(re-search-forward comment beg t)
(setq beg (point))))
(push (hl-todo-make-flymake-diagnostic
buf beg end (buffer-substring-no-properties beg end)
keyword)
diags)))))))
(funcall report-fn (nreverse diags))))