#+title: consult-hl-todo Reworked version of [[https://github.com/eki3z/consult-todo][Eki Zhang's consult-todo.el]]. The reason for the rewrite was that ~consult-todo-dir~ was completely broken for about a year. This library makes good use of =consult='s async pipeline, using it only to feed in extra candidates and not to rerun the search command. #+toc: headlines 1 * Setup Because we use the format =TODO(author): msg=, some manual advising of =hl-todo= is required for now. #+begin_src emacs-lisp (defun cmmm/hl-todo--setup-regexp-advice (&optional no-symbol) "Advice to make fontification, grep -E and rg work with custom regex" (when-let ((bomb (assoc "???" hl-todo-keyword-faces))) ;; If the user customized this variable before we started to ;; treat the strings as regexps, then the string "???" might ;; still be present. We have to remove it because it results ;; in the regexp search taking forever. (setq hl-todo-keyword-faces (delete bomb hl-todo-keyword-faces))) (setq hl-todo--regexp (concat (if no-symbol "(" "\\(") (pcase hl-todo-keyword-delimiters ('symbol (if no-symbol "\\<" "\\_<")) ('word "\\<") (_ "")) (if no-symbol "(" "\\(") (mapconcat #'car hl-todo-keyword-faces (if no-symbol "|" "\\|")) (if no-symbol ")" "\\)") (pcase hl-todo-keyword-delimiters ('symbol (if no-symbol "\\>" "\\_>")) ('word "\\>") (_ "")) (if no-symbol "(\\([^)]*\\)|)" "\\(?:(\\([^)]*\\))\\)?") (and (not (equal hl-todo-highlight-punctuation "")) (concat "[" hl-todo-highlight-punctuation "]" (if hl-todo-require-punctuation "+" "*"))) (if no-symbol ")" "\\)")))) (advice-add 'hl-todo--setup-regexp :override #'cmmm/hl-todo--setup-regexp-advice) #+end_src * Usage - =M-x consult-hl-todo = - =M-x consult-hl-todo-buffer-file =