aboutsummaryrefslogtreecommitdiff
path: root/README.org
diff options
context:
space:
mode:
authorLibravatar Martin Michalec <martin@michalec.dev>2026-10-23 22:50:55 +0000
committerLibravatar Martin Michalec <martin@michalec.dev>2026-10-23 22:50:55 +0000
commit9edba2a6942104a6d69c06dff293b4e9c1b90731 (patch)
treeb9d774a7b568c8bbe5f4e62b669cb9e32fe8cce1 /README.org
downloadconsult-hl-todo-master.tar.gz
feat: initial implementationHEADmaster
Diffstat (limited to 'README.org')
-rw-r--r--README.org49
1 files changed, 49 insertions, 0 deletions
diff --git a/README.org b/README.org
new file mode 100644
index 0000000..3841c6c
--- /dev/null
+++ b/README.org
@@ -0,0 +1,49 @@
1#+title: consult-hl-todo
2
3Reworked version of [[https://github.com/eki3z/consult-todo][Eki Zhang's consult-todo.el]]. The reason for the
4rewrite was that ~consult-todo-dir~ was completely broken for about a
5year.
6
7This library makes good use of =consult='s async pipeline, using it only
8to feed in extra candidates and not to rerun the search command.
9
10#+toc: headlines 1
11
12* Setup
13Because we use the format =TODO(author): msg=, some manual advising of
14=hl-todo= is required for now.
15
16#+begin_src emacs-lisp
17(defun cmmm/hl-todo--setup-regexp-advice (&optional no-symbol)
18 "Advice to make fontification, grep -E and rg work with custom regex"
19 (when-let ((bomb (assoc "???" hl-todo-keyword-faces)))
20 ;; If the user customized this variable before we started to
21 ;; treat the strings as regexps, then the string "???" might
22 ;; still be present. We have to remove it because it results
23 ;; in the regexp search taking forever.
24 (setq hl-todo-keyword-faces (delete bomb hl-todo-keyword-faces)))
25 (setq hl-todo--regexp
26 (concat (if no-symbol "(" "\\(")
27 (pcase hl-todo-keyword-delimiters
28 ('symbol (if no-symbol "\\<" "\\_<"))
29 ('word "\\<")
30 (_ ""))
31 (if no-symbol "(" "\\(")
32 (mapconcat #'car hl-todo-keyword-faces
33 (if no-symbol "|" "\\|"))
34 (if no-symbol ")" "\\)")
35 (pcase hl-todo-keyword-delimiters
36 ('symbol (if no-symbol "\\>" "\\_>"))
37 ('word "\\>")
38 (_ ""))
39 (if no-symbol "(\\([^)]*\\)|)" "\\(?:(\\([^)]*\\))\\)?")
40 (and (not (equal hl-todo-highlight-punctuation ""))
41 (concat "[" hl-todo-highlight-punctuation "]"
42 (if hl-todo-require-punctuation "+" "*")))
43 (if no-symbol ")" "\\)"))))
44(advice-add 'hl-todo--setup-regexp :override #'cmmm/hl-todo--setup-regexp-advice)
45#+end_src
46
47* Usage
48- =M-x consult-hl-todo <RET>=
49- =M-x consult-hl-todo-buffer-file <RET>=