diff options
author | Chong Yidong <cyd@stupidchicken.com> | 2006-09-16 15:05:47 +0000 |
---|---|---|
committer | Chong Yidong <cyd@stupidchicken.com> | 2006-09-16 15:05:47 +0000 |
commit | 5c823193ae0d707c4716fdd87643b707dcaa53cc (patch) | |
tree | 5059f525d30847b02d81753dc30cea63a8e8c204 /lisp/textmodes/flyspell.el | |
parent | 77745e189236a5303052b462a2879a7f5689c5a3 (diff) | |
download | emacs-5c823193ae0d707c4716fdd87643b707dcaa53cc.tar.gz |
* textmodes/flyspell.el (flyspell-check-region-doublons): New
function to detect duplicated words.
(flyspell-large-region): Use it.
Diffstat (limited to 'lisp/textmodes/flyspell.el')
-rw-r--r-- | lisp/textmodes/flyspell.el | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el index 34b6297a800..ebee4691e8c 100644 --- a/lisp/textmodes/flyspell.el +++ b/lisp/textmodes/flyspell.el @@ -1460,6 +1460,22 @@ The buffer to mark them in is `flyspell-large-region-buffer'." (while (re-search-forward regexp nil t) (delete-region (match-beginning 0) (match-end 0))))))))) +;;* --------------------------------------------------------------- +;;* flyspell-check-region-doublons +;;* --------------------------------------------------------------- +(defun flyspell-check-region-doublons (beg end) + "Check for adjacent duplicated words (doublons) in the given region." + (save-excursion + (goto-char beg) + (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" + end 'move)) + (flyspell-word) + (backward-word 1)) + (flyspell-word))) + ;;*---------------------------------------------------------------------*/ ;;* flyspell-large-region ... */ ;;*---------------------------------------------------------------------*/ @@ -1504,7 +1520,8 @@ The buffer to mark them in is `flyspell-large-region-buffer'." (progn (flyspell-process-localwords buffer) (with-current-buffer curbuf - (flyspell-delete-region-overlays beg end)) + (flyspell-delete-region-overlays beg end) + (flyspell-check-region-doublons beg end)) (flyspell-external-point-words)) (error "Can't check region..."))))) |