Comment in Grail source code
François Pinard
pinard at iro.umontreal.ca
Sun Oct 31 05:43:03 EST 1999
"Juergen A. Erhard" <jae at ilk.de> écrit:
> The common (in GNU land at least) marker seems to be FIXME:
Did I share my usual trick with you? Forgive me if I repeat myself without
noticing, it merely goes with senility :-). For Emacs lovers:
(when window-system
(let ((color (face-foreground 'font-lock-comment-face)))
(copy-face 'italic 'font-lock-comment-face)
(set-face-foreground 'font-lock-comment-face color))
(copy-face 'underline 'fp-space-face)
(set-face-foreground 'fp-space-face "red")
(copy-face 'underline 'fp-unbreakable-space-face)
(set-face-foreground 'fp-unbreakable-space-face "grey")
(let ((liste '(c-mode c++-mode change-log-mode emacs-lisp-mode m4-mode
mail-mode magic-point-mode makefile-mode
metafont-mode message-mode metapost-mode
perl-mode python-mode scheme-mode sgml-mode sh-mode
shell-script-mode texinfo-mode text-mode)))
(while liste
(font-lock-add-keywords
(pop liste)
'(("\\<\\(FIXME\\)[!:]?\\>" 1 font-lock-warning-face t)
("\240" 0 'fp-unbreakable-space-face t)
("[ \t]+$" 0 'fp-space-face t)
("\n\\(\n+\\)\\'" 1 'fp-space-face t))
'append))))
One effect of the above, when put in your `.emacs', is to render any `FIXME'
occurring in Python sources with bold flashy red, when followed by either
a colon or exclamation mark. Other effects are to do the same in various
other modes, to display spurious whitespace, when any, with red thin lines,
and to underline unbreakable spaces with gray. Oh, and it also uses italics
for comments, which I like a lot too (I think I stole that idea from XEmacs).
Of course, simplify as wanted by removing anything you do not like! :-)
P.S. - You might need to preload "cl" for `pop' to work, or rework the
loop a tiny bit. In any case, Richard told me he will make `pop' standard.
--
François Pinard http://www.iro.umontreal.ca/~pinard
More information about the Python-list
mailing list