[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).
- Re: [PATCH] Re: Algorithm in electric-pair--unbalanced-strings-p unsuitable for CC Mode, (continued)
- Re: [PATCH] Re: Algorithm in electric-pair--unbalanced-strings-p unsuitable for CC Mode, João Távora, 2019/07/10
- Re: [PATCH] Re: Algorithm in electric-pair--unbalanced-strings-p unsuitable for CC Mode, Alan Mackenzie, 2019/07/10
- Re: [PATCH] Re: Algorithm in electric-pair--unbalanced-strings-p unsuitable for CC Mode, João Távora, 2019/07/10
- Re: [PATCH] Re: Algorithm in electric-pair--unbalanced-strings-p unsuitable for CC Mode, Alan Mackenzie, 2019/07/10
- Re: [PATCH] Re: Algorithm in electric-pair--unbalanced-strings-p unsuitable for CC Mode, Richard Stallman, 2019/07/10
- Re: Algorithm in electric-pair--unbalanced-strings-p unsuitable for CC Mode, Stefan Monnier, 2019/07/03
- Re: Algorithm in electric-pair--unbalanced-strings-p unsuitable for CC Mode, Stefan Monnier, 2019/07/03
- Re: Algorithm in electric-pair--unbalanced-strings-p unsuitable for CC Mode,
Alan Mackenzie <=
- Re: Algorithm in electric-pair--unbalanced-strings-p unsuitable for CC Mode, Stefan Monnier, 2019/07/04
- Re: Algorithm in electric-pair--unbalanced-strings-p unsuitable for CC Mode, Alan Mackenzie, 2019/07/04
- Re: Algorithm in electric-pair--unbalanced-strings-p unsuitable for CC Mode, Stefan Monnier, 2019/07/04
- Re: Algorithm in electric-pair--unbalanced-strings-p unsuitable for CC Mode, João Távora, 2019/07/04