all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Gregory Fong <gregory.0xf0@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: continuing indentation in for loop condition in cc-mode
Date: Sat, 13 Feb 2016 01:00:35 +0000 (UTC)	[thread overview]
Message-ID: <loom.20160213T014406-442@post.gmane.org> (raw)
In-Reply-To: 87k2mimu4n.fsf@debian.uxu

Emanuel Berg <embe8573 <at> student.uu.se> writes:
> Gregory Fong <gregory.0xf0 <at> gmail.com> writes:
> > for (int i = 0;
> >   i < 5;
> >   ++i)
> > {
> > }
> >
> > but I can't seem to find an offset that adjusts this
> > parameter. c-show-syntatic information just shows
> > these as being a statement.
> >
> > Emacs will default to align with the first item in
> > the condition:
> >
> > for (int i = 0;
> >      i < 5;
> >      ++i)
> > {
> > }
> >
> > I can't imagine that I'm the only person who has
> > tried to change this, but it's surprisingly
> > difficult to search for answers.
> 
> Why is that so surprising? I'd say most people would
> agree with the Emacs default.
> 
> Doesn't it make the most sense as well?

I personally like the default.  Unfortunately, the company
I work for uses the style I mentioned at the top.

This is mostly surprising to me because it's really the
only indentation issue I've ever run into using emacs.
Everything else has been customizable regardless of
whatever bizarro coding standard I've had to use, which
is impressive.

> 
> And, for such a basic for loop, why not put everything
> on the same line?
> 
>     for (int i = 0; i < ARRAY_SIZE; i++) {
>         ...
>     }
> 

Yes, that was a poor example.  I was thinking more
of the sorts of long lines you tend to get when working
in C++ with iterators, in which case I'm trying to get it
to look like this:

    for (auto iter = RidiculouslyLongClassName.begin();
      iter < RidiculouslyLongClassName.end();
      ++iter)
    {
      ...
    }


As it is right now, I keep having to remember to fix the
indentation manually, which has been driving me nuts.

If there's a known way to change this behavior, or if you
have an idea on where to start looking at how to do this,
I'd love to hear it. Just not sure where to start.

Thanks and regards,
Gregory





  reply	other threads:[~2016-02-13  1:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-06  1:24 continuing indentation in for loop condition in cc-mode Gregory Fong
2016-02-06  2:48 ` Emanuel Berg
2016-02-13  1:00   ` Gregory Fong [this message]
  -- strict thread matches above, loose matches on Subject: below --
2016-02-13  2:18 Gregory Fong
2016-02-15  0:56 ` Emanuel Berg
2016-02-15  1:20 ` Emanuel Berg

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=loom.20160213T014406-442@post.gmane.org \
    --to=gregory.0xf0@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /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.