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: Eli Zaretskii
Subject: bug#39898: 28.0.50; The off-by-one bug in `flyspell-check-previous-highlighted-word'
Date: Fri, 28 Aug 2020 08:56:22 +0300

> From: Stefan Kangas <stefan@marxist.se>
> Date: Thu, 27 Aug 2020 12:37:45 -0700
> Cc: 39898@debbugs.gnu.org
> 
> > 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.

Does it?  The doc string of flyspell-check-previous-highlighted-word
says:

  Correct the closest previous word that is highlighted as misspelled.
  This function scans for a word which starts before point that has been
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  highlighted by Flyspell as misspelled.

The test case, AFAIU, creates a situation where the misspelled word
starts _after_ point (remember that point is a place between 2
characters, and its value is the character following point).  So I
don't see a bug here.  Am I missing something?





reply via email to

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