GNU bug report logs -
#65182
29.1.50; c-ts-mode wants to outdent brace
Previous Next
Reported by: Robert Pluim <rpluim <at> gmail.com>
Date: Wed, 9 Aug 2023 15:25:01 UTC
Severity: normal
Tags: wontfix
Found in version 29.1.50
Done: Stefan Kangas <stefankangas <at> gmail.com>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 65182 in the body.
You can then email your comments to 65182 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#65182
; Package
emacs
.
(Wed, 09 Aug 2023 15:25:01 GMT)
Full text and
rfc822 format available.
Message #3 received at submit <at> debbugs.gnu.org (full text, mbox):
From an emacs-29 checkout:
src/emacs -Q src/process.c
M-g g 6025 RET
TAB ; nothing happens
M-x c-ts-mode
TAB ; the '{' moves left two spaces
The code around there looks like this:
#ifdef HAVE_GNUTLS
/* If we have an incompletely set up TLS connection,
then defer the sentinel signaling until
later. */
if (NILP (p->gnutls_boot_parameters)
&& !p->gnutls_p)
#endif
{ <= line 6025
pset_status (p, Qrun);
/* Execute the sentinel here. If we had relied on
status_notify to do it later, it will read input
from the process before calling the sentinel. */
exec_sentinel (proc, build_string ("open\n"));
}
Iʼd tell you what my libtree-sitter-c version was if I knew how to get
that information. I installed it on July 28th
(I donʼt think this is a duplicate of bug#65006, the patch there does
not affect this behaviour)
In GNU Emacs 29.1.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.37, cairo version 1.16.0) of 2023-08-07 built on rltb
Repository revision: ef8838c3a5f041769f72758b831eb3fa7a130fb9
Repository branch: emacs-29
Windowing system distributor 'The X.Org Foundation', version 11.0.12009000
System Description: Debian GNU/Linux 12 (bookworm)
Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ
JPEG JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES
NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XDBE XIM XINPUT2 XPM GTK3
ZLIB
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#65182
; Package
emacs
.
(Wed, 09 Aug 2023 16:26:01 GMT)
Full text and
rfc822 format available.
Message #6 received at 65182 <at> debbugs.gnu.org (full text, mbox):
> From: Robert Pluim <rpluim <at> gmail.com>
> Date: Wed, 09 Aug 2023 17:24:44 +0200
>
>
> >From an emacs-29 checkout:
>
> src/emacs -Q src/process.c
> M-g g 6025 RET
> TAB ; nothing happens
> M-x c-ts-mode
> TAB ; the '{' moves left two spaces
>
> The code around there looks like this:
>
> #ifdef HAVE_GNUTLS
> /* If we have an incompletely set up TLS connection,
> then defer the sentinel signaling until
> later. */
> if (NILP (p->gnutls_boot_parameters)
> && !p->gnutls_p)
> #endif
> { <= line 6025
> pset_status (p, Qrun);
> /* Execute the sentinel here. If we had relied on
> status_notify to do it later, it will read input
> from the process before calling the sentinel. */
> exec_sentinel (proc, build_string ("open\n"));
> }
>
> Iʼd tell you what my libtree-sitter-c version was if I knew how to get
> that information. I installed it on July 28th
>
> (I donʼt think this is a duplicate of bug#65006, the patch there does
> not affect this behaviour)
It's most probably because of the preprocessor mess around the line.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#65182
; Package
emacs
.
(Wed, 09 Aug 2023 16:31:02 GMT)
Full text and
rfc822 format available.
Message #9 received at 65182 <at> debbugs.gnu.org (full text, mbox):
>>>>> On Wed, 09 Aug 2023 19:26:10 +0300, Eli Zaretskii <eliz <at> gnu.org> said:
>> From: Robert Pluim <rpluim <at> gmail.com>
>> Date: Wed, 09 Aug 2023 17:24:44 +0200
>>
>>
>> >From an emacs-29 checkout:
>>
>> src/emacs -Q src/process.c
>> M-g g 6025 RET
>> TAB ; nothing happens
>> M-x c-ts-mode
>> TAB ; the '{' moves left two spaces
>>
>> The code around there looks like this:
>>
>> #ifdef HAVE_GNUTLS
>> /* If we have an incompletely set up TLS connection,
>> then defer the sentinel signaling until
>> later. */
>> if (NILP (p->gnutls_boot_parameters)
>> && !p->gnutls_p)
>> #endif
>> { <= line 6025
>> pset_status (p, Qrun);
>> /* Execute the sentinel here. If we had relied on
>> status_notify to do it later, it will read input
>> from the process before calling the sentinel. */
>> exec_sentinel (proc, build_string ("open\n"));
>> }
>>
>> Iʼd tell you what my libtree-sitter-c version was if I knew how to get
>> that information. I installed it on July 28th
>>
>> (I donʼt think this is a duplicate of bug#65006, the patch there does
>> not affect this behaviour)
Eli> It's most probably because of the preprocessor mess around the line.
Maybe, but c-mode works fine.
Robert
--
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#65182
; Package
emacs
.
(Wed, 09 Aug 2023 16:34:01 GMT)
Full text and
rfc822 format available.
Message #12 received at 65182 <at> debbugs.gnu.org (full text, mbox):
> From: Robert Pluim <rpluim <at> gmail.com>
> Cc: Yuan Fu <casouri <at> gmail.com>, 65182 <at> debbugs.gnu.org
> Date: Wed, 09 Aug 2023 18:30:44 +0200
>
> >>>>> On Wed, 09 Aug 2023 19:26:10 +0300, Eli Zaretskii <eliz <at> gnu.org> said:
>
> >> From: Robert Pluim <rpluim <at> gmail.com>
> >> Date: Wed, 09 Aug 2023 17:24:44 +0200
> >>
> >>
> >> >From an emacs-29 checkout:
> >>
> >> src/emacs -Q src/process.c
> >> M-g g 6025 RET
> >> TAB ; nothing happens
> >> M-x c-ts-mode
> >> TAB ; the '{' moves left two spaces
> >>
> >> The code around there looks like this:
> >>
> >> #ifdef HAVE_GNUTLS
> >> /* If we have an incompletely set up TLS connection,
> >> then defer the sentinel signaling until
> >> later. */
> >> if (NILP (p->gnutls_boot_parameters)
> >> && !p->gnutls_p)
> >> #endif
> >> { <= line 6025
> >> pset_status (p, Qrun);
> >> /* Execute the sentinel here. If we had relied on
> >> status_notify to do it later, it will read input
> >> from the process before calling the sentinel. */
> >> exec_sentinel (proc, build_string ("open\n"));
> >> }
> >>
> >> Iʼd tell you what my libtree-sitter-c version was if I knew how to get
> >> that information. I installed it on July 28th
> >>
> >> (I donʼt think this is a duplicate of bug#65006, the patch there does
> >> not affect this behaviour)
>
> Eli> It's most probably because of the preprocessor mess around the line.
>
> Maybe, but c-mode works fine.
Sure. The problem with c-ts-mode is because the tree-sitter C parser
doesn't really grok cpp directives, since they are not part of the C
language grammar. We have some workarounds in some cases, but I'll
let Yuan chime in about this particular one.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#65182
; Package
emacs
.
(Thu, 10 Aug 2023 21:57:01 GMT)
Full text and
rfc822 format available.
Message #15 received at 65182 <at> debbugs.gnu.org (full text, mbox):
> On Aug 9, 2023, at 9:34 AM, Eli Zaretskii <eliz <at> gnu.org> wrote:
>
>> From: Robert Pluim <rpluim <at> gmail.com>
>> Cc: Yuan Fu <casouri <at> gmail.com>, 65182 <at> debbugs.gnu.org
>> Date: Wed, 09 Aug 2023 18:30:44 +0200
>>
>>>>>>> On Wed, 09 Aug 2023 19:26:10 +0300, Eli Zaretskii <eliz <at> gnu.org> said:
>>
>>>> From: Robert Pluim <rpluim <at> gmail.com>
>>>> Date: Wed, 09 Aug 2023 17:24:44 +0200
>>>>
>>>>
>>>>> From an emacs-29 checkout:
>>>>
>>>> src/emacs -Q src/process.c
>>>> M-g g 6025 RET
>>>> TAB ; nothing happens
>>>> M-x c-ts-mode
>>>> TAB ; the '{' moves left two spaces
>>>>
>>>> The code around there looks like this:
>>>>
>>>> #ifdef HAVE_GNUTLS
>>>> /* If we have an incompletely set up TLS connection,
>>>> then defer the sentinel signaling until
>>>> later. */
>>>> if (NILP (p->gnutls_boot_parameters)
>>>> && !p->gnutls_p)
>>>> #endif
>>>> { <= line 6025
>>>> pset_status (p, Qrun);
>>>> /* Execute the sentinel here. If we had relied on
>>>> status_notify to do it later, it will read input
>>>> from the process before calling the sentinel. */
>>>> exec_sentinel (proc, build_string ("open\n"));
>>>> }
>>>>
>>>> Iʼd tell you what my libtree-sitter-c version was if I knew how to get
>>>> that information. I installed it on July 28th
>>>>
>>>> (I donʼt think this is a duplicate of bug#65006, the patch there does
>>>> not affect this behaviour)
>>
>> Eli> It's most probably because of the preprocessor mess around the line.
>>
>> Maybe, but c-mode works fine.
>
> Sure. The problem with c-ts-mode is because the tree-sitter C parser
> doesn't really grok cpp directives, since they are not part of the C
> language grammar. We have some workarounds in some cases, but I'll
> let Yuan chime in about this particular one.
It’s the same problem: tree-sitter grammar can’t meaningfully parse directives. Whatever in the directives are severed from the main parse tree. And to give you guys an explanation, the bracket is outdented because the if part isn’t taken into consideration, and the bracket is outdented against bracket one level higher.
else
{ <--------- outdented against this
#ifdef HAVE_GNUTLS
/* If we have an incompletely set up TLS connection,
then defer the sentinel signaling until
later. */
if (NILP (p->gnutls_boot_parameters) <---- the if is ignored
&& !p->gnutls_p)
#endif
{ <------------- outdented
pset_status (p, Qrun);
/* Execute the sentinel here. If we had relied on
status_notify to do it later, it will read input
from the process before calling the sentinel. */
exec_sentinel (proc, build_string ("open\n"));
}
Yuan
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#65182
; Package
emacs
.
(Sat, 12 Aug 2023 07:22:01 GMT)
Full text and
rfc822 format available.
Message #18 received at 65182 <at> debbugs.gnu.org (full text, mbox):
tags 65182 wontfix
close 65182
thanks
> From: Yuan Fu <casouri <at> gmail.com>
> Date: Thu, 10 Aug 2023 14:55:52 -0700
> Cc: Robert Pluim <rpluim <at> gmail.com>,
> 65182 <at> debbugs.gnu.org
>
> It’s the same problem: tree-sitter grammar can’t meaningfully parse directives. Whatever in the directives are severed from the main parse tree. And to give you guys an explanation, the bracket is outdented because the if part isn’t taken into consideration, and the bracket is outdented against bracket one level higher.
>
> else
> { <--------- outdented against this
> #ifdef HAVE_GNUTLS
> /* If we have an incompletely set up TLS connection,
> then defer the sentinel signaling until
> later. */
> if (NILP (p->gnutls_boot_parameters) <---- the if is ignored
> && !p->gnutls_p)
> #endif
> { <------------- outdented
> pset_status (p, Qrun);
> /* Execute the sentinel here. If we had relied on
> status_notify to do it later, it will read input
> from the process before calling the sentinel. */
> exec_sentinel (proc, build_string ("open\n"));
> }
I don't see this as a serious problem for Emacs (the braces could be
outdented to prevent it), so I'm closing this bug.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#65182
; Package
emacs
.
(Fri, 01 Sep 2023 21:10:02 GMT)
Full text and
rfc822 format available.
Message #21 received at 65182 <at> debbugs.gnu.org (full text, mbox):
tags 65182 wontfix
close 65182
thanks
Eli Zaretskii <eliz <at> gnu.org> writes
> tags 65182 wontfix
> close 65182
> thanks
[...]
> I don't see this as a serious problem for Emacs (the braces could be
> outdented to prevent it), so I'm closing this bug.
This was accidentally left open, maybe you missed the Bcc. Now fixed.
Added tag(s) wontfix.
Request was from
Stefan Kangas <stefankangas <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Fri, 01 Sep 2023 21:10:02 GMT)
Full text and
rfc822 format available.
bug closed, send any further explanations to
65182 <at> debbugs.gnu.org and Robert Pluim <rpluim <at> gmail.com>
Request was from
Stefan Kangas <stefankangas <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Fri, 01 Sep 2023 21:10:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sat, 30 Sep 2023 11:24:30 GMT)
Full text and
rfc822 format available.
This bug report was last modified 1 year and 223 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.