[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Kevin Rodgers changes
From: |
martin rudalics |
Subject: |
Re: Kevin Rodgers changes |
Date: |
Sat, 07 Apr 2007 09:32:07 +0200 |
User-agent: |
Mozilla Thunderbird 1.0 (Windows/20041206) |
> 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.
*** 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)
- Re: display-completion-list should not strip text properties, (continued)
- Re: display-completion-list should not strip text properties, Chong Yidong, 2007/04/05
- Re: display-completion-list should not strip text properties, David Kastrup, 2007/04/05
- Re: display-completion-list should not strip text properties, Glenn Morris, 2007/04/06
- Re: display-completion-list should not strip text properties, Eli Zaretskii, 2007/04/06
- Re: display-completion-list should not strip text properties, Chong Yidong, 2007/04/06
- Re: display-completion-list should not strip text properties, Kim F. Storm, 2007/04/06
- Re: display-completion-list should not strip text properties, Eli Zaretskii, 2007/04/06
- Re: display-completion-list should not strip text properties, Richard Stallman, 2007/04/07
- Re: display-completion-list should not strip text properties, Kim F. Storm, 2007/04/06
- Kevin Rodgers changes, Chong Yidong, 2007/04/06
- Re: Kevin Rodgers changes,
martin rudalics <=
- Re: Kevin Rodgers changes, Richard Stallman, 2007/04/07
- Re: Kevin Rodgers changes, Chong Yidong, 2007/04/07
- Re: Kevin Rodgers changes, Eli Zaretskii, 2007/04/07
- Re: Kevin Rodgers changes, Richard Stallman, 2007/04/08
- Re: Kevin Rodgers changes, Eli Zaretskii, 2007/04/08
- Re: Kevin Rodgers changes, Daniel Brockman, 2007/04/09
- Re: Kevin Rodgers changes, Richard Stallman, 2007/04/09
- Re: Kevin Rodgers changes, Chong Yidong, 2007/04/08
- Re: Kevin Rodgers changes, Richard Stallman, 2007/04/09
- Re: display-completion-list should not strip text properties, Markus Triska, 2007/04/11