[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: |
Sat, 2 Jun 2018 13:02:28 +0000 |
User-agent: |
Mutt/1.9.4 (2018-02-28) |
Hello, João.
On Thu, May 31, 2018 at 19:37:22 +0100, João Távora wrote:
> Alan Mackenzie <address@hidden> writes:
> > Hello, João
> >
> > On Thu, May 31, 2018 at 17:07:43 +0100, João Távora wrote:
[ .... ]
> > Yes. A string in C(++) mode extending over several lines is only
> > valid when the newlines are escaped. The generic string syntax is
> > partly an artifice to get font-lock-warning-face, but is also
> > deliberately intended to cut the opener of the invalid string off
> > from any subsequent double quote.
> But is there another goal here, apart from the goal of visually
> annotating the error?
Well, "error" might be putting it a bit strongly. Mainly, it's a
reminder to somebody typing in a string to close it off properly.
> If the intent is only to annotate the error visually, I'd rather leave
> that to something like Flymake. Admiteddly, it's not practical now,
> since Flymake usually works by running the whole buffer through an
> external syntax check tool, which may take ages compared to using syntax
> hints from within emacs.
> But that could be changed, my goal is to let Flymake call backends with
> only recently changed parts of the buffer, and a much faster
> syntax-checking backend could be devised.
All I can reply with, at the moment, is ... Hmmmm. :-)
> Which reminds me, I never did get an answer to
> https://lists.gnu.org/archive/html/emacs-devel/2017-10/msg00448.html
> did I?
No, but you've got one now. :-)
> > OK. I'll need to mull this over.
> OK, do. If you come to the conclusion that it is very important, and
> when the code becomes stable, I can can increase the complexity of
> elec-pair.el a bit to make it work in c++-mode.
I think the increase in complexity would be quite small, and very local.
> BTW do all cc-based modes "forbid" multi-line strings?
No. Pike Mode has a special feature whereby a string starting with #" is
a multiline string. I think in D Mode (not maintained here), strings
simply are multiline, and there is no such thing as an escaped EOL.
The writer of the mode sets the CC Mode "language variable"
c-multiline-string-start-char to the character # for Pike Mode, or some
non-character non-nil value for D Mode (usually t, of course).
[ .... ]
> João
--
Alan Mackenzie (Nuremberg, Germany).
- Re: CC Mode and electric-pair "problem".,
Alan Mackenzie <=
- Re: CC Mode and electric-pair "problem"., Glenn Morris, 2018/06/17
- Re: CC Mode and electric-pair "problem"., Alan Mackenzie, 2018/06/17
- Re: CC Mode and electric-pair "problem"., Stefan Monnier, 2018/06/17
- Re: CC Mode and electric-pair "problem"., João Távora, 2018/06/17
- Re: CC Mode and electric-pair "problem"., Alan Mackenzie, 2018/06/18
- Re: CC Mode and electric-pair "problem"., João Távora, 2018/06/18
- Re: CC Mode and electric-pair "problem"., Eli Zaretskii, 2018/06/18
- Re: CC Mode and electric-pair "problem"., João Távora, 2018/06/18
- Re: CC Mode and electric-pair "problem"., Eli Zaretskii, 2018/06/18