doomemacs/modules/ui/hl-todo/config.el
Henrik Lissner 76cacb5bfe
💥 Rename def-package! -> use-package!
Calling this pivotal macro "def-package!" has frequently been a source
of confusion. It is a thin wrapper around use-package, and it should be
obvious that it is so. For this reason, and to match the naming
convention used with other convenience macros/wrappers, it is now
use-package!.

Also changes def-package-hook! -> use-package-hook!

The old macros are now marked obsolete and will be removed when straight
integration is merged.
2019-07-23 12:50:45 +02:00

28 lines
1.2 KiB
EmacsLisp

;;; ui/hl-todo/packages.el -*- lexical-binding: t; -*-
(use-package! hl-todo
:hook (prog-mode . hl-todo-mode)
:config
(setq hl-todo-highlight-punctuation ":"
hl-todo-keyword-faces
`(("TODO" . ,(face-foreground 'warning))
("FIXME" . ,(face-foreground 'error))
("HACK" . ,(face-foreground 'font-lock-constant-face))
("REVIEW" . ,(face-foreground 'font-lock-keyword-face))
("NOTE" . ,(face-foreground 'success))
("DEPRECATED" . ,(face-foreground 'font-lock-doc-face))))
;; Use a more primitive todo-keyword detection method in major modes that
;; don't use/have a valid syntax table entry for comments.
(add-hook! '(pug-mode-hook haml-mode-hook)
(defun +hl-todo--use-face-detection-h ()
"Use a different, more primitive method of locating todo keywords."
(set (make-local-variable 'hl-todo-keywords)
'(((lambda (limit)
(let (case-fold-search)
(and (re-search-forward hl-todo-regexp limit t)
(memq 'font-lock-comment-face (doom-enlist (get-text-property (point) 'face))))))
(1 (hl-todo-get-face) t t))))
(when hl-todo-mode
(hl-todo-mode -1)
(hl-todo-mode +1)))))