From 9edba2a6942104a6d69c06dff293b4e9c1b90731 Mon Sep 17 00:00:00 2001 From: Martin Michalec Date: Sat, 24 Oct 2026 01:50:55 +0300 Subject: feat: initial implementation --- README.org | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 README.org (limited to 'README.org') diff --git a/README.org b/README.org new file mode 100644 index 0000000..3841c6c --- /dev/null +++ b/README.org @@ -0,0 +1,49 @@ +#+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 = -- cgit v1.3.1