1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-14 09:39:42 +00:00

* textmodes/flyspell.el (flyspell-check-region-doublons): New

function to detect duplicated words.
	(flyspell-large-region): Use it.
This commit is contained in:
Chong Yidong 2006-09-16 15:05:47 +00:00
parent 77745e1892
commit 5c823193ae
2 changed files with 24 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2006-09-16 Agustin Martin <agustin.martin@hispalinux.es>
* textmodes/flyspell.el (flyspell-check-region-doublons): New
function to detect duplicated words.
(flyspell-large-region): Use it.
2006-09-16 Chong Yidong <cyd@stupidchicken.com>
* simple.el (line-move-to-column): Revert 2006-08-03 change.

View File

@ -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...")))))