emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Re: Algorithm in electric-pair--unbalanced-strings-p unsuita


From: João Távora
Subject: Re: [PATCH] Re: Algorithm in electric-pair--unbalanced-strings-p unsuitable for CC Mode
Date: Tue, 9 Jul 2019 19:53:17 +0100

On Tue, Jul 9, 2019 at 7:26 PM Alan Mackenzie <address@hidden> wrote:

> Not really.  The overwhelmingly most common use case is typing in a
> short string which fits on one line, when the next line is (almost)
> always a line of code.  It is not sensible to fontify arbitrarily large
> pieces of code as a string, just because the user hasn't yet reached her
> closing double quote.

You think that's the "overwhelmingly" most common use case. But if
the user is using electric-pair-mode (the thing you just "fixed", the thing
that the original author of the bug is using), it just doesn't happen. That's
not because those users don't insert strings in their code, but because
the closing double quote is inserted for them automatically. And so no
arbitrarily large piece of code is fontified as a string _in the particular case
of adding, say, a printf("Hello world"); to the start of a function.

Now if you don't use electric-pair-mode or another paren-matching
solution you will see the common blinking, precisely because the major
mode doesn't know if the user is keeping a closing quote in his
"mental stack". All that Stefan is saying is that you are providing for
this group of people, but that there is another group of people for which
not only the functionality you are developing isn't useful, but also
potentially harmful.

We all agree that if an unterminated string occurs, be it accidentally
by the deletion of a closing quote, or transiently (because the user
hasn't downloaded his "mental closing quote"), the matter should
be annotated on that line. There are multiple simple solutions that
do that, with no perceived drawbacks. Please consider some of them.

João

reply via email to

[Prev in Thread] Current Thread [Next in Thread]