Download
(defcustom fic-highlighted-words '("FIXME" "TODO" "BUG" "KLUDGE")
"Words to highlight"
:group 'fic-mode)
(defcustom fic-foreground-color "Red"
"Font foreground colour"
:group 'fic-mode)
(defcustom fic-background-color "Yellow"
"Font background color"
:group 'fic-mode)
(defcustom font-lock-fic-face 'font-lock-fic-face
"variable storing the face for fic mode"
:group 'fic-mode)
(make-face 'font-lock-fic-face)
(modify-face 'font-lock-fic-face fic-foreground-color
fic-background-color nil t nil t nil nil)
(defvar fic-search-list-re (regexp-opt fic-highlighted-words 'words)
"regexp constructed from 'fic-highlighted-words")
(defun fic-in-doc/comment-region (pos)
(memq (get-char-property pos 'face)
(list font-lock-doc-face font-lock-string-face font-lock-comment-face)))
(defun fic-search-for-keyword (limit)
(let ((match-data-to-set nil)
found)
(save-match-data
(while (and (null match-data-to-set)
(re-search-forward fic-search-list-re limit t))
(if (and (fic-in-doc/comment-region (match-beginning 0))
(fic-in-doc/comment-region (match-end 0)))
(setq match-data-to-set (match-data)))))
(when match-data-to-set
(set-match-data match-data-to-set)
(goto-char (match-end 0))
t)))
(define-minor-mode fic-mode "highlight FIXMEs in comments and strings (as well as TODO BUG and KLUDGE"
:lighter " FIC" :group 'fic-mode
(let ((kwlist '((fic-search-for-keyword (0 'font-lock-fic-face t)))))
(if fic-mode
(font-lock-add-keywords nil kwlist)
(font-lock-remove-keywords nil kwlist))))
(defun turn-on-fic-mode ()
"turn fic-mode on"
(interactive)
(fic-mode 1))
(provide 'fic-mode)