GNU bug report logs - #54131
29.0.50; Flyspell incorrectly reports first word in Python f-string

Previous Next

Package: emacs;

Reported by: Philipp Stephani <p.stephani2 <at> gmail.com>

Date: Wed, 23 Feb 2022 18:17:02 UTC

Severity: normal

Found in version 29.0.50

Full log


Message #11 received at 54131 <at> debbugs.gnu.org (full text, mbox):

From: Philipp Stephani <p.stephani2 <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 54131 <at> debbugs.gnu.org
Subject: Re: bug#54131: 29.0.50; Flyspell incorrectly reports first word in
 Python f-string
Date: Wed, 23 Feb 2022 21:27:04 +0100
Am Mi., 23. Feb. 2022 um 21:13 Uhr schrieb Lars Ingebrigtsen <larsi <at> gnus.org>:
>
> Philipp Stephani <p.stephani2 <at> gmail.com> writes:
>
> > Given this Python file:
> >
> > $ cat /tmp/a.py
> > print(f'hello world')
> >
> > Visit it and enable Flyspell:
> >
> > $ emacs -Q /tmp/a.py -f flyspell-prog-mode
> >
> > Flyspell then marks the string "f'hello" as incorrect, thinking it's a
> > misspelling of "hello".  But it shouldn't cross the string boundary.
>
> Hm, yes.  In this case, the mode knows that f isn't part of the
> expression, but I guess we have no way of communicating that to ispell?
>
> Skimming ispell-get-word, it looks like it uses a regexp to determine
> what the word at point is, so we'd need to make some sort of framework
> to allow modes to say where a string begins and ends?

Like the syntax table? (nth 8 (syntax-ppss)) gives you the beginning
of the string, and that seems to give correct results even for
f-strings.




This bug report was last modified 3 years and 112 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.