changeset 73462:9b076439f58a

* textmodes/flyspell.el (flyspell-word): Skip past all previous whitespace when checking doublons. (flyspell-check-region-doublons): Fix doublon regexp. (flyspell-highlight-incorrect-region): Highlight doublons using flyspell-duplicate face.
author Chong Yidong <cyd@stupidchicken.com>
date Sun, 22 Oct 2006 21:29:33 +0000
parents c09fdf139d4a
children 346f9b4afa15
files lisp/ChangeLog lisp/textmodes/flyspell.el
diffstat 2 files changed, 18 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sun Oct 22 21:00:25 2006 +0000
+++ b/lisp/ChangeLog	Sun Oct 22 21:29:33 2006 +0000
@@ -1,5 +1,11 @@
 2006-10-22  martin rudalics  <rudalics@gmx.at>
 
+	* textmodes/flyspell.el (flyspell-word): Skip past all previous
+	whitespace when checking doublons.
+	(flyspell-check-region-doublons): Fix doublon regexp.
+	(flyspell-highlight-incorrect-region): Highlight doublons using
+	flyspell-duplicate face.
+
 	* progmodes/cperl-mode.el (cperl-invalid-face): Fix defcustom.
 
 2006-10-22  John Wiegley  <johnw@newartisans.com>
--- a/lisp/textmodes/flyspell.el	Sun Oct 22 21:00:25 2006 +0000
+++ b/lisp/textmodes/flyspell.el	Sun Oct 22 21:29:33 2006 +0000
@@ -1011,11 +1011,14 @@
 			  (not (memq (char-after (1- start)) '(?\} ?\\)))))
 		 flyspell-mark-duplications-flag
 		 (save-excursion
-		   (goto-char (1- start))
-		   (let ((p (flyspell-word-search-backward
-			     word
-			     (- start (1+ (- end start))))))
-		     (and p (/= p (1- start))))))
+		   (goto-char start)
+		   (let* ((bound
+			   (- start
+			      (- end start)
+			      (- (skip-chars-backward " \t\n\f"))))
+			  (p (when (>= bound (point-min))
+			       (flyspell-word-search-backward word bound))))
+		     (and p (/= p start)))))
 	    ;; yes, this is a doublon
 	    (flyspell-highlight-incorrect-region start end 'doublon)
 	    nil)
@@ -1472,7 +1475,7 @@
     (flyspell-word)     ; Make sure current word is checked
     (backward-word 1)
     (while (and (< (point) end)
-		(re-search-forward "\\b\\([^ \n\t]+\\)[ \n\t]+\\1\\b"
+		(re-search-forward "\\(\\w+\\)\\s-+\\1\\>"
 				   end 'move))
       (flyspell-word)
       (backward-word 1))
@@ -1708,7 +1711,9 @@
 	    ;; now we can use a new overlay
 	    (setq flyspell-overlay
 		  (make-flyspell-overlay
-		   beg end 'flyspell-incorrect 'highlight)))))))
+		   beg end
+		   (if (eq poss 'doublon) 'flyspell-duplicate 'flyspell-incorrect)
+		   'highlight)))))))
 
 ;;*---------------------------------------------------------------------*/
 ;;*    flyspell-highlight-duplicate-region ...                          */