all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#65182: 29.1.50; c-ts-mode wants to outdent brace
@ 2023-08-09 15:24 Robert Pluim
  2023-08-09 16:26 ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: Robert Pluim @ 2023-08-09 15:24 UTC (permalink / raw)
  To: 65182


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





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

* bug#65182: 29.1.50; c-ts-mode wants to outdent brace
  2023-08-09 15:24 bug#65182: 29.1.50; c-ts-mode wants to outdent brace Robert Pluim
@ 2023-08-09 16:26 ` Eli Zaretskii
  2023-08-09 16:30   ` Robert Pluim
  0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2023-08-09 16:26 UTC (permalink / raw)
  To: Robert Pluim, Yuan Fu; +Cc: 65182

> From: Robert Pluim <rpluim@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.





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

* bug#65182: 29.1.50; c-ts-mode wants to outdent brace
  2023-08-09 16:26 ` Eli Zaretskii
@ 2023-08-09 16:30   ` Robert Pluim
  2023-08-09 16:34     ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: Robert Pluim @ 2023-08-09 16:30 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 65182, Yuan Fu

>>>>> On Wed, 09 Aug 2023 19:26:10 +0300, Eli Zaretskii <eliz@gnu.org> said:

    >> From: Robert Pluim <rpluim@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
-- 





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

* bug#65182: 29.1.50; c-ts-mode wants to outdent brace
  2023-08-09 16:30   ` Robert Pluim
@ 2023-08-09 16:34     ` Eli Zaretskii
  2023-08-10 21:55       ` Yuan Fu
  0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2023-08-09 16:34 UTC (permalink / raw)
  To: Robert Pluim; +Cc: 65182, casouri

> From: Robert Pluim <rpluim@gmail.com>
> Cc: Yuan Fu <casouri@gmail.com>,  65182@debbugs.gnu.org
> Date: Wed, 09 Aug 2023 18:30:44 +0200
> 
> >>>>> On Wed, 09 Aug 2023 19:26:10 +0300, Eli Zaretskii <eliz@gnu.org> said:
> 
>     >> From: Robert Pluim <rpluim@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.





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

* bug#65182: 29.1.50; c-ts-mode wants to outdent brace
  2023-08-09 16:34     ` Eli Zaretskii
@ 2023-08-10 21:55       ` Yuan Fu
  2023-08-12  7:22         ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: Yuan Fu @ 2023-08-10 21:55 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 65182, Robert Pluim



> On Aug 9, 2023, at 9:34 AM, Eli Zaretskii <eliz@gnu.org> wrote:
> 
>> From: Robert Pluim <rpluim@gmail.com>
>> Cc: Yuan Fu <casouri@gmail.com>,  65182@debbugs.gnu.org
>> Date: Wed, 09 Aug 2023 18:30:44 +0200
>> 
>>>>>>> On Wed, 09 Aug 2023 19:26:10 +0300, Eli Zaretskii <eliz@gnu.org> said:
>> 
>>>> From: Robert Pluim <rpluim@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 




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

* bug#65182: 29.1.50; c-ts-mode wants to outdent brace
  2023-08-10 21:55       ` Yuan Fu
@ 2023-08-12  7:22         ` Eli Zaretskii
  2023-09-01 21:08           ` Stefan Kangas
  0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2023-08-12  7:22 UTC (permalink / raw)
  To: Yuan Fu; +Cc: 65182, rpluim

tags 65182 wontfix
close 65182
thanks

> From: Yuan Fu <casouri@gmail.com>
> Date: Thu, 10 Aug 2023 14:55:52 -0700
> Cc: Robert Pluim <rpluim@gmail.com>,
>  65182@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.





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

* bug#65182: 29.1.50; c-ts-mode wants to outdent brace
  2023-08-12  7:22         ` Eli Zaretskii
@ 2023-09-01 21:08           ` Stefan Kangas
  0 siblings, 0 replies; 7+ messages in thread
From: Stefan Kangas @ 2023-09-01 21:08 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 65182, Yuan Fu, rpluim

tags 65182 wontfix
close 65182
thanks

Eli Zaretskii <eliz@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.





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

end of thread, other threads:[~2023-09-01 21:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-09 15:24 bug#65182: 29.1.50; c-ts-mode wants to outdent brace Robert Pluim
2023-08-09 16:26 ` Eli Zaretskii
2023-08-09 16:30   ` Robert Pluim
2023-08-09 16:34     ` Eli Zaretskii
2023-08-10 21:55       ` Yuan Fu
2023-08-12  7:22         ` Eli Zaretskii
2023-09-01 21:08           ` Stefan Kangas

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.