From: martin rudalics <rudalics@gmx.at>
To: Chong Yidong <cyd@stupidchicken.com>
Cc: Glenn Morris <rgm@gnu.org>, Nick Roberts <nickrob@snap.net.nz>,
rms@gnu.org, emacs-devel@gnu.org
Subject: Re: Kevin Rodgers changes
Date: Sat, 07 Apr 2007 09:32:07 +0200 [thread overview]
Message-ID: <461748F7.7000905@gmx.at> (raw)
In-Reply-To: <87odm1l32i.fsf_-_@stupidchicken.com>
[-- Attachment #1: Type: text/plain, Size: 1576 bytes --]
> 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.
[-- Attachment #2: flyspell0704.patch --]
[-- Type: text/plain, Size: 5174 bytes --]
*** 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)
[-- Attachment #3: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel
next prev parent reply other threads:[~2007-04-07 7:32 UTC|newest]
Thread overview: 83+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-22 17:23 display-completion-list should not strip text properties Drew Adams
2007-01-22 18:56 ` Stefan Monnier
2007-01-23 2:07 ` Richard Stallman
2007-01-23 5:10 ` Drew Adams
2007-01-23 21:32 ` Drew Adams
2007-01-24 8:22 ` Richard Stallman
2007-01-24 23:43 ` Johan Bockgård
2007-01-25 10:53 ` Richard Stallman
2007-01-26 13:17 ` Vinicius Jose Latorre
2007-01-27 0:46 ` Richard Stallman
2007-09-01 19:56 ` Drew Adams
2007-09-02 18:52 ` Juri Linkov
2007-09-03 18:25 ` Richard Stallman
2007-09-03 23:48 ` Juri Linkov
2007-09-04 5:59 ` David Kastrup
2007-09-04 9:52 ` Juri Linkov
2007-09-04 8:49 ` tomas
2007-09-04 9:54 ` Juri Linkov
2007-09-04 10:56 ` Johan Bockgård
2007-09-04 22:58 ` Richard Stallman
2007-09-04 16:45 ` Richard Stallman
2007-09-04 18:51 ` Drew Adams
2007-09-04 22:46 ` Davis Herring
2007-09-05 6:16 ` Richard Stallman
2007-09-05 14:21 ` Drew Adams
2007-09-06 4:59 ` Richard Stallman
2007-09-06 16:35 ` Drew Adams
2007-09-06 20:04 ` Edward O'Connor
2007-09-06 20:16 ` Drew Adams
2007-09-06 23:08 ` Robert J. Chassell
2007-09-06 23:42 ` Davis Herring
2007-09-07 12:30 ` Robert J. Chassell
2007-09-08 7:00 ` Richard Stallman
2007-09-07 19:53 ` Richard Stallman
2007-09-07 22:07 ` Drew Adams
2007-09-06 20:06 ` David Kastrup
2007-09-06 20:22 ` Drew Adams
2007-09-07 6:31 ` Richard Stallman
2007-09-05 6:16 ` Richard Stallman
2007-03-20 22:36 ` Drew Adams
2007-04-02 16:55 ` Drew Adams
2007-04-02 18:51 ` Kim F. Storm
2007-04-03 21:40 ` Richard Stallman
2007-04-03 21:53 ` Juanma Barranquero
2007-04-04 14:03 ` Richard Stallman
2007-04-03 22:03 ` Nick Roberts
2007-04-04 14:03 ` Richard Stallman
2007-04-04 14:59 ` Chong Yidong
2007-04-05 23:11 ` Richard Stallman
2007-04-05 23:20 ` Chong Yidong
2007-04-06 19:47 ` Richard Stallman
2007-04-05 23:45 ` Nick Roberts
2007-04-06 1:15 ` Glenn Morris
2007-04-06 1:59 ` Chong Yidong
2007-04-06 2:22 ` David Kastrup
2007-04-06 4:18 ` Glenn Morris
2007-04-06 8:41 ` Eli Zaretskii
2007-04-06 14:47 ` Chong Yidong
2007-04-06 16:26 ` Kim F. Storm
2007-04-06 17:34 ` Eli Zaretskii
2007-04-07 12:40 ` Richard Stallman
2007-04-06 17:06 ` Kim F. Storm
2007-04-06 19:23 ` Kevin Rodgers changes Chong Yidong
2007-04-07 7:32 ` martin rudalics [this message]
2007-04-07 12:40 ` Richard Stallman
2007-04-07 16:57 ` Chong Yidong
2007-04-07 17:34 ` Eli Zaretskii
2007-04-08 12:28 ` Richard Stallman
2007-04-08 21:07 ` Eli Zaretskii
2007-04-09 14:33 ` Daniel Brockman
2007-04-09 15:42 ` Richard Stallman
2007-04-08 21:30 ` Chong Yidong
2007-04-09 15:42 ` Richard Stallman
2007-04-11 16:38 ` display-completion-list should not strip text properties Markus Triska
2007-04-11 17:13 ` Chong Yidong
2007-04-06 19:47 ` Richard Stallman
2007-04-06 8:42 ` Eli Zaretskii
2007-04-06 19:47 ` Richard Stallman
2007-04-04 17:45 ` Edward O'Connor
2007-04-05 14:36 ` Chong Yidong
2007-04-05 15:02 ` Juanma Barranquero
2007-04-05 23:11 ` Richard Stallman
2007-01-24 7:07 ` Kevin Rodgers
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=461748F7.7000905@gmx.at \
--to=rudalics@gmx.at \
--cc=cyd@stupidchicken.com \
--cc=emacs-devel@gnu.org \
--cc=nickrob@snap.net.nz \
--cc=rgm@gnu.org \
--cc=rms@gnu.org \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.