Sunday, October 10, 2010

Emacs Tip #37: fic-mode.el

I saw this question on Stack Overflow asking to highlight FIXME (and similar strings) in your code, but only in comments and strings.

The current fixme-mode.el found on the Emacs Wiki is kind of clunky (it's really a major mode) and awkward to read. So I took the challenge to write a new minor-mode which answers the question.

I give you fic-mode.el. It's named fic as an acronym for Fixme In Comments.

To use it, add something like the following to your .emacs:



(require 'fic-mode)
(add-hook 'c++-mode-hook 'turn-on-fic-mode)
(add-hook 'emacs-lisp-mode-hook 'turn-on-fic-mode)



Or, you can manually start it with M-x fic-mode.

9 comments:

Anonymous said...

Can you please explain how to use it?

Anonymous said...

I wonder if one would be able to do something similar using wcheck-mode.

While I have not looked into the details it is possible to use regexp to identify chunks and mark them with a given face.

Anyway, thanks for providing fic-mode :)

Anonymous said...

Your post has been truncated in planet.emacsen.org.

dfphil said...

just a quick note that in your .el file you write "To use... (require 'fic-mode.el)" which ought to be - as it is in the blog post (require 'fic-mode). That should teach me to cut and paste without reading carefully.

a said...

@david Thanks, I've updated the comment in the .el file.

a said...

@Anonymous Regarding wcheck-mode, that's new to me. I happen to use flyspell, and there's a sub-mode called flyspell-prog-mode, which spell checks in comments and strings only.

tw33dl3.dee said...

Hey Trey,
I have extended your mode to highlight TODO(author) syntax: http://www.emacswiki.org/emacs/fic-ext-mode.el

Anonymous said...

Indeed, wcheck-mode can do that. It can use external programs as well as Lisp functions for checking text.

Michael King said...

Very cool, this is now to be a staple in my .emacs file. Works great for C/C++ and python.

Thanks for sharing this!