From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Nikolaj Schumacher Newsgroups: gmane.emacs.help Subject: Re: cc-mode and continuing a for loop statement over two lines Date: Thu, 28 Feb 2008 18:46:20 +0100 Message-ID: References: <93884796-53ce-4f0e-98d6-afb1ab508022@s13g2000prd.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1204220827 24016 80.91.229.12 (28 Feb 2008 17:47:07 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 28 Feb 2008 17:47:07 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: nullius.filius@gmail.com Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Feb 28 18:47:30 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 1JUmqh-0000Qu-DQ for geh-help-gnu-emacs@m.gmane.org; Thu, 28 Feb 2008 18:47:15 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JUmqB-0005QO-79 for geh-help-gnu-emacs@m.gmane.org; Thu, 28 Feb 2008 12:46:43 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JUmpt-0005Pb-37 for help-gnu-emacs@gnu.org; Thu, 28 Feb 2008 12:46:25 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JUmpr-0005OM-Il for help-gnu-emacs@gnu.org; Thu, 28 Feb 2008 12:46:24 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JUmpr-0005O6-Fm for help-gnu-emacs@gnu.org; Thu, 28 Feb 2008 12:46:23 -0500 Original-Received: from fmmailgate03.web.de ([217.72.192.234]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JUmpr-00039u-0k for help-gnu-emacs@gnu.org; Thu, 28 Feb 2008 12:46:23 -0500 Original-Received: from smtp06.web.de (fmsmtp06.dlan.cinetic.de [172.20.5.172]) by fmmailgate03.web.de (Postfix) with ESMTP id 3DB3DD0D5093; Thu, 28 Feb 2008 18:46:21 +0100 (CET) Original-Received: from [77.135.60.83] (helo=wednesday) by smtp06.web.de with asmtp (WEB.DE 4.109 #226) id 1JUmpp-0007X3-00; Thu, 28 Feb 2008 18:46:21 +0100 In-Reply-To: <93884796-53ce-4f0e-98d6-afb1ab508022@s13g2000prd.googlegroups.com> (nullius filius's message of "Wed\, 27 Feb 2008 22\:40\:24 -0800 \(PST\)") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.91 (darwin) X-Sender: n_schumacher@web.de X-Provags-ID: V01U2FsdGVkX1/mLFucSJX9u2ZO3y1WhT5FcEh+8oE3yFs4zz4f LmjBAV1CzCar6x4x7AgHjJ8hmJfYtBisrb6TR3kBkaR1W0EflN +fkSjs0L9zitodfLG5tg== X-detected-kernel: by monty-python.gnu.org: Linux 2.4-2.6 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:51947 Archived-At: nullius.filius@gmail.com wrote: > I would like to indent twice if I have to continue a > for loop statement onto more than one line. For example, > as in the following code- > > for (vector::iterator iter(data.begin()); > iter != data.end(); ++iter) > { > // do something > } Here's what I came up with: (defun indent-for-cont (langelem) (let ((beg (car (c-declaration-limits nil)))) (if (equal "for" (buffer-substring-no-properties beg (+ 3 beg))) '+ 0))) Then add this: (statement . indent-for-cont) to your c-offsets-alist. regards, Nikolaj Schumacher