GNU bug report logs - #59807
29.0.60; [PATCH] python-ts-mode does not auto-complete the closing quote

Previous Next

Package: emacs;

Reported by: Kai Ma <justksqsf <at> gmail.com>

Date: Sat, 3 Dec 2022 22:28:02 UTC

Severity: normal

Tags: patch

Found in version 29.0.60

Done: Yuan Fu <casouri <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 59807 in the body.
You can then email your comments to 59807 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#59807; Package emacs. (Sat, 03 Dec 2022 22:28:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Kai Ma <justksqsf <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 03 Dec 2022 22:28:02 GMT) Full text and rfc822 format available.

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

From: Kai Ma <justksqsf <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.0.60; [PATCH] python-ts-mode does not auto-complete the closing
 quote
Date: Sun, 04 Dec 2022 06:27:18 +0800
[Message part 1 (text/plain, inline)]
When electric-pair-mode is enabled, a single quote ' should be auto
completed to be '' (which means an empty string).  Python-mode correctly
does this, but python-ts-mode does not.  This is clearly a problem
regarding the syntax table.

The attached patch makes python-ts-mode uses the same syntax table as
python-mode's, and fixes this problem.  I also checked a few other ts
modes, and some also have this issue.  For example, js-ts-mode does not
auto complete '' either, which is also fixed by this patch.

