unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
Cc: konrad.podczeck@univie.ac.at, emacs-devel@gnu.org
Subject: Re: [konrad.podczeck@univie.ac.at: flyspell bug]
Date: Sat, 21 Oct 2006 15:47:58 +0200	[thread overview]
Message-ID: <453A250E.3030306@gmx.at> (raw)
In-Reply-To: <E1GbFbM-0000Io-JC@fencepost.gnu.org>

[-- Attachment #1: Type: text/plain, Size: 685 bytes --]

> The recent incorporation into flyspell-large-region  of checking for 
> duplicated words has led to the following bug:
> 
> If a large region contains text of the form:
> 
> x$ $y
> 
> or of the form
> 
> x# #y
> 
> (where x and y may be any words and there may be multiple white spaces 
> between the $'s or #'s),
> then flyspell-large-region makes Emacs hanging (i.e. I have to press 
> Ctrl-g to make Emacs running again).
> 
> 
> I regard the following as a flyspell bug, too: If duplicated words are 
> separated by more than one white space, then they are not detected.

The attached patch tries to address these issues.  Please make sure that it
doesn't break anything else.


[-- Attachment #2: flyspell.patch --]
[-- Type: text/plain, Size: 2268 bytes --]

*** flyspell.el	Sat Oct 21 11:36:32 2006
--- flyspell.el	Sat Oct 21 15:44:44 2006
***************
*** 1011,1021 ****
  			  (not (memq (char-after (1- start)) '(?\} ?\\)))))
  		 flyspell-mark-duplications-flag
  		 (save-excursion
! 		   (goto-char (1- start))
! 		   (let ((p (flyspell-word-search-backward
! 			     word
! 			     (- start (1+ (- end start))))))
! 		     (and p (/= p (1- start))))))
  	    ;; yes, this is a doublon
  	    (flyspell-highlight-incorrect-region start end 'doublon)
  	    nil)
--- 1011,1022 ----
  			  (not (memq (char-after (1- start)) '(?\} ?\\)))))
  		 flyspell-mark-duplications-flag
  		 (save-excursion
! 		   (goto-char start)
! 		   (let* ((bound
! 			   (- start (- end start) (- (skip-chars-backward " \t\n\f"))))
! 			  (p (when (>= bound (point-min))
! 			       (flyspell-word-search-backward word bound))))
! 		     (and p (/= p start)))))
  	    ;; yes, this is a doublon
  	    (flyspell-highlight-incorrect-region start end 'doublon)
  	    nil)
***************
*** 1472,1478 ****
      (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))
--- 1473,1479 ----
      (flyspell-word)     ; Make sure current word is checked
      (backward-word 1)
      (while (and (< (point) end)
! 		(re-search-forward "\\(\\w+\\)\\s-+\\1\\>"
  				   end 'move))
        (flyspell-word)
        (backward-word 1))
***************
*** 1708,1714 ****
  	    ;; now we can use a new overlay
  	    (setq flyspell-overlay
  		  (make-flyspell-overlay
! 		   beg end 'flyspell-incorrect 'highlight)))))))

  ;;*---------------------------------------------------------------------*/
  ;;*    flyspell-highlight-duplicate-region ...                          */
--- 1709,1717 ----
  	    ;; now we can use a new overlay
  	    (setq flyspell-overlay
  		  (make-flyspell-overlay
! 		   beg end
! 		   (if (eq poss 'doublon) 'flyspell-duplicate 'flyspell-incorrect)
! 		   'highlight)))))))

  ;;*---------------------------------------------------------------------*/
  ;;*    flyspell-highlight-duplicate-region ...                          */

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

  reply	other threads:[~2006-10-21 13:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-21 12:05 [konrad.podczeck@univie.ac.at: flyspell bug] Richard Stallman
2006-10-21 13:47 ` martin rudalics [this message]
2006-10-22 21:30   ` Chong Yidong
2006-10-23  6:17     ` martin rudalics
2006-10-23 14:00       ` Chong Yidong
2006-10-23  5:11   ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=453A250E.3030306@gmx.at \
    --to=rudalics@gmx.at \
    --cc=emacs-devel@gnu.org \
    --cc=konrad.podczeck@univie.ac.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).