From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: nullius.filius@gmail.com Newsgroups: gmane.emacs.help Subject: Re: cc-mode and continuing a for loop statement over two lines Date: Thu, 28 Feb 2008 18:05:17 -0800 (PST) Organization: http://groups.google.com Message-ID: <5221a2c9-808e-4c3c-88f5-997233a23a87@e10g2000prf.googlegroups.com> References: <93884796-53ce-4f0e-98d6-afb1ab508022@s13g2000prd.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1204252895 5132 80.91.229.12 (29 Feb 2008 02:41:35 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 29 Feb 2008 02:41:35 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Feb 29 03:42:02 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 1JUvCA-0007C5-Pf for geh-help-gnu-emacs@m.gmane.org; Fri, 29 Feb 2008 03:41:59 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JUvBe-0000tt-GG for geh-help-gnu-emacs@m.gmane.org; Thu, 28 Feb 2008 21:41:26 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!e10g2000prf.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 34 Original-NNTP-Posting-Host: 121.221.227.212 Original-X-Trace: posting.google.com 1204250717 9966 127.0.0.1 (29 Feb 2008 02:05:17 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Fri, 29 Feb 2008 02:05:17 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: e10g2000prf.googlegroups.com; posting-host=121.221.227.212; posting-account=eC1DvgoAAADSFXX7sf_iRJJOD8mR2PMk User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12,gzip(gfe),gzip(gfe) Original-Xref: shelby.stanford.edu gnu.emacs.help:156589 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:51961 Archived-At: Thank you Nikolaj, I could not get your code snippet to double indent. I like the concept behind your hack, and I will play around with it because I'm sure it will work. Nikolaj Schumacher wrote: > 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