GNU bug report logs -
#76884
30.1 problem with flyspell-maybe-correct-transposition
Previous Next
Full log
View this message in rfc822 format
> Date: Sat, 8 Mar 2025 20:50:26 -0400
> From: Jim Diamond <jim <at> jdvb.ca>
>
> 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 line in my init.el and started editing away, only to discover
> that it doesn't do exactly what I want. To reproduce the problem,
>
>
> (1) Create a file ABC like this
> ----------------- cut here --------------------
>
> ABC
>
> ----------------- cut here --------------------
>
> (2) Replace your entire init.el with this one line:
> (add-hook 'flyspell-incorrect-hook 'flyspell-maybe-correct-transposition)
> (Or start with "emacs -Q" and make the "obvious" changes to the procedure
> below.)
>
> (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
>
> Result: I get "CAB", whereas I expect "ACB". This is not merely
> unexpected, but an actual problem.
What causes that problem is that add-hook you did. If you want C-t to
transpose characters, and Flyspell to not react on C-t, then why did
you add to that hook?
IOW, I don't understand what scenario worked for you in older versions
of Emacs and no longer works in Emacs 30.1. Could you please show a
recipe, starting from "emacs -Q", which did NOT convert ABC into CAB
in Emacs 29 or earlier, but does with Emacs 30.1? Because if I try
using that add-hook in Emacs 28.2, I get the same result: ABC => CAB,
if I type C-t at the end of the ABC line. So I'm confused regarding
the problem which you found in Emacs 30 that didn't exist before.
> With my old setup in emacs 28 and before, the transposition correction
> function was triggered when emacs was about to see if there was an
> abbreviation to expand, so if I was anticipating a problem 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.
Sorry, I don't understand this description. Could you please show a
recipe with all the commands and key sequences explicit?
This bug report was last modified 156 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.