all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Theodor Thornhill via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Yuan Fu <casouri@gmail.com>
Cc: "Eli Zaretskii" <eliz@gnu.org>,
	61893@debbugs.gnu.org, "Daniel Martín" <mardani29@yahoo.es>
Subject: bug#61893: 29.0.60; Indentation in c-ts-mode broken again
Date: Sat, 04 Mar 2023 09:54:29 +0100	[thread overview]
Message-ID: <5F5AF93A-E0A8-47BF-97DB-1AAA9A025FA4@thornhill.no> (raw)
In-Reply-To: <0476A0F0-75E4-45EF-9B18-ECC5E87851C1@gmail.com>



On 3 March 2023 23:01:39 CET, Yuan Fu <casouri@gmail.com> wrote:
>
>
>> On Mar 2, 2023, at 10:07 PM, Theodor Thornhill <theo@thornhill.no> wrote:
>> 
>> 
>> 
>> On 3 March 2023 05:07:44 CET, Yuan Fu <casouri@gmail.com> wrote:
>>> 
>>> 
>>>> On Mar 1, 2023, at 10:31 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>>>> 
>>>>> From: Yuan Fu <casouri@gmail.com>
>>>>> Date: Wed, 1 Mar 2023 14:08:23 -0800
>>>>> Cc: Daniel Martín <mardani29@yahoo.es>,
>>>>> Theodor Thornhill <theo@thornhill.no>,
>>>>> 61893@debbugs.gnu.org
>>>>> 
>>>>>> Thanks.  So I wasn't dreaming after all.
>>>>> 
>>>>> Sorry about that. It should be fixed now.
>>>> 
>>>> Thanks, it's much better now.
>>>> 
>>>> I spotted the following problems, not sure if they are new or not: go
>>>> to line 297 of dispnew.c, which is "#endif".  Then type "C-e RET" --
>>>> point goes to column zero instead of the expected column 6.  This
>>>> affects the following 3 lines as well; only the next 'if' fixes the
>>>> indentation.  I see the same problem with every "#endif" line.
>>>> 
>>>> Line 6584 of dispnew.c, which is this:
>>>> 
>>>> #endif /* HAVE_WINDOW_SYSTEM */
>>>> 
>>>> exhibits a slightly different incorrect behavior: "C-e RET" on that
>>>> line moves point to column 7, not column 6, presumably to align with
>>>> the "/*" of the comment?
>>>> 
>>>> Line 6608 of dispnew.c is just "#else"; typing "C-e RET" there
>>>> unexpectedly goes to column 2 instead of 4.
>>> 
>>> That’s indeed the “align to previous statement”’s fault, caused by preproc directives Theo was working on. I’ve fixed it. Theo, while working on this, I found some problem with the current indent for preproc directives. In the following example:
>>> 
>>> static void
>>> free_glyph_pool (struct glyph_pool *pool)
>>> {
>>> if (pool)
>>>   {
>>> #if defined GLYPH_DEBUG
>>>     int c = 1;
>>> #endif
>>>     int check_this = 3;
>>> #ifdef stuff
>>>     int c = 1;
>>> #elif defined stuff
>>> int e = 5;
>>> #else
>>> int d = 11;
>>> #endif
>>> int check_this = 3;
>>>   }
>>> }
>>> 
>>> The elif directive’s and subsequent directives aren’t indented properly. Looking at the parsed tree, the elif directives are nested in the if directive, and the nesting can be arbitrarily deep. We probably need a custom function rather than great-grand-parent to find the anchor, like a function that keeps going up the tree until the node isn’t a preproc directive anymore.
>>> 
>>> Yuan
>> 
>> Yeah, you're right. I'll see what I can do, but bandwidth is a little low at the moment, so if you have some extra time, don't hesitate to improve it :)
>
>Absolutely, I’ll work on it. 
>
>Yuan

Thanks :)





  reply	other threads:[~2023-03-04  8:54 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-01 14:37 bug#61893: 29.0.60; Indentation in c-ts-mode broken again Eli Zaretskii
2023-03-01 16:35 ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-03-01 16:59   ` Eli Zaretskii
2023-03-01 17:13     ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-03-01 18:26       ` Eli Zaretskii
2023-03-01 22:08         ` Yuan Fu
2023-03-02  6:31           ` Eli Zaretskii
2023-03-03  4:07             ` Yuan Fu
2023-03-03  6:07               ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-03-03 22:01                 ` Yuan Fu
2023-03-04  8:54                   ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2023-03-04 23:03                     ` Yuan Fu
2023-03-05  8:22                       ` Eli Zaretskii
2023-03-05 23:26                         ` Yuan Fu
2023-03-06  6:03                           ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-03-06 12:57                             ` Eli Zaretskii
2023-03-06 12:58                           ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5F5AF93A-E0A8-47BF-97DB-1AAA9A025FA4@thornhill.no \
    --to=bug-gnu-emacs@gnu.org \
    --cc=61893@debbugs.gnu.org \
    --cc=casouri@gmail.com \
    --cc=eliz@gnu.org \
    --cc=mardani29@yahoo.es \
    --cc=theo@thornhill.no \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.