[Top][All Lists]

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

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

From: Stefan Monnier
Subject: Re: [PATCH] Re: Algorithm in electric-pair--unbalanced-strings-p unsuitable for CC Mode
Date: Tue, 09 Jul 2019 13:11:51 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

>> Both are wrong sometimes and right at other times.
> Not really.

Yes, really.  Depending on your usage pattern one will be more frequent
than the other.  Maybe in your usage pattern the second almost never
happens, but that's definitely not the case in general.

> 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 can't know that "the user hasn't yet reached her
closing double quote".

> It is not up to the major mode to second guess the user.

On that we agree.

> It is the major mode's job to indicate the presence and position of an
> error as clearly as possible.

The error is on the first line of the string and it's indeed good to
highlight it (and font-lock.el should probably provide support for that).

What happens with the subsequent lines is a completely different question.

> CC Mode's fontification does this.

Yes, that's good (on the first line).


reply via email to

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