Subject: bug#32142: WG: 26.1; Problems with flyspell-region

From: Eli Zaretskii <[email-masked]>
Date: Sat, 14 Jul 2018 10:45:39 +0300

> Date: Fri, 13 Jul 2018 20:22:59 +0000 (UTC)
> From: "R. Diez" <[email-masked]>
> Cc: "[email-masked]" <[email-masked]>
> 
> > That description is inaccurate.  The misspelled words _are_
> > highlighted, but then the highlight is removed when
> > cursor moves to the next word, per the intended effect of
> > flyspell-persistent-highlight being nil.
> Once more, that is only the case if flyspell-mode is on. If flyspell-mode is off, and flyspell-persistent-highlight is also off, CPU usage goes up for a short time, and nothing gets marked. That is weird.

I think the difference in what we see is related to the size of the
region.  See the variable 'flyspell-large-region'.

> > We don't have a spell-checking feature that watches correction of
> > misspelled words without turning on flyspell-mode.
> 
> OK, I gather from your comments that flyspell-region is designed to work with flyspell-mode turned on. And that you are unable or unwilling to change that. That limitation is not obvious. In fact, I would argue that users would expect exactly the opposite from flyspell-region.
> 
> 
> I request that flyspell-region documents this fact, and/or checks whether flyspell-mode is off and/or flyspell-persistent-highlight is off.

I added the caveats to the doc strings of the relevant functions and
variables.

I object to the "unable or unwilling" part of your complaint.  I was
just stating the fact that the feature you expected was missing from
Emacs, because no one designed and coded it.  There's no need to hint
on my (non-existent) personal motives and abilities in this matter.
This is a volunteer project, and thus will alone is not enough to make
things happen.  I did my share of minor changes and fixes in
flyspell.el, but I'm by no means the only one who is responsible for
what happens there.

> That would make it clear where the limitations of Flyspell are, and avoid wasting time when it does not work as one probably expects. Because, as I mentioned, 
> flyspell-region actually makes little sense if you need to have flyspell-mode turned on.

FWIW, it makes a lot of sense to me: Flyspell mode is a coherent set
of features that are supposed to be used as a whole.  I am actually
quite surprised that someone could expect flyspell-region to work
outside of the mode.  Anyway, this is now stated explicitly in the doc
string.

> ispell-region seems to be no good substitute for what flyspell-region should actually do. After running ispell-region, you cannot move the cursor freely around and comfortably correct words. It is very awkward to use.

??? Did you read the help provided by ispell-region?  You could
either:

  . type 'X' to exit spell-check temporarily, correct the word at
    point, then type 'C-u M-$' to resume spell-checking (the latter
    command is shown in the echo area when you type 'X'); or
  . enter recursive-edit with 'C-r', edit the text as you wish, then
    exit recursive-edit with 'C-M-c' (again, the echo area shows the
    command to exit when you type 'C-r') and continue spell-checking; or
  . type 'r' which will allow you to replace the misspelled word with
    the text you type in the minibuffer; or
  . type 'R', which works like 'r', but also lets you replace all the
    other words in the buffer like the one replaced here.

These commands (and others) are listed if you type '?' and in more
detail by 'C-h f ispell-help', which is mentioned in the text shown
by '?'.

IME, ispell-region is a very convenient feature for spell-checking
large regions of text, much more convenient than flyspell-region.
YMMV, of course.