Index: lisp/textmodes/flyspell.el =================================================================== RCS file: /sources/emacs/emacs/lisp/textmodes/flyspell.el,v retrieving revision 1.115 diff -B -w -c -r1.115 flyspell.el *** lisp/textmodes/flyspell.el 21 Jan 2007 03:53:09 -0000 1.115 --- lisp/textmodes/flyspell.el 7 Mar 2007 13:40:11 -0000 *************** *** 369,382 **** '(font-lock-string-face font-lock-comment-face font-lock-doc-face) "Faces corresponding to text in programming-mode buffers.") (defun flyspell-generic-progmode-verify () "Used for `flyspell-generic-check-word-predicate' in programming modes." ! (let ((f (get-text-property (point) 'face))) ! (memq f flyspell-prog-text-faces))) ;;;###autoload (defun flyspell-prog-mode () ! "Turn on `flyspell-mode' for comments and strings." (interactive) (setq flyspell-generic-check-word-predicate 'flyspell-generic-progmode-verify) --- 369,391 ---- '(font-lock-string-face font-lock-comment-face font-lock-doc-face) "Faces corresponding to text in programming-mode buffers.") + (defun flyspell-face-at-point-in-p (point list) + "Check if the face at POINT is in LIST." + (let ((f (get-text-property point 'face))) + (if (listp f) + (catch 'found + (dolist (face f) + (when (memq face list) (throw 'found t)))) + (memq f list)))) + (defun flyspell-generic-progmode-verify () "Used for `flyspell-generic-check-word-predicate' in programming modes." ! (flyspell-face-at-point-in-p (point) flyspell-prog-text-faces)) ;;;###autoload (defun flyspell-prog-mode () ! "Turn on `flyspell-mode' for comments and strings. ! Note that comment checking is also affected by `ispell-check-comments'." (interactive) (setq flyspell-generic-check-word-predicate 'flyspell-generic-progmode-verify) *************** *** 1008,1014 **** start end poss word ispell-filter) (if (or (eq flyspell-word nil) (and (fboundp flyspell-generic-check-word-predicate) ! (not (funcall flyspell-generic-check-word-predicate)))) t (progn ;; destructure return flyspell-word info list. --- 1017,1026 ---- start end poss word ispell-filter) (if (or (eq flyspell-word nil) (and (fboundp flyspell-generic-check-word-predicate) ! (not (funcall flyspell-generic-check-word-predicate))) ! (and (not ispell-check-comments) ! (flyspell-face-at-point-in-p (car (cdr flyspell-word)) ! '(font-lock-comment-face)))) t (progn ;; destructure return flyspell-word info list. *************** *** 1561,1566 **** --- 1573,1581 ---- (let ((old beg)) (setq beg end) (setq end old))) + ;; Fontify the part checked, so that font-lock based tests are + ;; fine. + (font-lock-fontify-region beg end) (if (and flyspell-large-region (> (- end beg) flyspell-large-region)) (flyspell-large-region beg end) (flyspell-small-region beg end))))) Index: lisp/ChangeLog =================================================================== RCS file: /sources/emacs/emacs/lisp/ChangeLog,v retrieving revision 1.10783 diff -C0 -r1.10783 ChangeLog *** lisp/ChangeLog 7 Mar 2007 12:50:23 -0000 1.10783 --- lisp/ChangeLog 7 Mar 2007 13:43:33 -0000 *************** *** 0 **** --- 1,11 ---- + 2007-03-07 Michaël Cadilhac + + * textmodes/flyspell.el (flyspell-face-at-point-in-p): New. Check + if the face at a specified point is in a face list. + (flyspell-generic-progmode-verify): Use it. + (flyspell-prog-mode): Talk about `ispell-check-comments' in the + docstring. + (flyspell-word): Consider `ispell-check-comments': if nil, don't + check text with face `font-lock-comment-face'. + (flyspell-region): Fontify the region before processing it. +