Colorful Comment Markers in Emacs

Earlier this year I switched to a (mostly) monochromatic theme for coding in emacs. It has been a great experiment so far. I even tried switching back to a colorful theme the other day, and it was so distracting that I ended up switching back. Even though I'm not using much syntax highlighting, I quickly made an exception for commented code. That had to be a darker color so that my eyes could quickly distinguish between code and comments.

I don't do a whole lot of commenting, but I tend to leave a bunch of TODO markers to circle back to later. Occasionally I will leave a NOTE or QUESTION marker, or the exceedingly rare SEE <hyperlink>.

I've decided to make an exception to my monochromatic theme. Comment markers are more helpful if they jump out at me, so I'm choosing to colorize them.

;; Colorful Markers
(setq fixme-modes '(c++-mode c-mode emacs-lisp-mode js2-mode go-mode))
(make-face 'font-lock-fixme-face)
(make-face 'font-lock-study-face)
(make-face 'font-lock-important-face)
(make-face 'font-lock-question-face)
(make-face 'font-lock-note-face)
(make-face 'font-lock-see-face)
(mapc (lambda (mode)
        (font-lock-add-keywords
         mode
         '(("\\<\\(TODO\\)" 1 'font-lock-fixme-face t)
           ("\\<\\(STUDY\\)" 1 'font-lock-study-face t)
           ("\\<\\(IMPORTANT\\)" 1 'font-lock-important-face t)
           ("\\<\\(QUESTION\\)" 1 'font-lock-question-face t)
           ("\\<\\(SEE\\)" 1 'font-lock-see-face t)
           ("\\<\\(NOTE\\)" 1 'font-lock-note-face t))))
      fixme-modes)
(modify-face 'font-lock-fixme-face "#D64C2A" nil nil t nil t nil nil)
(modify-face 'font-lock-study-face "Yellow" nil nil t nil t nil nil)
(modify-face 'font-lock-important-face "Yellow" nil nil t nil t nil nil)
(modify-face 'font-lock-question-face "#ffa500" nil nil t nil t nil nil)
(modify-face 'font-lock-see-face "#88C9F0" nil nil t nil t nil nil)
(modify-face 'font-lock-note-face "#8ABB93" nil nil t nil t nil nil)

I started with Casey Muratori's code from his .emacs file in Handmade Hero, and added a little bit to it.

Show Comments