From 50b91ed458df8f04359996b31b18fb318ba64a47 Mon Sep 17 00:00:00 2001 From: Yuan Fu Date: Sat, 23 Nov 2024 21:39:40 -0800 Subject: [PATCH] Remove mention of treesit-defun-prefer-top-level (bug#74474) treesit-defun-prefer-top-level is removed before Emacs 29 released and was replaced by treesit-defun-tactic. These statements that set it doesn't do anything other than introduce confusion, so we should remove them. * lisp/progmodes/c-ts-mode.el (c-ts-base-mode): * lisp/progmodes/js.el (js-ts-mode): * lisp/progmodes/php-ts-mode.el (php-ts-mode): * lisp/progmodes/ruby-ts-mode.el (ruby-ts-mode): * lisp/progmodes/typescript-ts-mode.el: (typescript-ts-base-mode): Remove statements setting treesit-defun-prefer-top-level. --- lisp/progmodes/c-ts-mode.el | 6 +++--- lisp/progmodes/js.el | 1 - lisp/progmodes/php-ts-mode.el | 4 ---- lisp/progmodes/ruby-ts-mode.el | 3 --- lisp/progmodes/typescript-ts-mode.el | 1 - 5 files changed, 3 insertions(+), 12 deletions(-) diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el index 90eeffe370c..73c1411ad0f 100644 --- a/lisp/progmodes/c-ts-mode.el +++ b/lisp/progmodes/c-ts-mode.el @@ -1254,9 +1254,6 @@ BEG and END are described in `treesit-range-rules'." `((c ,@c-ts-mode--thing-settings) (cpp ,@c-ts-mode--thing-settings))) - ;; Nodes like struct/enum/union_specifier can appear in - ;; function_definitions, so we need to find the top-level node. - (setq-local treesit-defun-prefer-top-level t) ;; When the code is in incomplete state, try to make a better guess ;; about which node to indent against. @@ -1346,6 +1343,9 @@ in your init files." ;; Font-lock. (setq-local treesit-font-lock-settings (c-ts-mode--font-lock-settings 'c)) ;; Navigation. + ;; + ;; Nodes like struct/enum/union_specifier can appear in + ;; function_definitions, so we need to find the top-level node. (setq-local treesit-defun-tactic 'top-level) (treesit-major-mode-setup) diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index 75c8111035c..5ac5b88d17f 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el @@ -3916,7 +3916,6 @@ See `treesit-thing-settings' for more information.") ;; Indent. (setq-local treesit-simple-indent-rules js--treesit-indent-rules) ;; Navigation. - (setq-local treesit-defun-prefer-top-level t) (setq-local treesit-defun-type-regexp (rx (or "class_declaration" "method_definition" diff --git a/lisp/progmodes/php-ts-mode.el b/lisp/progmodes/php-ts-mode.el index d8a3f60508b..f9fd03cbf72 100644 --- a/lisp/progmodes/php-ts-mode.el +++ b/lisp/progmodes/php-ts-mode.el @@ -1479,10 +1479,6 @@ Depends on `c-ts-common-comment-setup'." "statement"))) (text ,(regexp-opt '("comment" "text")))))) - ;; Nodes like struct/enum/union_specifier can appear in - ;; function_definitions, so we need to find the top-level node. - (setq-local treesit-defun-prefer-top-level t) - ;; Indent. (when (eq php-ts-mode-indent-style 'wordpress) (setq-local indent-tabs-mode t)) diff --git a/lisp/progmodes/ruby-ts-mode.el b/lisp/progmodes/ruby-ts-mode.el index adcdf15c7ad..7c1c07ac5b6 100644 --- a/lisp/progmodes/ruby-ts-mode.el +++ b/lisp/progmodes/ruby-ts-mode.el @@ -1198,9 +1198,6 @@ leading double colon is not added." (treesit-node-parent node)) "interpolation")))))))) - ;; AFAIK, Ruby can not nest methods - (setq-local treesit-defun-prefer-top-level nil) - ;; Imenu. (setq-local imenu-create-index-function #'ruby-ts--imenu) diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el index 3606a139d50..dcf1f721f2f 100644 --- a/lisp/progmodes/typescript-ts-mode.el +++ b/lisp/progmodes/typescript-ts-mode.el @@ -462,7 +462,6 @@ This mode is intended to be inherited by concrete major modes." ;; Comments. (c-ts-common-comment-setup) - (setq-local treesit-defun-prefer-top-level t) ;; Electric (setq-local electric-indent-chars