unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Complex indentation configuration issue
@ 2018-12-18  9:48 Juha Nieminen
  2018-12-20 16:31 ` Alan Mackenzie
  0 siblings, 1 reply; 2+ messages in thread
From: Juha Nieminen @ 2018-12-18  9:48 UTC (permalink / raw)
  To: help-gnu-emacs

I want this type of code to be indented like this:

    functionCall
        (param1, param2,
         {
             value1,
             value2,
             value3
         });

My emacs, however, is currently indenting it like this:

    functionCall
        (param1, param2,
         {
             value1,
                 value2,
                 value3
                 });

I have used the C-c C-o trick to find out (and change) which indentation
parameter is being used for the offending lines, and it appears to be
statement-cont, which has a value of +.

If I change it to 0, then the "value2" and "value3" lines get properly
indented, but the problem is that the second line is also indented using
that same parameter (not a huge problem but...), as well as the closing
curly bracket (more of a problem). There are probably also other
situations that would probably be negatively affected by this change.

Any suggestions?


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

* Re: Complex indentation configuration issue
  2018-12-18  9:48 Complex indentation configuration issue Juha Nieminen
@ 2018-12-20 16:31 ` Alan Mackenzie
  0 siblings, 0 replies; 2+ messages in thread
From: Alan Mackenzie @ 2018-12-20 16:31 UTC (permalink / raw)
  To: help-gnu-emacs

Hello, Juha.

Juha Nieminen <nospam@thanks.invalid> wrote:
> I want this type of code to be indented like this:

>     functionCall
>         (param1, param2,
>          {
>              value1,
>              value2,
>              value3
>          });

> My emacs, however, is currently indenting it like this:

>     functionCall
>         (param1, param2,
>          {
>              value1,
>                  value2,
>                  value3
>                  });

> I have used the C-c C-o trick to find out (and change) which indentation
> parameter is being used for the offending lines, and it appears to be
> statement-cont, which has a value of +.

OK.  It shouldn't be statement-cont (a "continued statement") but
brace-list-entry.  This was a tricky problem back in late 2017 which was
"solved" and then reverted for Emacs 26, and later solved properly, but
only on the master branch.

> If I change it to 0, then the "value2" and "value3" lines get properly
> indented, but the problem is that the second line is also indented using
> that same parameter (not a huge problem but...), as well as the closing
> curly bracket (more of a problem). There are probably also other
> situations that would probably be negatively affected by this change.

> Any suggestions?

FIrst of all, it is always helpful, and sometimes essential, to give the
version numbers of the software you're using.  Here I've had to guess
that you're using Emacs 26.1 (or earlier), that you're in C Mode or C++
Mode (this was given away by the mention of C-c C-o).

I would suggest one of four ways of solving this: you could move onto
the (unreleased) Emacs master; you could extract the up to date CC Mode
source files from master, and put them into your current Emacs; You
could download the current version of (stand alone) CC Mode from
SourceForge (see http://cc-mode.sourceforge.net/hgaccess.php); or ask me
by private email to send you a tarball of the latter.

-- 
Alan Mackenzie (Nuremberg, Germany).



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

end of thread, other threads:[~2018-12-20 16:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-18  9:48 Complex indentation configuration issue Juha Nieminen
2018-12-20 16:31 ` Alan Mackenzie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).