diff options
| author | Chong Yidong | 2006-09-16 15:05:47 +0000 |
|---|---|---|
| committer | Chong Yidong | 2006-09-16 15:05:47 +0000 |
| commit | 5c823193ae0d707c4716fdd87643b707dcaa53cc (patch) | |
| tree | 5059f525d30847b02d81753dc30cea63a8e8c204 /lisp/textmodes | |
| parent | 77745e189236a5303052b462a2879a7f5689c5a3 (diff) | |
| download | emacs-5c823193ae0d707c4716fdd87643b707dcaa53cc.tar.gz emacs-5c823193ae0d707c4716fdd87643b707dcaa53cc.zip | |
* textmodes/flyspell.el (flyspell-check-region-doublons): New
function to detect duplicated words.
(flyspell-large-region): Use it.
Diffstat (limited to 'lisp/textmodes')
| -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'." | |||
| 1460 | (while (re-search-forward regexp nil t) | 1460 | (while (re-search-forward regexp nil t) |
| 1461 | (delete-region (match-beginning 0) (match-end 0))))))))) | 1461 | (delete-region (match-beginning 0) (match-end 0))))))))) |
| 1462 | 1462 | ||
| 1463 | ;;* --------------------------------------------------------------- | ||
| 1464 | ;;* flyspell-check-region-doublons | ||
| 1465 | ;;* --------------------------------------------------------------- | ||
| 1466 | (defun flyspell-check-region-doublons (beg end) | ||
| 1467 | "Check for adjacent duplicated words (doublons) in the given region." | ||
| 1468 | (save-excursion | ||
| 1469 | (goto-char beg) | ||
| 1470 | (flyspell-word) ; Make sure current word is checked | ||
| 1471 | (backward-word 1) | ||
| 1472 | (while (and (< (point) end) | ||
| 1473 | (re-search-forward "\\b\\([^ \n\t]+\\)[ \n\t]+\\1\\b" | ||
| 1474 | end 'move)) | ||
| 1475 | (flyspell-word) | ||
| 1476 | (backward-word 1)) | ||
| 1477 | (flyspell-word))) | ||
| 1478 | |||
| 1463 | ;;*---------------------------------------------------------------------*/ | 1479 | ;;*---------------------------------------------------------------------*/ |
| 1464 | ;;* flyspell-large-region ... */ | 1480 | ;;* flyspell-large-region ... */ |
| 1465 | ;;*---------------------------------------------------------------------*/ | 1481 | ;;*---------------------------------------------------------------------*/ |
| @@ -1504,7 +1520,8 @@ The buffer to mark them in is `flyspell-large-region-buffer'." | |||
| 1504 | (progn | 1520 | (progn |
| 1505 | (flyspell-process-localwords buffer) | 1521 | (flyspell-process-localwords buffer) |
| 1506 | (with-current-buffer curbuf | 1522 | (with-current-buffer curbuf |
| 1507 | (flyspell-delete-region-overlays beg end)) | 1523 | (flyspell-delete-region-overlays beg end) |
| 1524 | (flyspell-check-region-doublons beg end)) | ||
| 1508 | (flyspell-external-point-words)) | 1525 | (flyspell-external-point-words)) |
| 1509 | (error "Can't check region..."))))) | 1526 | (error "Can't check region..."))))) |
| 1510 | 1527 | ||