From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.devel Subject: Re: Kevin Rodgers changes Date: Sat, 07 Apr 2007 09:32:07 +0200 Message-ID: <461748F7.7000905@gmx.at> References: <878xd8dw3d.fsf@stupidchicken.com> <17941.35328.281122.300772@farnswood.snap.net.nz> <5y7isq2tho.fsf@fencepost.gnu.org> <87d52ifekm.fsf@stupidchicken.com> <87odm1l32i.fsf_-_@stupidchicken.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------040209090706040400060501" X-Trace: sea.gmane.org 1175931346 3210 80.91.229.12 (7 Apr 2007 07:35:46 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 7 Apr 2007 07:35:46 +0000 (UTC) Cc: Glenn Morris , Nick Roberts , rms@gnu.org, emacs-devel@gnu.org To: Chong Yidong Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Apr 07 09:35:01 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Ha5Rs-0001Zo-07 for ged-emacs-devel@m.gmane.org; Sat, 07 Apr 2007 09:35:00 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ha5VQ-0000Rm-K9 for ged-emacs-devel@m.gmane.org; Sat, 07 Apr 2007 03:38:40 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ha5Ur-0008Vv-2Q for emacs-devel@gnu.org; Sat, 07 Apr 2007 03:38:05 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Ha5Up-0008Sw-3s for emacs-devel@gnu.org; Sat, 07 Apr 2007 03:38:04 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ha5Uo-0008SJ-TS for emacs-devel@gnu.org; Sat, 07 Apr 2007 03:38:02 -0400 Original-Received: from mail.gmx.net ([213.165.64.20]) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1Ha5RB-0000Ou-Nk for emacs-devel@gnu.org; Sat, 07 Apr 2007 03:34:19 -0400 Original-Received: (qmail invoked by alias); 07 Apr 2007 07:34:12 -0000 Original-Received: from N834P026.adsl.highway.telekom.at (EHLO [62.47.48.58]) [62.47.48.58] by mail.gmx.net (mp017) with SMTP; 07 Apr 2007 09:34:12 +0200 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX18QATRA40YQLUklfSMll0jLZZM/ZbIvWPY7NbF7lG LZCXrOFU6K5zVd User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: de-DE, de, en-us, en In-Reply-To: <87odm1l32i.fsf_-_@stupidchicken.com> X-Y-GMX-Trusted: 0 X-detected-kernel: Linux 2.6, seldom 2.4 (older, 4) 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:69152 Archived-At: This is a multi-part message in MIME format. --------------040209090706040400060501 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit > 2006-01-27 textmodes/flyspell.el > (flyspell-incorrect, flyspell-duplicate): Doc fix. Rather than reverting I'd propose to fix that as in the attached patch. That patch also simplifies the corresponding code and fixes a bug you should be able to reproduce as follows: (1) Set `flyspell-duplicate-distance' to 12 and enable `flyspell-mode'. (2) In an empty buffer insert the single line: worryin and worryin Both occurrences of "worryin" should get highlighted with `flyspell-duplicate' face. (3) Correct the second occurrence of "worryin" to "worrying". Thus your line should read as: worryin and worrying with the highlighting removed from the second occurrence. (4) Moving the cursor to the first "worryin" should get you now Error in post-command-hook: (error Invalid search bound (wrong side of point)) virtually disabling `flyspell-mode'. The bug is caused within (defun flyspell-word-search-forward (word bound) (save-excursion (let ((r '()) (inhibit-point-motion-hooks t) p) (while (and (not r) (setq p (search-forward word bound t))) (let ((lw (flyspell-get-word '()))) (if (and (consp lw) (string-equal (car lw) word)) (setq r p) (goto-char (1+ p))))) r))) Note that the string " and worryin" contains exactly 12 characters. `search-forward' stops after having found the second "worryin" but the subsequent conditional fails since "worrying is correct". `bound' still refers to the position after "worryin" but `point' gets set to the position after "worrying" raising the wrong side of point error. --------------040209090706040400060501 Content-Type: text/plain; name="flyspell0704.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="flyspell0704.patch" *** flyspell.el.~1.116.~ Mon Apr 2 07:45:14 2007 --- flyspell.el Sat Apr 7 08:37:24 2007 *************** *** 79,91 **** :type 'boolean) (defcustom flyspell-duplicate-distance -1 ! "The maximum distance for finding duplicates of unrecognized words. ! This applies to the feature that when a word is not found in the dictionary, ! if the same spelling occurs elsewhere in the buffer, ! Flyspell uses a different face (`flyspell-duplicate') to highlight it. ! This variable specifies how far to search to find such a duplicate. ! -1 means no limit (search the whole buffer). ! 0 means do not search for duplicate unrecognized spellings." :group 'flyspell :version "21.1" :type 'number) --- 79,92 ---- :type 'boolean) (defcustom flyspell-duplicate-distance -1 ! "Maximum distance of duplicate misspellings. ! By default Flyspell highlights single occurrences of a misspelled word ! with `flyspell-incorrect' face and multiple occurrences with ! `flyspell-duplicate' face. This variable specifies how far Flyspell may ! go to find multiple occurrences. -1 means no limit \(search the entire ! buffer). 0 means do not search at all \(that is, highlight every ! occurrence of a misspelled word with `flyspell-incorrect'). Any other ! non-negative number specifies the maximum number of characters to go." :group 'flyspell :version "21.1" :type 'number) *************** *** 431,437 **** (defface flyspell-incorrect '((((class color)) (:foreground "OrangeRed" :bold t :underline t)) (t (:bold t))) ! "Face used to display a misspelled word in Flyspell." :group 'flyspell) ;; backward-compatibility alias (put 'flyspell-incorrect-face 'face-alias 'flyspell-incorrect) --- 432,441 ---- (defface flyspell-incorrect '((((class color)) (:foreground "OrangeRed" :bold t :underline t)) (t (:bold t))) ! "Face for highlighting misspelled words. ! This face is used for highlighting single occurrences of misspelled ! words. Multiple occurrences are highlighted with `flyspell-duplicate' ! face." :group 'flyspell) ;; backward-compatibility alias (put 'flyspell-incorrect-face 'face-alias 'flyspell-incorrect) *************** *** 439,445 **** (defface flyspell-duplicate '((((class color)) (:foreground "Gold3" :bold t :underline t)) (t (:bold t))) ! "Face used to display subsequent occurrences of a misspelled word. See also `flyspell-duplicate-distance'." :group 'flyspell) ;; backward-compatibility alias --- 443,449 ---- (defface flyspell-duplicate '((((class color)) (:foreground "Gold3" :bold t :underline t)) (t (:bold t))) ! "Face for highlighting multiple occurrences of misspelled words. See also `flyspell-duplicate-distance'." :group 'flyspell) ;; backward-compatibility alias *************** *** 991,997 **** (let ((lw (flyspell-get-word '()))) (if (and (consp lw) (string-equal (car lw) word)) (setq r p) ! (goto-char (1+ p))))) r))) ;;*---------------------------------------------------------------------*/ --- 995,1001 ---- (let ((lw (flyspell-get-word '()))) (if (and (consp lw) (string-equal (car lw) word)) (setq r p) ! (goto-char p)))) r))) ;;*---------------------------------------------------------------------*/ *************** *** 1094,1123 **** (if (> end start) (flyspell-unhighlight-at (- end 1))) t) ! ((or (and (< flyspell-duplicate-distance 0) ! (or (save-excursion ! (goto-char start) ! (flyspell-word-search-backward ! word ! (point-min))) ! (save-excursion ! (goto-char end) ! (flyspell-word-search-forward ! word ! (point-max))))) ! (and (> flyspell-duplicate-distance 0) ! (or (save-excursion ! (goto-char start) ! (flyspell-word-search-backward ! word ! (- start ! flyspell-duplicate-distance))) ! (save-excursion ! (goto-char end) ! (flyspell-word-search-forward ! word ! (+ end ! flyspell-duplicate-distance)))))) ;; This is a misspelled word which occurs ;; twice within flyspell-duplicate-distance. (setq flyspell-word-cache-result nil) --- 1098,1120 ---- (if (> end start) (flyspell-unhighlight-at (- end 1))) t) ! ((and (not (zerop flyspell-duplicate-distance)) ! (or (save-excursion ! (goto-char start) ! (flyspell-word-search-backward ! word ! (if (< flyspell-duplicate-distance 0) ! (point-min) ! (- start ! flyspell-duplicate-distance)))) ! (save-excursion ! (goto-char end) ! (flyspell-word-search-forward ! word ! (if (< flyspell-duplicate-distance 0) ! (point-max) ! (+ end ! flyspell-duplicate-distance)))))) ;; This is a misspelled word which occurs ;; twice within flyspell-duplicate-distance. (setq flyspell-word-cache-result nil) --------------040209090706040400060501 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 --------------040209090706040400060501--