GNU bug report logs - #64133
CC Mode 5.35.2 (C/*l); incorrect indentation for an arrays of structs.

Previous Next

Package: emacs;

Reported by: Jeff Norden <norden.jeff <at> gmail.com>

Date: Sat, 17 Jun 2023 15:05:01 UTC

Severity: normal

Done: Alan Mackenzie <acm <at> muc.de>

Bug is archived. No further changes may be made.

Full log


Message #20 received at 64133 <at> debbugs.gnu.org (full text, mbox):

From: Jeff Norden <norden.jeff <at> gmail.com>
To: Alan Mackenzie <acm <at> muc.de>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 64133 <at> debbugs.gnu.org
Subject: Re: bug#64133: CC Mode 5.35.2 (C/*l); incorrect indentation for an
 arrays of structs.
Date: Sun, 18 Jun 2023 11:10:46 -0500
On Sun, Jun 18, 2023 at 8:13 AM Alan Mackenzie wrote:
>...
> > > Thanks, I will let Alan chime in and decide whether this should be
> > > closed.
>
> I think, not yet.
>...
> I think I should be able to fix this in the next day or three.

Hi Alan

I don't know if this might help, but here is one more thing I found,
which I can't explain at all.

Tab is normally bound to c-indent-line-or-region.  You can't directly
re-bind tab to c-indent-line.  However, if you create an interactive
version with:

  (defun cil() (interactive) (c-indent-line))

and bind it to tab, it has the exact same behavior.  This eliminates
several levels of function calls between c-indent-line-or-region and
c-indent-line.

So, if you open the example with emacs -Q, define cil and bind it to
tab with "M-x local-set-key", you can "fix" the syntax by moving to
the beginning of the {3,4,5} line and pressing:
  <tab><backspace><backspace><tab>
At this point "C-c C-s" shows brace-list syntax.

BUT, if you start again, and instead of defining "cil', just replace
each <tab> with "M-: (c-indent-line)<ret>", it does *not* change the
syntax that "C-c C-s" shows.  For some reason that I don't understand,
it seems that the minibuffer read affects the behavior.  To see this,
change the defun for "cil" by adding:

  (read-from-minibuffer "press <ret>")

after (interactive).  You now need to hit <ret> after each <tab>, but
I *cannot* get the syntax for the line to change with this function.
-Jeff




This bug report was last modified 1 year and 327 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.