From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thien-Thi Nguyen Newsgroups: gmane.emacs.help Subject: Re: Insert appropriate line-end character (like ';' for C*) Date: Wed, 11 Jun 2008 22:20:13 +0200 Message-ID: <87d4mnlo5e.fsf@ambire.localdomain> References: <333b2bc9-8ad4-4f0e-b508-eb143fd9d2fe@c58g2000hsc.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1213217249 5800 80.91.229.12 (11 Jun 2008 20:47:29 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 11 Jun 2008 20:47:29 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Josh Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jun 11 22:48:12 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 1K6XEo-0006od-Lp for geh-help-gnu-emacs@m.gmane.org; Wed, 11 Jun 2008 22:48:10 +0200 Original-Received: from localhost ([127.0.0.1]:54674 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K6XE1-0007CY-7R for geh-help-gnu-emacs@m.gmane.org; Wed, 11 Jun 2008 16:47:21 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K6XDj-0007CJ-9U for help-gnu-emacs@gnu.org; Wed, 11 Jun 2008 16:47:03 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K6XDh-0007C6-RU for help-gnu-emacs@gnu.org; Wed, 11 Jun 2008 16:47:02 -0400 Original-Received: from [199.232.76.173] (port=34103 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K6XDh-0007C3-MP for help-gnu-emacs@gnu.org; Wed, 11 Jun 2008 16:47:01 -0400 Original-Received: from [151.61.142.210] (port=48571 helo=ambire.localdomain) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1K6XDh-0002zq-Pb for help-gnu-emacs@gnu.org; Wed, 11 Jun 2008 16:47:02 -0400 Original-Received: from ttn by ambire.localdomain with local (Exim 4.63) (envelope-from ) id 1K6Wnl-0002E9-CS; Wed, 11 Jun 2008 22:20:13 +0200 In-Reply-To: (josh@dydxtech.com's message of "Wed, 11 Jun 2008 12:09:58 -0700 (PDT)") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. X-Greylist: delayed 1431 seconds by postgrey-1.27 at monty-python; Wed, 11 Jun 2008 16:47:01 EDT 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:54744 Archived-At: () Josh () Wed, 11 Jun 2008 12:09:58 -0700 (PDT) I don't know how to programatically determine what the correct character is. That depends on the programming language, which in the context of Emacs is largely tied to its major mode. Thus, you might get by w/ something like: (defvar finish-statement-character '((c-mode . ";") (c++-mode . ";")) "Alist mapping major mode to a \"finish statement\" character.") (defun finish-statement-and-start-another () (interactive) (end-of-line) (let ((s (cdr (assq major-mode finish-statement-character)))) (when s (insert s))) (newline-and-indent)) You can then extend finish-statement-character to DTRT, over time. thi