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
.
Sunday, October 10, 2010
Emacs Tip #37: fic-mode.el
Posted by a at 4:13 AM
Labels: emacs, emacs-basic, emacs-tip, language
Subscribe to:
Post Comments (Atom)
9 comments:
Can you please explain how to use it?
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 :)
Your post has been truncated in planet.emacsen.org.
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.
@david Thanks, I've updated the comment in the .el file.
@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.
Hey Trey,
I have extended your mode to highlight TODO(author) syntax: http://www.emacswiki.org/emacs/fic-ext-mode.el
Indeed, wcheck-mode can do that. It can use external programs as well as Lisp functions for checking text.
Very cool, this is now to be a staple in my .emacs file. Works great for C/C++ and python.
Thanks for sharing this!
Post a Comment