bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#39898: 28.0.50; The off-by-one bug in `flyspell-check-previous-highl


From: Stefan Kangas
Subject: bug#39898: 28.0.50; The off-by-one bug in `flyspell-check-previous-highlighted-word'
Date: Thu, 27 Aug 2020 12:37:45 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

tags 39898 + patch
thanks

OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> writes:

> With the following test,
>
> (with-temp-buffer
>   (select-window (display-buffer (current-buffer)))
>   (insert "appl")
>   (flyspell-buffer)
>   (flyspell-check-previous-highlighted-word))
>
> `flyspell-check-previous-highlighted-word' calls `(error)'.  But "appl"
> is the typo that should be fixed.
>
> At the following [**] mark in a that command, the ">" looks not allowing
> a typo at (point-min). Maybe the ">" should be the ">=".
>
> (defun flyspell-check-previous-highlighted-word (&optional arg)
>
> [...]
>
>           (if (> pos (point-min))      <- [**]
>
> [...]
>
>       (save-excursion
>         (goto-char pos)
>         (ispell-word)
>         (setq flyspell-word-cache-word nil) ;; Force flyspell-word re-check
>         (flyspell-word))
>       (error "No word to correct before point"))))

Indeed, this just looks like an OBOE to me.  The attached patch fixes it
as per your suggestion.

However, there is some stuff going on with `previous-overlay-change', so
it would be good if someone could double-check that the fix here is
correct.

AFAIU, this should work at the price that in a buffer with no misspelled
words we uselessly check if there's a misspelled word at point-min.

Best regards,
Stefan Kangas

Attachment: 0001-Fix-OBOE-in-flyspell-check-previous-highlighted-word.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]