help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Complex indentation configuration issue


From: Alan Mackenzie
Subject: Re: Complex indentation configuration issue
Date: Thu, 20 Dec 2018 16:31:30 -0000 (UTC)
User-agent: tin/2.4.2-20171224 ("Lochhead") (UNIX) (FreeBSD/11.2-RELEASE-p4 (amd64))

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).



reply via email to

[Prev in Thread] Current Thread [Next in Thread]