Function: hl-todo--setup-regexp

hl-todo--setup-regexp is a natively compiled function defined in hl-todo.el.

Signature

(hl-todo--setup-regexp &optional NO-SYMBOL)

Documentation

Setup keyword regular expression.

See the function hl-todo--regexp(var)/hl-todo--regexp(fun).

Source Code

;; Defined in /nix/store/b97f5zr6snxdbh1bgqmj50mq949vd13i-emacs-packages-deps/share/emacs/site-lisp/elpa/hl-todo-20261001.1547/hl-todo.el
(defun hl-todo--setup-regexp (&optional no-symbol)
  "Setup keyword regular expression.
See the function `hl-todo--regexp'."
  (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 "\\("
                (pcase hl-todo-keyword-delimiters
                  ('symbol (if no-symbol "\\<" "\\_<"))
                  ('word   "\\<")
                  (_       ""))
                "\\(" (mapconcat #'car hl-todo-keyword-faces "\\|") "\\)"
                (pcase hl-todo-keyword-delimiters
                  ('symbol (if no-symbol "\\>" "\\_>"))
                  ('word   "\\>")
                  (_       ""))
                (and (not (equal hl-todo-highlight-punctuation ""))
                     (concat "[" hl-todo-highlight-punctuation "]"
                             (if hl-todo-require-punctuation
                                 (if no-symbol "\\+" "+")
                               "*")))
                "\\)")))