GNU bug report logs - #74474
30.0.92; treesit-defun-prefer-top-level is still used in js, ruby-ts-mode, typescript-ts-mode, c-ts-mode and php-ts-mode

Previous Next

Package: emacs;

Reported by: Vincenzo Pupillo <v.pupillo <at> gmail.com>

Date: Fri, 22 Nov 2024 13:36:02 UTC

Severity: normal

Found in version 30.0.92

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 74474 in the body.
You can then email your comments to 74474 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#74474; Package emacs. (Fri, 22 Nov 2024 13:36:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Vincenzo Pupillo <v.pupillo <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 22 Nov 2024 13:36:02 GMT) Full text and rfc822 format available.

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

From: Vincenzo Pupillo <v.pupillo <at> gmail.com>
To: Bug Emacs <bug-gnu-emacs <at> gnu.org>
Subject: 30.0.92; treesit-defun-prefer-top-level is still used in js,
 ruby-ts-mode, typescript-ts-mode, c-ts-mode and php-ts-mode
Date: Fri, 22 Nov 2024 14:35:50 +0100
Ciao,
I am writing a treesitter-based version of mhtml (email threads https://
lists.gnu.org/archive/html/emacs-devel/2024-11/msg00079.html). 
I started from what I did for php-ts-mode. 
In php-ts-mode the variable treesit-defun-prefer-top-level is initialized to 
t. 
This variable, whose use I had borrowed from c-ts-mode, no longer exists.
From the Changelog.4 :  
2022-12-19  Stefan Kangas  <stefankangas <at> gmail.com>

	Merge from origin/emacs-29

	67bc96c9d94 Remove treesit-defun-prefer-top-level and friends
	4f9bccef556 Add yaml-ts-mode (Bug#60105)
	f9cb144d45a Fix indentation in json-ts-mode (bug#60123)
	3d348c46e78 ; Handle nil ARG in treesit-beginning/end-of-defun
	1a66435dda3 New input method 'cyrillic-chuvash'
	b9227c502d7 ; Improve wording of 'format' doc string

This variable is also used by other major modes, with different value:

lisp/progmodes/c-ts-mode.el
1259:  (setq-local treesit-defun-prefer-top-level t)

lisp/progmodes/typescript-ts-mode.el
465:  (setq-local treesit-defun-prefer-top-level t)

lisp/progmodes/ruby-ts-mode.el
1202:  (setq-local treesit-defun-prefer-top-level nil)

lisp/progmodes/js.el
3919:    (setq-local treesit-defun-prefer-top-level t)

treesit-defun-prefer-top-level should have been replaced by treesit-defun-
tactic which, however, is initialized by default with a value that should 
match only (setq treesit-defun-prefer-top-level nil). 

Is it possible that this is related to problems similar to those indicated in 
bug#73404?

Thank you.

Vincenzo









Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#74474; Package emacs. (Fri, 22 Nov 2024 14:09:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Vincenzo Pupillo <v.pupillo <at> gmail.com>,
 Yuan Fu <casouri <at> gmail.com>
Cc: 74474 <at> debbugs.gnu.org
Subject: Re: bug#74474: 30.0.92;
 treesit-defun-prefer-top-level is still used in js, ruby-ts-mode,
 typescript-ts-mode, c-ts-mode and php-ts-mode
Date: Fri, 22 Nov 2024 16:08:03 +0200
> From: Vincenzo Pupillo <v.pupillo <at> gmail.com>
> Date: Fri, 22 Nov 2024 14:35:50 +0100
> 
> Ciao,
> I am writing a treesitter-based version of mhtml (email threads https://
> lists.gnu.org/archive/html/emacs-devel/2024-11/msg00079.html). 
> I started from what I did for php-ts-mode. 
> In php-ts-mode the variable treesit-defun-prefer-top-level is initialized to 
> t. 
> This variable, whose use I had borrowed from c-ts-mode, no longer exists.
> >From the Changelog.4 :  
> 2022-12-19  Stefan Kangas  <stefankangas <at> gmail.com>
> 
> 	Merge from origin/emacs-29
> 
> 	67bc96c9d94 Remove treesit-defun-prefer-top-level and friends
> 	4f9bccef556 Add yaml-ts-mode (Bug#60105)
> 	f9cb144d45a Fix indentation in json-ts-mode (bug#60123)
> 	3d348c46e78 ; Handle nil ARG in treesit-beginning/end-of-defun
> 	1a66435dda3 New input method 'cyrillic-chuvash'
> 	b9227c502d7 ; Improve wording of 'format' doc string
> 
> This variable is also used by other major modes, with different value:
> 
> lisp/progmodes/c-ts-mode.el
> 1259:  (setq-local treesit-defun-prefer-top-level t)
> 
> lisp/progmodes/typescript-ts-mode.el
> 465:  (setq-local treesit-defun-prefer-top-level t)
> 
> lisp/progmodes/ruby-ts-mode.el
> 1202:  (setq-local treesit-defun-prefer-top-level nil)
> 
> lisp/progmodes/js.el
> 3919:    (setq-local treesit-defun-prefer-top-level t)
> 
> treesit-defun-prefer-top-level should have been replaced by treesit-defun-
> tactic which, however, is initialized by default with a value that should 
> match only (setq treesit-defun-prefer-top-level nil). 
> 
> Is it possible that this is related to problems similar to those indicated in 
> bug#73404?

Yuan, any comments?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#74474; Package emacs. (Sun, 24 Nov 2024 06:00:02 GMT) Full text and rfc822 format available.

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

From: Yuan Fu <casouri <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Vincenzo Pupillo <v.pupillo <at> gmail.com>, 74474 <at> debbugs.gnu.org
Subject: Re: bug#74474: 30.0.92; treesit-defun-prefer-top-level is still used
 in js, ruby-ts-mode, typescript-ts-mode, c-ts-mode and php-ts-mode
Date: Sat, 23 Nov 2024 21:58:32 -0800

> On Nov 22, 2024, at 6:08 AM, Eli Zaretskii <eliz <at> gnu.org> wrote:
> 
>> From: Vincenzo Pupillo <v.pupillo <at> gmail.com>
>> Date: Fri, 22 Nov 2024 14:35:50 +0100
>> 
>> Ciao,
>> I am writing a treesitter-based version of mhtml (email threads https://
>> lists.gnu.org/archive/html/emacs-devel/2024-11/msg00079.html). 
>> I started from what I did for php-ts-mode. 
>> In php-ts-mode the variable treesit-defun-prefer-top-level is initialized to 
>> t. 
>> This variable, whose use I had borrowed from c-ts-mode, no longer exists.
>>> From the Changelog.4 :  
>> 2022-12-19  Stefan Kangas  <stefankangas <at> gmail.com>
>> 
>> Merge from origin/emacs-29
>> 
>> 67bc96c9d94 Remove treesit-defun-prefer-top-level and friends
>> 4f9bccef556 Add yaml-ts-mode (Bug#60105)
>> f9cb144d45a Fix indentation in json-ts-mode (bug#60123)
>> 3d348c46e78 ; Handle nil ARG in treesit-beginning/end-of-defun
>> 1a66435dda3 New input method 'cyrillic-chuvash'
>> b9227c502d7 ; Improve wording of 'format' doc string
>> 
>> This variable is also used by other major modes, with different value:
>> 
>> lisp/progmodes/c-ts-mode.el
>> 1259:  (setq-local treesit-defun-prefer-top-level t)
>> 
>> lisp/progmodes/typescript-ts-mode.el
>> 465:  (setq-local treesit-defun-prefer-top-level t)
>> 
>> lisp/progmodes/ruby-ts-mode.el
>> 1202:  (setq-local treesit-defun-prefer-top-level nil)
>> 
>> lisp/progmodes/js.el
>> 3919:    (setq-local treesit-defun-prefer-top-level t)
>> 
>> treesit-defun-prefer-top-level should have been replaced by treesit-defun-
>> tactic which, however, is initialized by default with a value that should 
>> match only (setq treesit-defun-prefer-top-level nil). 

Ohhh, yes. That’s my bad, I should’ve scanned for this variable and remove them. Fortunately, just setting this variable doesn’t do any harm. Also, IIRC, this variable lived and died before we released Emacs 29, so there’s no backward-compatibility breakage.

For context, treesit-defun-prefer-top-level was replaced by treesit-defun-tactic. treesit-defun-tactic is supposed to be set by the user. So major mode don’t need to worry about it, unless they want to. TBH major modes didn’t need to set treesit-defun-prefer-top-level either, people probably copied it from c-ts-mode, which do need to set it.

>> 
>> Is it possible that this is related to problems similar to those indicated in 
>> bug#73404?

Not quite, that one is about sexp navigation, which this variable doesn’t affect. Plus this variable isn’t used now anyway.

> 
> Yuan, any comments?

Thanks for the ping! I was going to push the change to emacs-30, but want to check with you first. Is it ok to push to emacs-30? As I described, the change is cosmetic, we stopped using that variable before Emacs 29 released.

Yuan



Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#74474; Package emacs. (Sun, 24 Nov 2024 07:51:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Yuan Fu <casouri <at> gmail.com>
Cc: v.pupillo <at> gmail.com, 74474 <at> debbugs.gnu.org
Subject: Re: bug#74474: 30.0.92; treesit-defun-prefer-top-level is still used
 in js, ruby-ts-mode, typescript-ts-mode, c-ts-mode and php-ts-mode
Date: Sun, 24 Nov 2024 09:50:17 +0200
> From: Yuan Fu <casouri <at> gmail.com>
> Date: Sat, 23 Nov 2024 21:58:32 -0800
> Cc: Vincenzo Pupillo <v.pupillo <at> gmail.com>,
>  74474 <at> debbugs.gnu.org
> 
> > Yuan, any comments?
> 
> Thanks for the ping! I was going to push the change to emacs-30, but want to check with you first. Is it ok to push to emacs-30? As I described, the change is cosmetic, we stopped using that variable before Emacs 29 released.

If you mean the change which removes this variable from those 4 files,
then yes, please install on emacs-30, and thanks.




Reply sent to Yuan Fu <casouri <at> gmail.com>:
You have taken responsibility. (Mon, 25 Nov 2024 01:51:02 GMT) Full text and rfc822 format available.

Notification sent to Vincenzo Pupillo <v.pupillo <at> gmail.com>:
bug acknowledged by developer. (Mon, 25 Nov 2024 01:51:03 GMT) Full text and rfc822 format available.

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

From: Yuan Fu <casouri <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Vincenzo Pupillo <v.pupillo <at> gmail.com>, 74474-done <at> debbugs.gnu.org
Subject: Re: bug#74474: 30.0.92; treesit-defun-prefer-top-level is still used
 in js, ruby-ts-mode, typescript-ts-mode, c-ts-mode and php-ts-mode
Date: Sun, 24 Nov 2024 17:49:18 -0800

> On Nov 23, 2024, at 11:50 PM, Eli Zaretskii <eliz <at> gnu.org> wrote:
> 
>> From: Yuan Fu <casouri <at> gmail.com>
>> Date: Sat, 23 Nov 2024 21:58:32 -0800
>> Cc: Vincenzo Pupillo <v.pupillo <at> gmail.com>,
>> 74474 <at> debbugs.gnu.org
>> 
>>> Yuan, any comments?
>> 
>> Thanks for the ping! I was going to push the change to emacs-30, but want to check with you first. Is it ok to push to emacs-30? As I described, the change is cosmetic, we stopped using that variable before Emacs 29 released.
> 
> If you mean the change which removes this variable from those 4 files,
> then yes, please install on emacs-30, and thanks.

Great, I pushed the change to emacs-30.

Yuan



bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 23 Dec 2024 12:24:12 GMT) Full text and rfc822 format available.

This bug report was last modified 174 days ago.

Previous Next


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