all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* cc-mode and continuing a for loop statement over two lines
@ 2008-02-28  6:40 nullius.filius
  2008-02-28 17:46 ` Nikolaj Schumacher
       [not found] ` <mailman.8046.1204220786.18990.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 3+ messages in thread
From: nullius.filius @ 2008-02-28  6:40 UTC (permalink / raw)
  To: help-gnu-emacs

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
}

This is so cc-mode formats like the ANSI predefined style
in astyle.

This is the code in my dot emacs (boosted from elsewhere).
I have not found a variable for tweaking continuation lines
from inside for loop statements.

------------------------------------------------------------------------
(defconst c-indentation 4)
(defvar my-c-style
  `((c-basic-offset                . ,c-indentation)
    (c-tab-always-indent           . t)
    (c-comment-only-line-offset    . 0)
    (c-hanging-braces-alist        . ((substatement-open . (before
after))
                                      (brace-list-open)
                                      (brace-list-close)
                                      (brace-list-intro)
                                      (brace-entry-open)))
    (c-hanging-colons-alist        . ((member-init-intro before)
                                      (inher-intro)
                                      (case-label after)
                                      (label after)
                                      (access-label after)))
    (c-cleanup-list                . (scope-operator
                                      empty-defun-braces
                                      defun-close-semi))
    (c-offsets-alist               . ((arglist-close .
                                        c-lineup-arglist-close-under-
paren)
                                      (substatement-open . 0)
				      (innamespace . nil)
				      (label . nil)
                                      (block-open        . 0)
                                      (inline-open       . 0)
                                      (template-args-cont .
                                         c-lineup-template-args)
                                      (inher-cont     . c-lineup-multi-
inher)
                                      (statement-cont . (c-lineup-math
++))
                                      (knr-argdecl-intro . -)))
    (c-echo-syntactic-information-p . t)
    )
  "My C Programming Style")

(defun my-c-mode-common-hook ()
  (c-add-style "PERSONAL" my-c-style t))

(add-hook 'c++-mode-hook 'my-c-mode-common-hook)
 
------------------------------------------------------------------------


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-02-29  2:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
     [not found] ` <mailman.8046.1204220786.18990.help-gnu-emacs@gnu.org>
2008-02-29  2:05   ` nullius.filius

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.