all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Nikolaj Schumacher <n_schumacher@web.de>
To: nullius.filius@gmail.com
Cc: help-gnu-emacs@gnu.org
Subject: Re: cc-mode and continuing a for loop statement over two lines
Date: Thu, 28 Feb 2008 18:46:20 +0100	[thread overview]
Message-ID: <m2d4qhgej7.fsf@nschum.de> (raw)
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\)")

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<int>::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




  reply	other threads:[~2008-02-28 17:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-28  6:40 cc-mode and continuing a for loop statement over two lines nullius.filius
2008-02-28 17:46 ` Nikolaj Schumacher [this message]
     [not found] ` <mailman.8046.1204220786.18990.help-gnu-emacs@gnu.org>
2008-02-29  2:05   ` nullius.filius

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2d4qhgej7.fsf@nschum.de \
    --to=n_schumacher@web.de \
    --cc=help-gnu-emacs@gnu.org \
    --cc=nullius.filius@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.