So, to answer my own question. The issue had come up before in comp.emacs.xemacs
================================================================
From: Colin Marquardt <colin.marquardt(a)usa.alcatel.com>
Subject: Re: Spell check while writting code...
Keywords: comments,strings
Newsgroups: comp.emacs.xemacs
Date: Wed, 01 Aug 2001 10:00:01 -0700
Organization: Alcatel USA, Petaluma, CA 94954
Jason Boerner <jasonb(a)computer.org> writes:
Does someone have a cool addition to cperl and c-java-mode for
performing flyspell within the appropriate places (ie. comments,
strings, and for a real challege after a '# nroff starts here' string
in a perl program)?
;;* flyspell comments and strings in programming modes
;; From: "Stefan Monnier <foo @ acm.com>"
(defun flyspell-generic-progmode-verify ()
"Used for `flyspell-generic-check-word-p' in programming modes."
(let ((f (get-text-property (point) 'face)))
(memq f '(font-lock-comment-face font-lock-string-face))))
(defun flyspell-prog-mode ()
"Turn on `flyspell-mode' for comments and strings."
(interactive)
(ispell-change-dictionary "american") ;Comments are mostly in English.
(setq flyspell-generic-check-word-p 'flyspell-generic-progmode-verify)
(flyspell-mode 1))
(add-hook 'c-mode-common-hook 'flyspell-prog-mode t)
Colin
==========
I changed the above hook to
(dolist (mode '(tcl-mode emacs-lisp-mode c++-mode sql-mode tcl-mode perl-mode
ess-mode))
(put mode 'flyspell-mode-predicate 'flyspell-generic-progmode-verify))
-jeff
From: Jeff Mincy <jeff(a)delphioutpost.com>
Date: Mon, 3 Sep 2001 21:36:21 -0400
To: xemacs-beta(a)xemacs.org
Subject: flyspell
So, I just got around to enabling flyspell mode in my xemacs
initialization, using:
(global-flyspell-mode t)
The problem is that for some modes (like say emacs-lisp-mode - or any
other programming language mode) flyspell is being way too aggressive.
So anyway, I was thinking that it would be more useful if flyspell
only checked comments in programming modes.
like maybe flyspell could only look at words that are in the
font-lock-comment-face.
Has somebody else done this already? This issue seems vaguely
familiar.
-jeff