bug#19846: 25.0.50; Problem with auto-fill-mode and C mode
Alan Mackenzie <[email protected]> Sun, 1 May 2022 11:35:56 +0000
| Newsgroups | gmane.emacs.cc-mode.general |
|---|---|
| Message-ID | <Ym5wnNUf/qHOVi9F@ACM> |
Hello, Lars. On Sun, May 01, 2022 at 12:08:58 +0200, Lars Ingebrigtsen wrote: > martin rudalics <[email protected]> writes: > > Here the impact is felt immediately, probably because of the way I build > > Emacs. Inserting 72 spaces doesn't make much sense anyway, so this is > > not what's bothering me. But here inserting _any_ character with auto > > filling turned on is a pain. I'm usually typing 2 to 3 characters ahead > > of what I see on screen. > (I'm going through old bug reports that unfortunately weren't resolved > at the time.) > I tried reproducing this, but inserting characters normally in that doc > string seems to be quite speedy. It's not until I have about two > hundred spaces at the start of the line that I start seeing hangs. You've got a fast machine, perhaps. :-) > Are you still seeing these issues in recent Emacs versions? I still see them. What's more, I know exactly what's causing the hangs. In forward-paragraph, a regular expression is formed by concatenating the major mode's paragraph-start and paragraph-separate with a few other things. In CC Mode (at least), this gives rise to ill-formed regexps with adjacent sub-expressions which each can match the empty string, or arbitrary numbers of spaces. When there fails to be a match, the regexp engine tries in every possible way to find a match, and thus failing to find one takes a long time. I started work on a library to fix ill-formed regexps in 2015, and after a long gap, recently re-started work on it. Although there is still quite a bit to do on it, I can see my way to finishing it. This would fix the cause of the bug properly. Perhaps I may be able to make the current state available on a git branch under scratch "soon". So, can you leave this bug open, please? > -- > (domestic pets only, the antidote for overdose, milk.) > bloggy blog: http://lars.ingebrigtsen.no -- Alan Mackenzie (Nuremberg, Germany).