Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Highlighting TODOs in all programming modes

What is the root mode I need to hook to highlight TODOs in Ruby, Lisp, and C-like languages. I tried the following, but it doesn't highlight TODO in Ruby or Lisp:

(defun highlight-todos (font-lock-add-keywords nil
             '(("\\<\\(FIXME\\|TODO\\|BUG\\):" 1 font-lock-warning-face t))))
(add-hook 'text-mode-hook 'highlight-todos)
like image 587
Natan Yellin Avatar asked Dec 18 '11 11:12

Natan Yellin


1 Answers

I think to get it to all programming modes to work use prog-mode-hook

(add-hook 'prog-mode-hook 'highlight-todos)
like image 103
kindahero Avatar answered Oct 23 '22 09:10

kindahero