* C/C++/ObjC Modes: Right thing now done with unbalanced string quotes and unmatched parens in CPP lines.
@ 2008-02-19 23:04 Alan Mackenzie
2008-02-19 23:48 ` Glenn Morris
0 siblings, 1 reply; 3+ messages in thread
From: Alan Mackenzie @ 2008-02-19 23:04 UTC (permalink / raw)
To: emacs-devel, Richard Stallman
Hi, Emacs and Richard!
I have just amended CC Mode (in the EMACS_22 branch, but not yet in the
trunk) so that it does the Right Thing with code such as:
1 #ifdef 0 /* comment
2 second line of comment. */
3 #warning for isn't a keyword here. (
4 //#warning for isnt a keyword here.
5 void foo (bar)
6 {
7 #error }
8 printf ("Hello, world!\n") ; /* the famous one liner! */
9 }
In particular:
L3: the apostrophe no longer disturbs the fontification after EOL.
L3: the pseudo-paren doesn't mess up paren-matching. C-M-n here has no
effect.
L6,7: The L6 brace doesn't match with the L7 pseudo-brace.
L9: The brace correctly matches that on L6.
The fix works by setting syntax-table properties on all syntactically
"obtrusive" characters in preprocessor lines. Balanced constructs within
these lines retain their syntactic identity.
However, the unterminated comment on L1 is allowed remain a comment -
there are lots of places in the Emacs C source where this occurs.
As always with such changes, byte-compile first cc-defs.el, then
cc-langs.el, then the rest. After a change to cc-langs.el, it is always
necessary to recompile cc-{engine,mode}.el, but they've been changed
anyway.
If this change doesn't work, or causes any problems, please let me know!
--
Alan Mackenzie (Nuremberg, Germany).
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-02-20 16:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-19 23:04 C/C++/ObjC Modes: Right thing now done with unbalanced string quotes and unmatched parens in CPP lines Alan Mackenzie
2008-02-19 23:48 ` Glenn Morris
2008-02-20 16:44 ` Richard Stallman
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).