[Top][All Lists]

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

Re: CC Mode and electric-pair "problem".

From: Alan Mackenzie
Subject: Re: CC Mode and electric-pair "problem".
Date: Tue, 26 Jun 2018 20:09:04 +0000
User-agent: Mutt/1.9.4 (2018-02-28)

Hello, João.

On Tue, Jun 26, 2018 at 20:45:44 +0100, João Távora wrote:
> Hi Alan,

> Alan Mackenzie <address@hidden> writes:

> >> [ .... ]
> >> Maybe we're looking at this the wrong way.
> >> How about this idea: we add a new syntax flag to Emacs, ", which
> >> terminates any open string, the same way the syntax > terminates any
> >> open comment.  We could then set this syntax flag on newline.
> > This isn't a sensible idea. because it wouldn't solve any of the
> > problems we have with the string-fence syntax.

> You realize you're replying to your own suggestion, right? (just
> checking...)

I do, yes.  :-)

> > This would have the advantage of making fontification easy, whilst still
> > allowing syntactic operations within an invalid string.  For example, in

> >     char *foo = "(
> >     )"

> > , the "s would have "one-line string quote" syntax and be fontified with
> > warning face, but a C-M-n from the ( would still move point to after the
> > ), and all the electric-pair-mode stuff would still work.

> Ignoring any complications or complexity that would arise from it, that
> sounds great (though more important than supporting e-p-m is having
> C-M-u work from inside the string, which I suppose is included).

Indeed.  The whole point is that if the syntax scanning starts outside
the one-line string, the newline acts as a terminator.  If it starts
inside the string, the newline doesn't act as anything special.

The complications would come with things like scan-sexps, which when
starting after a newline and scanning backward, would have to check for a
one-line " in the line.  I don't see such complications as being

> João

Alan Mackenzie (Nuremberg, Germany).

reply via email to

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