From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Agustin Martin Newsgroups: gmane.emacs.devel Subject: flyspell.el: patch for doublons checking from flyspell-large-region Date: Wed, 28 Jun 2006 13:00:43 +0200 Message-ID: <20060628110043.GA8875@agmartin.aq.upm.es> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="zYM0uCDKw75PZbzx" X-Trace: sea.gmane.org 1151492488 24609 80.91.229.2 (28 Jun 2006 11:01:28 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 28 Jun 2006 11:01:28 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jun 28 13:01:27 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FvXnR-0001cS-L0 for ged-emacs-devel@m.gmane.org; Wed, 28 Jun 2006 13:01:25 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FvXnR-0004Wn-8E for ged-emacs-devel@m.gmane.org; Wed, 28 Jun 2006 07:01:25 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FvXn7-0004TJ-BD for emacs-devel@gnu.org; Wed, 28 Jun 2006 07:01:05 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FvXn2-0004QV-M5 for emacs-devel@gnu.org; Wed, 28 Jun 2006 07:01:04 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FvXn2-0004QP-HY for emacs-devel@gnu.org; Wed, 28 Jun 2006 07:01:00 -0400 Original-Received: from [138.100.4.49] (helo=edison.ccupm.upm.es) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1FvXzL-0007Fe-5M for emacs-devel@gnu.org; Wed, 28 Jun 2006 07:13:43 -0400 Original-Received: from mala.aq.upm.es (Agmartin.aq.upm.es [138.100.41.131]) by edison.ccupm.upm.es (8.13.6/8.13.6) with ESMTP id k5SB0hJj025113; Wed, 28 Jun 2006 13:00:43 +0200 Original-Received: by mala.aq.upm.es (Postfix, from userid 1000) id E9F14313E; Wed, 28 Jun 2006 13:00:43 +0200 (CEST) Original-To: emacs-devel@gnu.org Mail-Followup-To: emacs-devel@gnu.org Content-Disposition: inline User-Agent: Mutt/1.5.11+cvs20060403 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:56244 Archived-At: --zYM0uCDKw75PZbzx Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi, In the current implementation, flyspell-large-region does not check for adjacent duplicated words (doublons), while flyspell-mode does. I am attaching a patch that tries to make sure that region is also checked for doublons when using flyspell-large-region. Proposed flyspell.el changelog entry: (flyspell-check-region-doublons) New function to check for adjacent duplicated words (doublons) in the given region. (flyspell-large-region) Use it. -- Agustin --zYM0uCDKw75PZbzx Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="flyspell.el.check-large-region-doublons.diff" --- flyspell.el.orig 2006-06-28 12:01:43.000000000 +0200 +++ flyspell.el 2006-06-28 12:19:39.000000000 +0200 @@ -1455,6 +1455,22 @@ (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)) + (goto-char end) + (flyspell-word))) + ;;*---------------------------------------------------------------------*/ ;;* flyspell-large-region ... */ ;;*---------------------------------------------------------------------*/ @@ -1499,7 +1515,8 @@ (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..."))))) --zYM0uCDKw75PZbzx Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel --zYM0uCDKw75PZbzx--