Skip to content

Commit

Permalink
hl-todo-mode: Absorb hl-todo--setup
Browse files Browse the repository at this point in the history
  • Loading branch information
minad authored and tarsius committed Aug 28, 2023
1 parent 5bb58f1 commit 4450aea
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions hl-todo.el
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,6 @@ See the function `hl-todo--regexp'."
(if hl-todo-require-punctuation "+" "*")))
"\\)")))

(defun hl-todo--setup ()
(setq hl-todo--keywords
`((,(lambda (bound) (hl-todo--search nil bound))
(1 (hl-todo--get-face) prepend t))))
(font-lock-add-keywords nil hl-todo--keywords t))

(defvar hl-todo--syntax-table (copy-syntax-table text-mode-syntax-table))

(defvar syntax-ppss-table) ; Silence Emacs 25's byte-compiler.
Expand Down Expand Up @@ -276,9 +270,12 @@ If COLOR is a face symbol, do not combine, return COLOR instead."
:lighter ""
:keymap hl-todo-mode-map
:group 'hl-todo
(if hl-todo-mode
(hl-todo--setup)
(font-lock-remove-keywords nil hl-todo--keywords))
(cond (hl-todo-mode
(setq hl-todo--keywords
`((,(lambda (bound) (hl-todo--search nil bound))
(1 (hl-todo--get-face) prepend t))))
(font-lock-add-keywords nil hl-todo--keywords t))
((font-lock-remove-keywords nil hl-todo--keywords)))
(when font-lock-mode
(jit-lock-mode 1)))

Expand Down

0 comments on commit 4450aea

Please sign in to comment.