help-gnu-emacs
[Top][All Lists]
Advanced

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

inserting code based on syntactic information in cc-mode


From: SameerDS
Subject: inserting code based on syntactic information in cc-mode
Date: Mon, 23 Nov 2009 01:38:19 -0800 (PST)
User-agent: G2/1.0

Hello,

I want to write elisp functions that can insert code based on the
syntactic information at the point where they are invoked. For
example, typing an opening brace at the start of a function definition
should automatically insert the closing brace and put point on a new
line between the two. But when an opening brace is typed at the start
of a class description, it should also insert a semi-colon after the
closing brace. Such a function might be easily written as a skeleton.
What I need is a way to inspect the local syntactic information when
the '{' key is pressed and then call the appropriate function.

For this, I've been going through the documentation for CC-mode
looking for a function that returns the syntax information for the
current line. Basically a function that is equivalent to c-show-
syntactic-information, but which can be used in elisp code directly. I
couldn't find such a function ... is there a way to do this at all in
CC-mode?

Sameer.


reply via email to

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