emacs-devel
[Top][All Lists]
Advanced

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

Re: Algorithm in electric-pair--unbalanced-strings-p unsuitable for CC M


From: Alan Mackenzie
Subject: Re: Algorithm in electric-pair--unbalanced-strings-p unsuitable for CC Mode
Date: Thu, 4 Jul 2019 15:24:51 +0000
User-agent: Mutt/1.10.1 (2018-07-13)

Hello, Stefan.

On Wed, Jul 03, 2019 at 12:58:32 -0400, Stefan Monnier wrote:
> > evasive and answer the point: can you suggest some other mechanism by
> > which CC Mode can create the required font-locking?

> Should be pretty easy: add a rule to font-lock-keywords (i.e. no change
> in syntax-tables) matching a double quote and which then checks with
> syntax-ppss if it's an opening or closing quote and whether the matching
> matching quote is on the same line or not (and applies a warning face
> accordingly).

Thanks.  That's part of the problem.  Another part is that syntax
fontification will have wrongly fontified the bits beyond the end of the
invalid string with font-lock-string-face.

I've had another idea - set these syntax-table properties as is done
currently, but only for the duration of font-lock-fontify-region.  That
way, the fontification should come out right, and João will be able to
do the things he wants to do with invalid strings.

I would do this in CC Mode by setting some text property instead of
syntax-table (let's call it c-fl-syn-tab), and just before font locking
happens, copying the value of these properties to the syntax-table
property.  And, of course, the reverse process after the font locking.
Or something like that.

>         Stefan

-- 
Alan Mackenzie (Nuremberg, Germany).



reply via email to

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