Natan Yellin
Natan Yellin

Reputation: 6387

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)

Upvotes: 7

Views: 2711

Answers (1)

kindahero
kindahero

Reputation: 5867

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

(add-hook 'prog-mode-hook 'highlight-todos)

Upvotes: 6

Related Questions