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

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

bug#64133: CC Mode 5.35.2 (C/*l); incorrect indentation for an arrays of


From: Jeff Norden
Subject: 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





reply via email to

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