Groups | Search | Server Info | Login | Register


Groups > gnu.emacs.help > #61010

Re: flyspell woe

From Jim Diamond <zsd@jdvb.ca>
Newsgroups gnu.emacs.help
Subject Re: flyspell woe
Date 2025-03-09 18:09 -0300
Organization A noiseless patient Spider
Message-ID <slrnvss0t2.1je.zsd@x360.localdomain> (permalink)
References <slrnvsoqbi.pne.zsd@x360.localdomain> <vqi5fm$1fdn$1@news.muc.de>

Show all headers | View raw


On 2025-03-08 at 15:23 AST, Alan Mackenzie <acm@muc.de> wrote:
> Jim <zsd@jdvb.ca> wrote:
>> Just in case anyone still checks this group...

> :-)

>> I recently upgraded to emacs 30.1.  For many years I had been using a
>> function which automatically corrected transposition errors, but it no
>> longer works in 30.1.  The author of that function kindly pointed me to the
>> fact that such functionality has been part of flyspell for a long time, and
>> that I should add
>>     (add-hook 'flyspell-incorrect-hook 'flyspell-maybe-correct-transposition)
>> to my init.el.

>> So I put that in my init.el and started typing away, only to discover that
>> it doesn't do exactly what I want.  To reproduce the problem,

>> (1) Replace your entire init.el with this one line:
>> (add-hook 'flyspell-incorrect-hook 'flyspell-maybe-correct-transposition)


>> (2) Create a file ABC like this
>> ----------------- cut here --------------------

>> ABC

>> ----------------- cut here --------------------

>> (3) Fire up a fresh emacs as follows:
>> emacs ABC

>> (4) Turn on flyspell
>> M-x flyspell-mode

>> (5) Navigate to the end of the 'abc' line

>> (6) Type Ctrl-T
>> I get "CAB", whereas I expect "ACB".

>> Now, I know that "cab" is an English word, and that "acb" is not, and
>> I presume flyspell is looking at "ACB" immediately after I do the Ctrl-T
>> and "fixes" the resulting spelling error.

>> (Finance wonks may recognize ACB as the abbreviation for "adjusted cost
>> base", so it is something I might actually want to type.  Yes, I could add
>> ACB to my dictionary, but that doesn't solve the problem in general.)

>> With my old setup in emacs 28.2, the transposition correction function was
>> only triggered when I typed a space (or maybe some other word-ending
>> character), so I could transpose two letters and then move away from the
>> "word" using something other than a space (e.g., arrow keys), and the text
>> would stay how I wanted it.

>> I don't immediately see any way to get the previous behaviour I liked.
>> Can anyone suggest a way to do this?

> What you have typed in this post is very close to a perfect bug report.
> As an ex Emacs developer, I would suggest you submit a bug report for
> this.  It feels like somebody decided to make flyspell "nicer" without
> thinking things through thoroughly.

> To submit a bug, either (preferred) M-x report-emacs-bug followed by
> doing the obvious (if you use Emacs for email), or just send an email to
> bug-gnu-emacs@gnu.org.  Either should get you an immediate
> acknowledgement, followed by a proper reply as soon as somebody actually
> looks at it.  This time is usually less than the previous sentence makes
> it sound.

>> (And if you are wondering... I rarely want to have "ACB", but I was typing
>> a message with some other three-letter acronym which kept getting changed
>> by flyspell, and getting the actual TLA that I wanted was a nuisance.)

> A bug indeed!

Thanks for the suggestion.  I reported a bug, but was firmly informed that
it isn't a bug.  So I will try to see what the problem with the old code
is.  Time to knock some of the rust off my elisp skills.

Cheers.
                                Jim

Back to gnu.emacs.help | Previous | NextPrevious in thread | Find similar


Thread

flyspell woe Jim <zsd@jdvb.ca> - 2025-03-08 11:59 -0400
  Re: flyspell woe Alan Mackenzie <acm@muc.de> - 2025-03-08 19:23 +0000
    Re: flyspell woe Jim Diamond <zsd@jdvb.ca> - 2025-03-09 18:09 -0300

csiph-web