Skip to content

Commit

Permalink
hl-todo-magit-revision: Add new function to magit-wash-message-hook
Browse files Browse the repository at this point in the history
  • Loading branch information
tarsius committed Jun 25, 2024
1 parent 634297c commit 3a595b7
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions hl-todo.el
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,19 @@ then append that character to the inserted string."
(save-excursion (insert "\n")))
(indent-region (line-beginning-position) (line-end-position))))))

(defun hl-todo-magit-revision ()
"Highlight TODO and similar keywords in commit messages and notes.
If `global-hl-todo-mode' is disabled, do nothing."
(when global-hl-todo-mode
(let ((case-fold-search nil)
(regexp (hl-todo--regexp)))
(while (re-search-forward regexp nil t)
(put-text-property (match-beginning 1)
(match-end 1)
'font-lock-face (hl-todo--get-face))))))

(add-hook 'magit-wash-message-hook #'hl-todo-magit-revision)

;;; _
(provide 'hl-todo)
;; Local Variables:
Expand Down

0 comments on commit 3a595b7

Please sign in to comment.