unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#4187: Bug with indentation / parens matching in C++-mode
@ 2009-08-18 12:04 Tobias.Schlueter
  2009-08-21 14:56 ` Alan Mackenzie
  0 siblings, 1 reply; 3+ messages in thread
From: Tobias.Schlueter @ 2009-08-18 12:04 UTC (permalink / raw)
  To: bug-gnu-emacs

This bug report will be sent to the Free Software Foundation,
not to your local site managers!
Please write in English, because the Emacs maintainers do not have
translators to read other languages for them.

Your bug report will be posted to the bug-gnu-emacs@gnu.org mailing list,
and to the gnu.emacs.bug news group.

In GNU Emacs 21.4.1 (i686-redhat-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2008-01-04 on norob.fnal.gov
configured using `configure  --build=i686-redhat-linux-gnu --host=i686-redhat-linux-gnu --target=i386-redhat-linux-gnu --program-prefix= --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/usr/com --mandir=/usr/share/man --infodir=/usr/share/info --with-pop --with-sound'
Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8
  default-enable-multibyte-characters: t

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:

Type the following into a buffer which is in C++ mode.  Try to get
correct indentation for the second line of the while condition or the
line following it by hitting the TAB key.  In my case this fails
miserably.  Modifying the while condition to fix this behaves rather
erratically, adding parentheses at least doesn't fix it.

{
  do {
  } while (fabs(chi2 - oldChi2) > 0
      && count < iterMax);
x= 1;
}

You can reach me under tobi@schlueters.de, I don't know if this
interface will place the right sender address on the mail.  I guess
the stuff emacs put below will not be of much help, so I'm cutting it
(recent input, the bug appears independent of my input).

Cheers,
- Tobias Schlüter






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

* bug#4187: Bug with indentation / parens matching in C++-mode
  2009-08-18 12:04 bug#4187: Bug with indentation / parens matching in C++-mode Tobias.Schlueter
@ 2009-08-21 14:56 ` Alan Mackenzie
  2009-09-22  8:51   ` Tobias Schlüter
  0 siblings, 1 reply; 3+ messages in thread
From: Alan Mackenzie @ 2009-08-21 14:56 UTC (permalink / raw)
  To: Tobias.Schlueter, 4187; +Cc: bug-cc-mode, bug-gnu-emacs, tobi

Hi, Tobias!

On Tue, Aug 18, 2009 at 02:04:21PM +0200, Tobias.Schlueter wrote:

> In GNU Emacs 21.4.1 (i686-redhat-linux-gnu, X toolkit, Xaw3d scroll bars)
>  of 2008-01-04 on norob.fnal.gov

OK, Emacs 21.4.  That's very old.  Emacs 22 was released in June 2007.
Emacs 23 was released a few weeks ago, on 30th July.  You could do worse
than upgrading (or persuading your sysadmins to upgrade).  Emacs 21
contained CC Mode 28, which is so old as to be barely supportable.  If
you can't upgrade your Emacs, you could certainly install a newer version
of CC Mode in one of your own directories (see
<http://cc-mode.sf.net/release.php>).

> Type the following into a buffer which is in C++ mode.

What version of CC Mode are you using (M-x c-version)?  Have you or
anybody else customised CC Mode at all?  It might well help to see your
complete CC Mode configuration (C-c C-b from within your C++ buffer,
followed by cutting and pasting).

> Try to get correct indentation for the second line of the while
> condition or the line following it by hitting the TAB key.  In my case
> this fails miserably.  Modifying the while condition to fix this
> behaves rather erratically, adding parentheses at least doesn't fix it.

Just as a suggestion, it might help things if you put a proper function
header before the opening "{".  It might not, though.

People's opinions differ on what "correct" indentation is, which is why
you can (and, sadly, MUST) configure it.  So could you please say how you
would like the line to be indented.

One thing you could do is, with point on the "&& count" line, C-c C-s.
This will give the syntactic analysis of the line, something like:

    Syntactic analysis: ((arglist-cont-nonempty 347 355))

.  This says "the line is a continued argument list whose "anchor points"
are at buffer positions 347 and 355".  This is explained in the CC Mode
manual in full detail.

Now try C-c C-o.  It will prompt you with something like:

    Syntactic symbol to change: arglist-cont-nonempty

, and when you hit <CR>, you'll get, say,:

    arglist-cont-nonempty offset (default (c-lineup-gcc-asm-reg c-lineup-arglist)):

, where you can type the new "offset" that you want.  Try entering "+",
or "++" or "*" or "-" here, just to get an idea of how this works.  Then
hit the <tab> key.  Again, the full details of all this stuff are in the
CC Mode manual.  I can give you better help once you've replied with the
details I've asked for.

> {
>   do {
>   } while (fabs(chi2 - oldChi2) > 0
>       && count < iterMax);
> x= 1;
> }

> You can reach me under tobi@schlueters.de, I don't know if this
> interface will place the right sender address on the mail.

It didn't, but I have.  :-)  I've also directed your reply to
bug-cc-mode@gnu.org, which is a more specific mailing list.

> I guess the stuff emacs put below will not be of much help, so I'm
> cutting it (recent input, the bug appears independent of my input).

Thanks!

> Cheers,
> - Tobias Schlüter

Schöne Grüße aus Nürnberg!

-- 
Alan Mackenzie.






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

* Re: bug#4187: Bug with indentation / parens matching in C++-mode
  2009-08-21 14:56 ` Alan Mackenzie
@ 2009-09-22  8:51   ` Tobias Schlüter
  0 siblings, 0 replies; 3+ messages in thread
From: Tobias Schlüter @ 2009-09-22  8:51 UTC (permalink / raw)
  To: bug-cc-mode; +Cc: bug-gnu-emacs, 4187, tobi


Hi,

sorry for not getting back to you earlier, and thank you very much for 
the detailed reply.

Alan Mackenzie wrote:
> Hi, Tobias!
> 
> On Tue, Aug 18, 2009 at 02:04:21PM +0200, Tobias.Schlueter wrote:
> 
>> In GNU Emacs 21.4.1 (i686-redhat-linux-gnu, X toolkit, Xaw3d scroll bars)
>>  of 2008-01-04 on norob.fnal.gov
> 
> OK, Emacs 21.4.  That's very old.

Whoops, yes, of course, everything works as expected with a newer 
version.  Hence I don't think it's worth wasting your time with a 
detailed answer.

Just for the record, I'm perfectly happy with GNU-style indentation, and 
my old version of cc-mode failed to do this for the example I quoted 
again below, maybe it's something for the cc-mode testsuite, if 
something like that exists.

>> {
>>   do {
>>   } while (fabs(chi2 - oldChi2) > 0
>>       && count < iterMax);
>> x= 1;
>> }
> 

Cheers,
- Tobias Schlüter

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf


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

end of thread, other threads:[~2009-09-22  8:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-18 12:04 bug#4187: Bug with indentation / parens matching in C++-mode Tobias.Schlueter
2009-08-21 14:56 ` Alan Mackenzie
2009-09-22  8:51   ` Tobias Schlüter

Code repositories for project(s) associated with this public inbox

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

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