From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Hansen Newsgroups: gmane.emacs.help Subject: Re: Insert appropriate line-end character (like ';' for C*) Date: Thu, 12 Jun 2008 21:21:19 +0200 Organization: disorganized Message-ID: <877icuqx1s.fsf@localhorst.mine.nu> References: <333b2bc9-8ad4-4f0e-b508-eb143fd9d2fe@c58g2000hsc.googlegroups.com> <10218ac7-1ba3-4ae7-9a19-3b199f78c80f@w7g2000hsa.googlegroups.com> <83af0c69-4c59-4b9f-96c2-b59fe6b0c048@2g2000hsn.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1213298637 2469 80.91.229.12 (12 Jun 2008 19:23:57 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 12 Jun 2008 19:23:57 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jun 12 21:24:40 2008 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 1K6sPW-0001B3-Nu for geh-help-gnu-emacs@m.gmane.org; Thu, 12 Jun 2008 21:24:39 +0200 Original-Received: from localhost ([127.0.0.1]:50910 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K6sOi-0005WK-Vb for geh-help-gnu-emacs@m.gmane.org; Thu, 12 Jun 2008 15:23:49 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K6sOL-0005UH-A0 for help-gnu-emacs@gnu.org; Thu, 12 Jun 2008 15:23:25 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K6sOI-0005S6-Md for help-gnu-emacs@gnu.org; Thu, 12 Jun 2008 15:23:23 -0400 Original-Received: from [199.232.76.173] (port=45800 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K6sOH-0005Rv-1W for help-gnu-emacs@gnu.org; Thu, 12 Jun 2008 15:23:21 -0400 Original-Received: from main.gmane.org ([80.91.229.2]:49256 helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1K6sOH-0003EM-0o for help-gnu-emacs@gnu.org; Thu, 12 Jun 2008 15:23:21 -0400 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1K6sOD-0002Y6-WE for help-gnu-emacs@gnu.org; Thu, 12 Jun 2008 19:23:18 +0000 Original-Received: from e178060154.adsl.alicedsl.de ([85.178.60.154]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 12 Jun 2008 19:23:17 +0000 Original-Received: from david.hansen by e178060154.adsl.alicedsl.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 12 Jun 2008 19:23:17 +0000 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: help-gnu-emacs@gnu.org Original-Lines: 24 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: e178060154.adsl.alicedsl.de Mail-Copies-To: nobody User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.0.60 (gnu/linux) Cancel-Lock: sha1:ZmP71NjVcikwIjI4Vw7d5zKRig4= X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) 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:54774 Archived-At: On Thu, 12 Jun 2008 11:30:05 -0700 (PDT) Josh wrote: > So the various modes don' t include that information? It seems like > they must, otherwise how would Emacs be able to indent things > appropriately? In python-mode it's aware that a line ending in ':' is > special, and so it automatically indents the following line(s), > similarly it un-indents the lines following a 'return' statement. It's > not doing this solely based on the presence of key terms such as 'if' > and 'def' either (I tested); it's aware of ':' as an important > character in python-mode at least. > > All I'm trying to figure out is if there's an easy way to determine, > even if it's just for python-mode, what that special character is. Of course every major-mode implementation somewhere has this information stored but there is no standard way of doing this. Emacs builtin support for parsing languages is pretty low level and focused on lisp (read about syntax tables in the manual). All major modes come with additions to this low level parser (mostly a bunch of regexps and good guess work, no real parser). If python is your only concern read the source. David