From: Chong Yidong Date: Sat, 16 Sep 2006 15:05:47 +0000 (+0000) Subject: * textmodes/flyspell.el (flyspell-check-region-doublons): New X-Git-Tag: emacs-pretest-22.0.90~520 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=5c823193ae0d707c4716fdd87643b707dcaa53cc;p=emacs.git * textmodes/flyspell.el (flyspell-check-region-doublons): New function to detect duplicated words. (flyspell-large-region): Use it. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 2aeb97e79ff..e349a82bab3 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2006-09-16 Agustin Martin + + * textmodes/flyspell.el (flyspell-check-region-doublons): New + function to detect duplicated words. + (flyspell-large-region): Use it. + 2006-09-16 Chong Yidong * simple.el (line-move-to-column): Revert 2006-08-03 change. 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...")))))