[0001-Fix-syntax-tables-of-tree-sitter-modes.patch (text/x-patch, attachment)]
[Message part 3 (text/plain, inline)]
Kai

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59807; Package emacs. (Sun, 04 Dec 2022 07:20:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Kai Ma <justksqsf <at> gmail.com>, Yuan Fu <casouri <at> gmail.com>
Cc: 59807 <at> debbugs.gnu.org
Subject: Re: bug#59807: 29.0.60;
 [PATCH] python-ts-mode does not auto-complete the closing quote
Date: Sun, 04 Dec 2022 09:19:27 +0200
> From: Kai Ma <justksqsf <at> gmail.com>
> Date: Sun, 04 Dec 2022 06:27:18 +0800
> 
> When electric-pair-mode is enabled, a single quote ' should be auto
> completed to be '' (which means an empty string).  Python-mode correctly
> does this, but python-ts-mode does not.  This is clearly a problem
> regarding the syntax table.
> 
> The attached patch makes python-ts-mode uses the same syntax table as
> python-mode's, and fixes this problem.  I also checked a few other ts
> modes, and some also have this issue.  For example, js-ts-mode does not
> auto complete '' either, which is also fixed by this patch.
> 
> >From 7f996826bc47bcdd155eb0cc220a48c32cb2619a Mon Sep 17 00:00:00 2001
> From: Kai Ma <justksqsf <at> gmail.com>
> Date: Sun, 4 Dec 2022 06:15:42 +0800
> Subject: [PATCH] Fix syntax tables of tree-sitter modes
> 
> Tree-sitter modes should use the same syntax table as the
> non-tree-sitter ones.
> * lisp/progmodes/csharp-mode.el (csharp-mode-syntax-table)
> (csharp-mode):
> * lisp/progmodes/js.el (js-mode-syntax-table) (js-ts-mode):
> * lisp/progmodes/python.el (python-ts-mode):
> * lisp/progmodes/sh-script.el (bash-ts-mode):
> * lisp/textmodes/css-mode.el (css-ts-mode):

Thanks, but please format the log message according to our conventions:
there should be a description of the actual changes after the last colon.

Yuan, is it really true that the syntax tables in treesit-supported modes
should be always identical to those of the non-treesit modes?  Or maybe
there could be subtle differences?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59807; Package emacs. (Sun, 04 Dec 2022 07:29:02 GMT) Full text and rfc822 format available.

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

From: Yuan Fu <casouri <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Kai Ma <justksqsf <at> gmail.com>, Theodor Thornhill <theo <at> thornhill.no>,
 59807 <at> debbugs.gnu.org
Subject: Re: bug#59807: 29.0.60; [PATCH] python-ts-mode does not auto-complete
 the closing quote
Date: Sat, 3 Dec 2022 23:28:23 -0800

> On Dec 3, 2022, at 11:19 PM, Eli Zaretskii <eliz <at> gnu.org> wrote:
> 
>> From: Kai Ma <justksqsf <at> gmail.com>
>> Date: Sun, 04 Dec 2022 06:27:18 +0800
>> 
>> When electric-pair-mode is enabled, a single quote ' should be auto
>> completed to be '' (which means an empty string).  Python-mode correctly
>> does this, but python-ts-mode does not.  This is clearly a problem
>> regarding the syntax table.
>> 
>> The attached patch makes python-ts-mode uses the same syntax table as
>> python-mode's, and fixes this problem.  I also checked a few other ts
>> modes, and some also have this issue.  For example, js-ts-mode does not
>> auto complete '' either, which is also fixed by this patch.
>> 
>>> From 7f996826bc47bcdd155eb0cc220a48c32cb2619a Mon Sep 17 00:00:00 2001
>> From: Kai Ma <justksqsf <at> gmail.com>
>> Date: Sun, 4 Dec 2022 06:15:42 +0800
>> Subject: [PATCH] Fix syntax tables of tree-sitter modes
>> 
>> Tree-sitter modes should use the same syntax table as the
>> non-tree-sitter ones.
>> * lisp/progmodes/csharp-mode.el (csharp-mode-syntax-table)
>> (csharp-mode):
>> * lisp/progmodes/js.el (js-mode-syntax-table) (js-ts-mode):
>> * lisp/progmodes/python.el (python-ts-mode):
>> * lisp/progmodes/sh-script.el (bash-ts-mode):
>> * lisp/textmodes/css-mode.el (css-ts-mode):
> 
> Thanks, but please format the log message according to our conventions:
> there should be a description of the actual changes after the last colon.
> 
> Yuan, is it really true that the syntax tables in treesit-supported modes
> should be always identical to those of the non-treesit modes?  Or maybe
> there could be subtle differences?

IMO yes. But since I’m not the original author of some of the modes, I included Theo for his opinion.

Yuan





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59807; Package emacs. (Sun, 04 Dec 2022 08:09:02 GMT) Full text and rfc822 format available.

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

From: Theodor Thornhill <theo <at> thornhill.no>
To: Yuan Fu <casouri <at> gmail.com>, Eli Zaretskii <eliz <at> gnu.org>
Cc: Kai Ma <justksqsf <at> gmail.com>, 59807 <at> debbugs.gnu.org
Subject: Re: bug#59807: 29.0.60; [PATCH] python-ts-mode does not auto-complete the closing quote
Date: Sun, 04 Dec 2022 09:07:28 +0100

On 4 December 2022 08:28:23 CET, Yuan Fu <casouri <at> gmail.com> wrote:
>
>
>> On Dec 3, 2022, at 11:19 PM, Eli Zaretskii <eliz <at> gnu.org> wrote:
>> 
>>> From: Kai Ma <justksqsf <at> gmail.com>
>>> Date: Sun, 04 Dec 2022 06:27:18 +0800
>>> 
>>> When electric-pair-mode is enabled, a single quote ' should be auto
>>> completed to be '' (which means an empty string).  Python-mode correctly
>>> does this, but python-ts-mode does not.  This is clearly a problem
>>> regarding the syntax table.
>>> 
>>> The attached patch makes python-ts-mode uses the same syntax table as
>>> python-mode's, and fixes this problem.  I also checked a few other ts
>>> modes, and some also have this issue.  For example, js-ts-mode does not
>>> auto complete '' either, which is also fixed by this patch.
>>> 
>>>> From 7f996826bc47bcdd155eb0cc220a48c32cb2619a Mon Sep 17 00:00:00 2001
>>> From: Kai Ma <justksqsf <at> gmail.com>
>>> Date: Sun, 4 Dec 2022 06:15:42 +0800
>>> Subject: [PATCH] Fix syntax tables of tree-sitter modes
>>> 
>>> Tree-sitter modes should use the same syntax table as the
>>> non-tree-sitter ones.
>>> * lisp/progmodes/csharp-mode.el (csharp-mode-syntax-table)
>>> (csharp-mode):
>>> * lisp/progmodes/js.el (js-mode-syntax-table) (js-ts-mode):
>>> * lisp/progmodes/python.el (python-ts-mode):
>>> * lisp/progmodes/sh-script.el (bash-ts-mode):
>>> * lisp/textmodes/css-mode.el (css-ts-mode):
>> 
>> Thanks, but please format the log message according to our conventions:
>> there should be a description of the actual changes after the last colon.
>> 
>> Yuan, is it really true that the syntax tables in treesit-supported modes
>> should be always identical to those of the non-treesit modes?  Or maybe
>> there could be subtle differences?
>
>IMO yes. But since I’m not the original author of some of the modes, I included Theo for his opinion.
>
>Yuan
>

I agree!
Theo




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59807; Package emacs. (Sun, 04 Dec 2022 12:34:02 GMT) Full text and rfc822 format available.

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

From: Kai Ma <justksqsf <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Yuan Fu <casouri <at> gmail.com>, 59807 <at> debbugs.gnu.org
Subject: Re: bug#59807: 29.0.60; [PATCH] python-ts-mode does not auto-complete
 the closing quote
Date: Sun, 4 Dec 2022 20:32:41 +0800
[Message part 1 (text/plain, inline)]
> On Dec 4, 2022, at 15:19, Eli Zaretskii <eliz <at> gnu.org> wrote:
> 
> Thanks, but please format the log message according to our conventions:
> there should be a description of the actual changes after the last colon.

Thanks, descriptions added in the revised patch.



Kai
[Message part 2 (text/html, inline)]
[0001-Fix-syntax-tables-of-tree-sitter-modes.patch (application/octet-stream, attachment)]
[Message part 4 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59807; Package emacs. (Mon, 05 Dec 2022 06:29:01 GMT) Full text and rfc822 format available.

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

From: Yuan Fu <yuf011 <at> ucsd.edu>
To: Kai Ma <justksqsf <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 59807 <at> debbugs.gnu.org
Subject: Re: bug#59807: 29.0.60; [PATCH] python-ts-mode does not 
 auto-complete the closing quote
Date: Sun, 4 Dec 2022 22:28:10 -0800
Kai Ma <justksqsf <at> gmail.com> writes:

>  On Dec 4, 2022, at 15:19, Eli Zaretskii <eliz <at> gnu.org> wrote:
>
>  Thanks, but please format the log message according to our conventions:
>  there should be a description of the actual changes after the last colon.
>
> Thanks, descriptions added in the revised patch.

Looks good, thanks. Have you signed the copyright assignment? (BTW, Eli,
what’s the standard way for checking this?)

Yuan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59807; Package emacs. (Mon, 05 Dec 2022 06:49:01 GMT) Full text and rfc822 format available.

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

From: Kai Ma <justksqsf <at> gmail.com>
To: Yuan Fu <yuf011 <at> ucsd.edu>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 59807 <at> debbugs.gnu.org
Subject: Re: bug#59807: 29.0.60; [PATCH] python-ts-mode does not auto-complete
 the closing quote
Date: Mon, 5 Dec 2022 14:48:36 +0800
> On Dec 5, 2022, at 14:28, Yuan Fu <yuf011 <at> ucsd.edu> wrote:
> 
> Kai Ma <justksqsf <at> gmail.com> writes:
> 
>> On Dec 4, 2022, at 15:19, Eli Zaretskii <eliz <at> gnu.org> wrote:
>> 
>> Thanks, but please format the log message according to our conventions:
>> there should be a description of the actual changes after the last colon.
>> 
>> Thanks, descriptions added in the revised patch.
> 
> Looks good, thanks. Have you signed the copyright assignment? (BTW, Eli,
> what’s the standard way for checking this?)

No, I haven’t.  Thanks for the heads up.
I’ve just started the CA process according to CONTRIBUTE.  
Will let you know when I’m done.

Kai



Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59807; Package emacs. (Mon, 05 Dec 2022 08:24:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Yuan Fu <yuf011 <at> ucsd.edu>, Kai Ma <justksqsf <at> gmail.com>
Cc: 59807 <at> debbugs.gnu.org
Subject: Re: bug#59807: 29.0.60; [PATCH] python-ts-mode does not  auto-complete the closing quote
Date: Mon, 05 Dec 2022 10:22:54 +0200
On December 5, 2022 8:28:10 AM GMT+02:00, Yuan Fu <yuf011 <at> ucsd.edu> wrote:
> 
> Kai Ma <justksqsf <at> gmail.com> writes:
> 
> >  On Dec 4, 2022, at 15:19, Eli Zaretskii <eliz <at> gnu.org> wrote:
> >
> >  Thanks, but please format the log message according to our conventions:
> >  there should be a description of the actual changes after the last colon.
> >
> > Thanks, descriptions added in the revised patch.
> 
> Looks good, thanks. Have you signed the copyright assignment? (BTW, Eli,
> what’s the standard way for checking this?)
> 
> Yuan
> 

The standard way is to ask me.




Added tag(s) pending. Request was from Stefan Kangas <stefankangas <at> gmail.com> to control <at> debbugs.gnu.org. (Tue, 13 Dec 2022 01:05:05 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59807; Package emacs. (Tue, 13 Dec 2022 01:22:01 GMT) Full text and rfc822 format available.

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

From: Kai Ma <justksqsf <at> gmail.com>
To: Yuan Fu <yuf011 <at> ucsd.edu>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 59807 <at> debbugs.gnu.org
Subject: Re: bug#59807: 29.0.60; [PATCH] python-ts-mode does not auto-complete
 the closing quote
Date: Tue, 13 Dec 2022 09:20:52 +0800
[Message part 1 (text/plain, inline)]

> On Dec 5, 2022, at 14:48, Kai Ma <justksqsf <at> gmail.com> wrote:
> 
> No, I haven’t.  Thanks for the heads up.
> I’ve just started the CA process according to CONTRIBUTE.  
> Will let you know when I’m done.

Sorry for the delay.

Unfortunately, I cannot complete the assignment process, at least for now. The licensing officer at my university is really reluctant to sign a copyright disclaimer for me.

However, the cumulative number of lines changed by me is below 15 so far, so at least for this issue, we can move forward. I’ve added Copyright-paperwork-exempt in the attached patch.


[Message part 2 (text/html, inline)]
[0001-Fix-syntax-tables-of-tree-sitter-modes.patch (application/octet-stream, attachment)]
[Message part 4 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59807; Package emacs. (Tue, 13 Dec 2022 02:25:01 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Kai Ma <justksqsf <at> gmail.com>, Yuan Fu <yuf011 <at> ucsd.edu>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 59807 <at> debbugs.gnu.org
Subject: Re: bug#59807: 29.0.60; [PATCH] python-ts-mode does not auto-complete
 the closing quote
Date: Mon, 12 Dec 2022 18:24:12 -0800
Kai Ma <justksqsf <at> gmail.com> writes:

> Unfortunately, I cannot complete the assignment process, at least for
> now. The licensing officer at my university is really reluctant to
> sign a copyright disclaimer for me.

Thanks for trying.

> However, the cumulative number of lines changed by me is below 15 so
> far, so at least for this issue, we can move forward. I’ve added
> Copyright-paperwork-exempt in the attached patch.

-ENOPATCH




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59807; Package emacs. (Tue, 13 Dec 2022 05:29:01 GMT) Full text and rfc822 format available.

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

From: Yuan Fu <yuf011 <at> ucsd.edu>
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: Kai Ma <justksqsf <at> gmail.com>, 59807 <at> debbugs.gnu.org,
 Eli Zaretskii <eliz <at> gnu.org>
Subject: Re: bug#59807: 29.0.60; [PATCH] python-ts-mode does not auto-complete
 the closing quote
Date: Mon, 12 Dec 2022 21:28:46 -0800
[Message part 1 (text/plain, inline)]

> On Dec 12, 2022, at 6:24 PM, Stefan Kangas <stefankangas <at> gmail.com> wrote:
> 
> Kai Ma <justksqsf <at> gmail.com> writes:
> 
>> Unfortunately, I cannot complete the assignment process, at least for
>> now. The licensing officer at my university is really reluctant to
>> sign a copyright disclaimer for me.
> 
> Thanks for trying.

Yes, thanks!

> 
>> However, the cumulative number of lines changed by me is below 15 so
>> far, so at least for this issue, we can move forward. I’ve added
>> Copyright-paperwork-exempt in the attached patch.
> 
> -ENOPATCH
> 

I can see his patch. I attached it below.

Yuan

[0001-Fix-syntax-tables-of-tree-sitter-modes.patch (application/octet-stream, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59807; Package emacs. (Tue, 13 Dec 2022 12:18:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Kai Ma <justksqsf <at> gmail.com>
Cc: 59807 <at> debbugs.gnu.org, yuf011 <at> ucsd.edu
Subject: Re: bug#59807: 29.0.60; [PATCH] python-ts-mode does not auto-complete
 the closing quote
Date: Tue, 13 Dec 2022 14:17:43 +0200
> From: Kai Ma <justksqsf <at> gmail.com>
> Date: Tue, 13 Dec 2022 09:20:52 +0800
> Cc: Eli Zaretskii <eliz <at> gnu.org>,
>  59807 <at> debbugs.gnu.org
> 
> Unfortunately, I cannot complete the assignment process, at least for now. The licensing officer at my university is really reluctant to sign a copyright disclaimer for me.
> 
> However, the cumulative number of lines changed by me is below 15 so far, so at least for this issue, we can move forward. I’ve added Copyright-paperwork-exempt in the attached patch.

Yes, we can still accept this one, but it will probably be the last
one.




Reply sent to Yuan Fu <casouri <at> gmail.com>:
You have taken responsibility. (Wed, 14 Dec 2022 02:09:02 GMT) Full text and rfc822 format available.

Notification sent to Kai Ma <justksqsf <at> gmail.com>:
bug acknowledged by developer. (Wed, 14 Dec 2022 02:09:02 GMT) Full text and rfc822 format available.

Message #45 received at 59807-done <at> debbugs.gnu.org (full text, mbox):

From: Yuan Fu <casouri <at> gmail.com>
To: yuf011 <at> ucsd.edu
Cc: Kai Ma <justksqsf <at> gmail.com>, eliz <at> gnu.org,
 Stefan Kangas <stefankangas <at> gmail.com>, 59807-done <at> debbugs.gnu.org
Subject: Re: bug#59807: 29.0.60; [PATCH] python-ts-mode does not 
 auto-complete the closing quote
Date: Tue, 13 Dec 2022 18:08:27 -0800
Yuan Fu <yuf011 <at> ucsd.edu> writes:

>> On Dec 12, 2022, at 6:24 PM, Stefan Kangas <stefankangas <at> gmail.com> wrote:
>> 
>> Kai Ma <justksqsf <at> gmail.com> writes:
>> 
>>> Unfortunately, I cannot complete the assignment process, at least for
>>> now. The licensing officer at my university is really reluctant to
>>> sign a copyright disclaimer for me.
>> 
>> Thanks for trying.
>
> Yes, thanks!
>
>> 
>>> However, the cumulative number of lines changed by me is below 15 so
>>> far, so at least for this issue, we can move forward. I’ve added
>>> Copyright-paperwork-exempt in the attached patch.
>> 
>> -ENOPATCH
>> 
>
> I can see his patch. I attached it below.

I applied the patch. Due to recent changes on the branch I needed to
modify it a little.  As a result, the patch contains fewer lines of
change.

Yuan




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 11 Jan 2023 12:24:04 GMT) Full text and rfc822 format available.

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

Previous Next


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