doomemacs/modules/ui/hl-todo/config.el

50 lines
2.2 KiB
EmacsLisp
Raw Normal View History

;;; ui/hl-todo/packages.el -*- lexical-binding: t; -*-
2017-02-19 18:13:15 -05:00
(use-package! hl-todo
:hook (prog-mode . hl-todo-mode)
:hook (yaml-mode . hl-todo-mode)
2017-02-19 18:13:15 -05:00
:config
(setq hl-todo-highlight-punctuation ":"
hl-todo-keyword-faces
'(;; For missing features or functionality that should be added at a
;; later date.
2020-04-10 00:18:31 -04:00
("TODO" warning bold)
;; For code (or code paths) that are broken or slow, and may become
;; bigger problems later.
2020-04-10 00:18:31 -04:00
("FIXME" error bold)
;; For code smells, where questionable coding practices are
;; intentionally used, and/or may break in a future update.
2020-04-10 00:18:31 -04:00
("HACK" font-lock-constant-face bold)
;; For things that need confirmation that they work or more testing.
2020-04-10 00:18:31 -04:00
("REVIEW" font-lock-keyword-face bold)
;; For things that just gotta go and will soon be gone.
2020-07-13 19:48:56 +04:30
("DEPRECATED" font-lock-doc-face bold)
;; These are extra, commonly seen annotation keywords. What they mean
;; or are for depend on the project.
("NOTE" success bold)
2020-07-13 19:48:56 +04:30
("BUG" error bold)
("XXX" font-lock-constant-face bold)))
(defadvice! +hl-todo-clamp-font-lock-fontify-region-a (fn &rest args)
"Fix an `args-out-of-range' error in some modes."
:around #'hl-todo-mode
(letf! (defun font-lock-fontify-region (beg end &optional loudly)
(funcall font-lock-fontify-region (max beg 1) end loudly))
(apply fn args)))
;; 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 (ensure-list (get-text-property (point) 'face))))))
(1 (hl-todo-get-face) t t))))
(when hl-todo-mode
(hl-todo-mode -1)
(hl-todo-mode +1)))))