diff options
| author | Juri Linkov | 2025-06-12 20:22:42 +0300 |
|---|---|---|
| committer | Juri Linkov | 2025-06-12 20:22:42 +0300 |
| commit | 76f422da26b09a5d2646c0597871423f019a9573 (patch) | |
| tree | 715898da8fcead62367cfb21c05f09b5eeed5221 /lisp/progmodes/python.el | |
| parent | 799cef5d94bb69d5a1b6bcc8e90819ed90edfd00 (diff) | |
| download | emacs-76f422da26b09a5d2646c0597871423f019a9573.tar.gz emacs-76f422da26b09a5d2646c0597871423f019a9573.zip | |
Add 'treesit-sexp-thing' to use instead of 'treesit-sexp-type-regexp'.
* lisp/treesit.el (treesit-sexp-thing): New variable to use
instead of 'treesit-sexp-type-regexp'.
(treesit-sexp-thing-down-list): Rename from 'treesit-sexp-type-down-list'.
(treesit-sexp-thing-up-list): Rename from 'treesit-sexp-type-up-list'.
(treesit-forward-sexp, treesit--forward-list-with-default)
(treesit-down-list, treesit-up-list): Update references to the
above variables.
(treesit-cycle-sexp-thing): Rename from 'treesit-cycle-sexp-type'.
* lisp/progmodes/elixir-ts-mode.el (elixir-ts-mode): Update same variables.
* lisp/progmodes/heex-ts-mode.el (heex-ts-mode): Set these variables
instead of calling the function that sets them.
* lisp/progmodes/python.el (python-ts-mode): Check if variables
'treesit-sentence-type-regexp' and 'treesit-sexp-type-regexp' are bound.
https://lists.gnu.org/archive/html/emacs-devel/2025-06/msg00182.html
Diffstat (limited to 'lisp/progmodes/python.el')
| -rw-r--r-- | lisp/progmodes/python.el | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 96aa473e9e3..f1c18b0bd56 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -7332,18 +7332,20 @@ implementations: `python-mode' and `python-ts-mode'." | |||
| 7332 | (setq-local treesit-defun-name-function | 7332 | (setq-local treesit-defun-name-function |
| 7333 | #'python--treesit-defun-name) | 7333 | #'python--treesit-defun-name) |
| 7334 | 7334 | ||
| 7335 | (setq-local treesit-sentence-type-regexp | 7335 | (when (boundp 'treesit-sentence-type-regexp) |
| 7336 | (regexp-opt '("statement" | 7336 | (setq-local treesit-sentence-type-regexp |
| 7337 | "clause"))) | 7337 | (regexp-opt '("statement" |
| 7338 | 7338 | "clause")))) | |
| 7339 | (setq-local treesit-sexp-type-regexp | 7339 | |
| 7340 | (regexp-opt '("expression" | 7340 | (when (boundp 'treesit-sexp-type-regexp) |
| 7341 | "string" | 7341 | (setq-local treesit-sexp-type-regexp |
| 7342 | "call" | 7342 | (regexp-opt '("expression" |
| 7343 | "operator" | 7343 | "string" |
| 7344 | "identifier" | 7344 | "call" |
| 7345 | "integer" | 7345 | "operator" |
| 7346 | "float"))) | 7346 | "identifier" |
| 7347 | "integer" | ||
| 7348 | "float")))) | ||
| 7347 | 7349 | ||
| 7348 | (treesit-major-mode-setup) | 7350 | (treesit-major-mode-setup) |
| 7349 | 7351 | ||