From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: SameerDS Newsgroups: gmane.emacs.help Subject: inserting code based on syntactic information in cc-mode Date: Mon, 23 Nov 2009 01:38:19 -0800 (PST) Organization: http://groups.google.com Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: ger.gmane.org 1259102089 25395 80.91.229.12 (24 Nov 2009 22:34:49 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 24 Nov 2009 22:34:49 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Nov 24 23:34:42 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1ND3y4-0001HZ-RD for geh-help-gnu-emacs@m.gmane.org; Tue, 24 Nov 2009 23:34:41 +0100 Original-Received: from localhost ([127.0.0.1]:42180 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ND3y4-000727-GR for geh-help-gnu-emacs@m.gmane.org; Tue, 24 Nov 2009 17:34:40 -0500 Original-Path: news.stanford.edu!usenet.stanford.edu!postnews.google.com!o9g2000prg.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 20 Original-NNTP-Posting-Host: 203.78.217.151 Original-X-Trace: posting.google.com 1258969099 5014 127.0.0.1 (23 Nov 2009 09:38:19 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Mon, 23 Nov 2009 09:38:19 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: o9g2000prg.googlegroups.com; posting-host=203.78.217.151; posting-account=9lo_eQoAAACfsIyHE_E4yJ4DVkC1bdwh User-Agent: G2/1.0 X-HTTP-Via: 1.1 netmon.iitb.ac.in (squid/3.0.STABLE20) X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.5) Gecko/20091109 Ubuntu/9.04 (jaunty) Shiretoko/3.5.5, gzip(gfe), gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:174966 X-Mailman-Approved-At: Tue, 24 Nov 2009 17:34:16 -0500 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:70098 Archived-At: 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.