unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* 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

* Re: C/C++/ObjC Modes: Right thing now done with unbalanced string quotes and unmatched parens in CPP lines.
  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
  0 siblings, 1 reply; 3+ messages in thread
From: Glenn Morris @ 2008-02-19 23:48 UTC (permalink / raw)
  To: emacs-devel; +Cc: Alan Mackenzie, Chong Yidong

Alan Mackenzie wrote:

> I have just amended CC Mode (in the EMACS_22 branch, but not yet in the
> trunk)
[...]
> If this change doesn't work, or causes any problems, please let me know!

It's a shame it missed the 22.1.91 pretest by a matter of hours.
I would think it basically means 22.1.92 will be required at some point.




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: C/C++/ObjC Modes: Right thing now done with unbalanced string quotes and unmatched parens in CPP lines.
  2008-02-19 23:48 ` Glenn Morris
@ 2008-02-20 16:44   ` Richard Stallman
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Stallman @ 2008-02-20 16:44 UTC (permalink / raw)
  To: Glenn Morris; +Cc: acm, cyd, emacs-devel

    I would think it basically means 22.1.92 will be required at some point.

I agree.




^ 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).