unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* 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
@ 2024-11-22 13:35 Vincenzo Pupillo
  2024-11-22 14:08 ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Vincenzo Pupillo @ 2024-11-22 13:35 UTC (permalink / raw)
  To: 74474

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@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










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

* 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
  2024-11-22 13:35 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 Vincenzo Pupillo
@ 2024-11-22 14:08 ` Eli Zaretskii
  2024-11-24  5:58   ` Yuan Fu
  0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2024-11-22 14:08 UTC (permalink / raw)
  To: Vincenzo Pupillo, Yuan Fu; +Cc: 74474

> From: Vincenzo Pupillo <v.pupillo@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@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?





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

* 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
  2024-11-22 14:08 ` Eli Zaretskii
@ 2024-11-24  5:58   ` Yuan Fu
  2024-11-24  7:50     ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Yuan Fu @ 2024-11-24  5:58 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Vincenzo Pupillo, 74474



> On Nov 22, 2024, at 6:08 AM, Eli Zaretskii <eliz@gnu.org> wrote:
> 
>> From: Vincenzo Pupillo <v.pupillo@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@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




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

* 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
  2024-11-24  5:58   ` Yuan Fu
@ 2024-11-24  7:50     ` Eli Zaretskii
  2024-11-25  1:49       ` Yuan Fu
  0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2024-11-24  7:50 UTC (permalink / raw)
  To: Yuan Fu; +Cc: v.pupillo, 74474

> From: Yuan Fu <casouri@gmail.com>
> Date: Sat, 23 Nov 2024 21:58:32 -0800
> Cc: Vincenzo Pupillo <v.pupillo@gmail.com>,
>  74474@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.





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

* 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
  2024-11-24  7:50     ` Eli Zaretskii
@ 2024-11-25  1:49       ` Yuan Fu
  0 siblings, 0 replies; 5+ messages in thread
From: Yuan Fu @ 2024-11-25  1:49 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Vincenzo Pupillo, 74474-done



> On Nov 23, 2024, at 11:50 PM, Eli Zaretskii <eliz@gnu.org> wrote:
> 
>> From: Yuan Fu <casouri@gmail.com>
>> Date: Sat, 23 Nov 2024 21:58:32 -0800
>> Cc: Vincenzo Pupillo <v.pupillo@gmail.com>,
>> 74474@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




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

end of thread, other threads:[~2024-11-25  1:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-22 13:35 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 Vincenzo Pupillo
2024-11-22 14:08 ` Eli Zaretskii
2024-11-24  5:58   ` Yuan Fu
2024-11-24  7:50     ` Eli Zaretskii
2024-11-25  1:49       ` Yuan Fu

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).