summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChong Yidong <cyd@stupidchicken.com>2006-10-22 21:29:33 +0000
committerChong Yidong <cyd@stupidchicken.com>2006-10-22 21:29:33 +0000
commit6b8aed24fe5456035382e6ecdea49e772936ce50 (patch)
tree92d2bf240453c47eef30333b3d6c5a6cb13d042d
parent224ca9c976305d1fa2d3d1c38dbd2e687488b167 (diff)
downloademacs-6b8aed24fe5456035382e6ecdea49e772936ce50.tar.gz
* 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.
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/textmodes/flyspell.el19
2 files changed, 18 insertions, 7 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index ba5843541a4..b92bf13b0c3 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -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>
diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el
index e7b95c9619d..e452716d83d 100644
--- a/lisp/textmodes/flyspell.el
+++ b/lisp/textmodes/flyspell.el
@@ -1011,11 +1011,14 @@ Mostly we check word delimiters."
(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 @@ The buffer to mark them in is `flyspell-large-region-buffer'."
(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 @@ is itself incorrect, but suspiciously repeated."
;; 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 ... */