2017-06-08 11:47:56 +02:00
|
|
|
;;; ui/hl-todo/packages.el -*- lexical-binding: t; -*-
|
2017-02-19 18:13:15 -05:00
|
|
|
|
2019-07-23 12:44:03 +02:00
|
|
|
(use-package! hl-todo
|
2017-12-08 22:33:12 -05:00
|
|
|
:hook (prog-mode . hl-todo-mode)
|
2021-05-16 21:16:16 -04:00
|
|
|
:hook (yaml-mode . hl-todo-mode)
|
2017-02-19 18:13:15 -05:00
|
|
|
:config
|
2019-07-21 23:57:03 +02:00
|
|
|
(setq hl-todo-highlight-punctuation ":"
|
|
|
|
hl-todo-keyword-faces
|
2022-09-24 11:01:49 +02:00
|
|
|
'(;; For reminders to change or add something at a later date.
|
2020-04-10 00:18:31 -04:00
|
|
|
("TODO" warning bold)
|
2022-09-24 11:01:49 +02:00
|
|
|
;; For code (or code paths) that are broken, unimplemented, or slow,
|
|
|
|
;; and may become bigger problems later.
|
2020-04-10 00:18:31 -04:00
|
|
|
("FIXME" error bold)
|
2022-09-24 11:01:49 +02:00
|
|
|
;; For code that needs to be revisited later, either to upstream it,
|
|
|
|
;; improve it, or address non-critical issues.
|
2020-04-10 00:18:31 -04:00
|
|
|
("REVIEW" font-lock-keyword-face bold)
|
2022-09-24 11:01:49 +02:00
|
|
|
;; For code smells where questionable practices are used
|
|
|
|
;; intentionally, and/or is likely to break in a future update.
|
|
|
|
("HACK" font-lock-constant-face bold)
|
|
|
|
;; For sections of code that just gotta go, and will be gone soon.
|
|
|
|
;; Specifically, this means the code is deprecated, not necessarily
|
|
|
|
;; the feature it enables.
|
2020-07-13 19:48:56 +04:30
|
|
|
("DEPRECATED" font-lock-doc-face bold)
|
2022-09-24 11:01:49 +02:00
|
|
|
;; Extra keywords commonly found in the wild, whose meaning may vary
|
|
|
|
;; from project to project.
|
2022-05-23 02:34:28 +02:00
|
|
|
("NOTE" success bold)
|
2020-07-13 19:48:56 +04:30
|
|
|
("BUG" error bold)
|
|
|
|
("XXX" font-lock-constant-face bold)))
|
|
|
|
|
2017-09-14 12:50:54 +02:00
|
|
|
|
2021-08-04 01:18:06 -04:00
|
|
|
(defadvice! +hl-todo-clamp-font-lock-fontify-region-a (fn &rest args)
|
2020-06-01 05:45:34 -04:00
|
|
|
"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))
|
2021-08-04 01:18:06 -04:00
|
|
|
(apply fn args)))
|
2020-06-01 05:45:34 -04:00
|
|
|
|
2017-09-14 12:50:54 +02:00
|
|
|
;; Use a more primitive todo-keyword detection method in major modes that
|
|
|
|
;; don't use/have a valid syntax table entry for comments.
|
2019-07-18 15:27:20 +02:00
|
|
|
(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)
|
2022-08-07 12:24:14 +02:00
|
|
|
(memq 'font-lock-comment-face (ensure-list (get-text-property (point) 'face))))))
|
2019-07-18 15:27:20 +02:00
|
|
|
(1 (hl-todo-get-face) t t))))
|
|
|
|
(when hl-todo-mode
|
|
|
|
(hl-todo-mode -1)
|
|
|
|
(hl-todo-mode +1)))))
|