aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/python.el (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* Clean up python-ts-mode font-lock featuresYuan Fu2022-12-261-9/+30
| | | | | | | | | * lisp/progmodes/python.el (python--treesit-settings): Remove unnecessary override flags, add function and variable feature, fix assignment feature. (python--treesit-variable-p) (python--treesit-fontify-variable): New functions. (python-ts-mode): Add function and variable feature.
* ; Fix typosStefan Kangas2022-12-261-1/+1
| | | | (cherry picked from commit a5d39e11443fa30c8e8bc58254a1a59550dcd99e)
* Support treesit-defun-name in tree-sitter major modesYuan Fu2022-12-241-3/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/progmodes/csharp-mode.el (csharp-ts-mode--defun-name): New function. (csharp-ts-mode--imenu-1): Extract into new function. (csharp-ts-mode): Setup treesit-defun-name-function. * lisp/progmodes/java-ts-mode.el (java-ts-mode--defun-name): New function. (java-ts-mode--imenu-1): Extract into new function. (java-ts-mode): Setup treesit-defun-name-function. * lisp/progmodes/js.el (js-treesit-current-defun): Remove function. This function is not used (for a while already). (js--treesit-defun-name): New function. (js--treesit-imenu-1): Extract into new function. (js-ts-mode): Setup treesit-defun-name-function. * lisp/progmodes/json-ts-mode.el (json-ts-mode--defun-name): New function. (json-ts-mode--imenu-1): Extract into new function. (json-ts-mode): Setup treesit-defun-name-function. * lisp/progmodes/python.el (python--treesit-defun-name): New function. (python--imenu-treesit-create-index-1): Extract into new function. (python-ts-mode): Setup treesit-defun-name-function. * lisp/progmodes/rust-ts-mode.el (rust-ts-mode--defun-name): New function. (rust-ts-mode--imenu-1): Extract into new function. (rust-ts-mode): Setup treesit-defun-name-function. * lisp/textmodes/css-mode.el (css--treesit-defun-name): New function. (css--treesit-imenu-1): Extract into new function. (css-ts-mode): Setup treesit-defun-name-function. * lisp/textmodes/toml-ts-mode.el (toml-ts-mode--get-table-name): Remove function. (toml-ts-mode--defun-name): New function. (toml-ts-mode--imenu-1): Extract into new function. (toml-ts-mode): Setup treesit-defun-name-function.
* Add "function" feature to python-ts-mode (bug#59977)Yuan Fu2022-12-151-3/+11
| | | | | | * lisp/progmodes/python.el (python--treesit-settings): Add feature. (python-ts-mode): Add feature. And fix indentation for the python-indent-guess-indent-offset code.
* Add basic support for hideshow in python-ts-mode (bug#60044)Yuan Fu2022-12-151-13/+15
| | | | | * lisp/progmodes/python.el (python-base-mode): Add setup for python-ts-mode.
* Fix syntax tables of tree-sitter modes (bug#59807)Kai Ma2022-12-131-0/+1
| | | | | | | | | | | | | | Tree-sitter modes should use the same syntax table as the non-tree-sitter ones. * 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) Copyright-paperwork-exempt: yes xx
* Add "->" to python--treesit-operators (bug#59968)Daniel Martín2022-12-121-1/+2
| | | | | * lisp/progmodes/python.el (python--treesit-operators): Add "->", used to specify the return types of functions in Python.
* Improve treesit-fontify-with-overrideYuan Fu2022-12-041-1/+1
| | | | | | | | | | | | | | | | | | | | | This also fixes fontification problem with c-ts-mode--fontify-defun. Now treesit-fontify-with-override clips the fontification region for the user, so no need for (max start node-start) shenanigans anymore. More importantly it doesn't fontify unless the region between node-start and node-end intersects with the region between start and end, which fixes the problem with c-ts-mode--fontify-defun. * lisp/treesit.el (treesit-fontify-with-override): Add optional parameter BOUND-START and BOUND-END. Wrap the function body in a when-form. * lisp/progmodes/c-ts-mode.el (c-ts-mode--fontify-declarator) (c-ts-mode--fontify-variable) (c-ts-mode--fontify-defun) (c-ts-fontify-error) * lisp/progmodes/js.el (js--fontify-template-string) * lisp/progmodes/python.el (python--treesit-fontify-string): Use the new signature.
* Add case and match to python--treesit-keywords (bug#59720)Daniel Martín2022-12-011-2/+2
| | | | | * lisp/progmodes/python.el (python--treesit-keywords): Add "case" and "match" keywords.
* Add highlighting Python operators (bug#59629)kobarity2022-12-011-5/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/progmodes/python.el (python-rx): Remove "is" and "not" from operator. (python-font-lock-keywords-maximum-decoration): Add highlighting operators. * test/lisp/progmodes/python-tests.el (python-font-lock-assignment-statement-1) (python-font-lock-assignment-statement-2) (python-font-lock-assignment-statement-3) (python-font-lock-assignment-statement-4) (python-font-lock-assignment-statement-5) (python-font-lock-assignment-statement-6) (python-font-lock-assignment-statement-7) (python-font-lock-assignment-statement-8) (python-font-lock-assignment-statement-9) (python-font-lock-assignment-statement-10) (python-font-lock-assignment-statement-11) (python-font-lock-assignment-statement-12) (python-font-lock-assignment-statement-13) (python-font-lock-assignment-statement-14) (python-font-lock-assignment-statement-15) (python-font-lock-assignment-statement-16) (python-font-lock-assignment-statement-17) (python-font-lock-assignment-statement-18) (python-font-lock-assignment-statement-multiline-1) (python-font-lock-assignment-statement-multiline-2) (python-font-lock-assignment-statement-multiline-3) (python-font-lock-assignment-statement-multiline-4) (python-font-lock-assignment-statement-multiline-5) (python-font-lock-assignment-statement-multiline-6) (python-font-lock-escape-sequence-multiline-string): Modify expectations to include faces for operators. (python-font-lock-operator-1, python-font-lock-operator-2): New tests.
* Sink python indent offset guessing to avoid test failureMattias Engdegård2022-11-301-5/+9
| | | | | | | | | | | | Call python-indent-guess-indent-offset late in the set-up of python-mode and python-ts-mode to make sure that the required other settings (of syntax-propetize-function in particular) have been carried out. This cures a python-test failure (bug#59477). * lisp/progmodes/python.el (python-base-mode): Move python-indent-guess-indent-offset call from here... (python-mode): ...to here... (python-ts-mode): ...and here.
* Reorganize treesit-font-lock-feaure-list's to the new level schemeYuan Fu2022-11-261-5/+5
| | | | | | | | | | | * lisp/progmodes/c-ts-mode.el (c-ts-mode--base-mode) * lisp/progmodes/csharp-mode.el (csharp-ts-mode) * lisp/progmodes/java-ts-mode.el (java-ts-mode) * lisp/progmodes/js.el (js-ts-mode) * lisp/progmodes/python.el (python-ts-mode) * lisp/progmodes/sh-script.el (bash-ts-mode) * lisp/progmodes/typescript-ts-mode.el (typescript-ts-mode): Reorganized treesit-font-lock-feature-list.
* Partially fix some python tests (bug#59477)Yuan Fu2022-11-261-1/+3
| | | | | | | | | | | | | | | | | | | This fixes python-font-lock-assignment-statement-multiline-1 python-font-lock-assignment-statement-multiline-2 python-font-lock-assignment-statement-multiline-3 python-font-lock-assignment-statement-multiline-4 python-font-lock-assignment-statement-multiline-5 python-font-lock-assignment-statement-multiline-6 but leaves python-tests--fill-long-first-line unfixed. * lisp/progmodes/python.el (python-mode): Add the missing setup.
* ; * lisp/progmodes/python.el (treesit-node-prev-sibling): Declare.Eli Zaretskii2022-11-251-1/+1
|
* Improve python-ts-mode fontification (bug#59534)Yuan Fu2022-11-241-5/+20
| | | | | * lisp/progmodes/python.el (python--treesit-operators): Add operators. (python--treesit-fontify-string): Fontify BOF docstrings.
* Don't skip nested defuns in python-ts-mode defun navigationYuan Fu2022-11-231-52/+2
| | | | | | | | | | | | This fixes bug#59495. Before this change, python tries to skip nested function definition. Now we don't skip any nested defun. * lisp/progmodes/python.el (python-treesit-beginning-of-defun) (python-treesit-end-of-defun): Remove functions. * lisp/progmodes/python.el (python-ts-mode): Use tree-sitter's default navigation function.
* ; Fix typosStefan Kangas2022-11-231-1/+1
|
* Tweak python-ts-mode fontification (bug#59470)Yuan Fu2022-11-221-1/+3
| | | | | | * lisp/progmodes/python.el (python--treesit-settings): Only fontify the @ and the identifier of a decorator, not the argument list (if there is any).
* Merge remote-tracking branch 'savannah/master' into feature/tree-sitterYuan Fu2022-11-211-21/+53
|\
| * Fix indentation for multi-line block start in Python modekobarity2022-11-101-0/+1
| | | | | | | | | | | | | | | | * lisp/progmodes/python.el (python-info-dedenter-opening-block-positions): Fix for multi-line block start. * test/lisp/progmodes/python-tests.el (python-info-dedenter-opening-block-positions-6): New test. (Bug#59009)
| * Disable completion/ElDoc/FFAP when Python program is runningkobarity2022-10-271-2/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/progmodes/python.el (python-completion-at-point) (python-ffap-module-path, python-eldoc--get-doc-at-point): Add check using `python-util-comint-end-of-output-p'. (python-util-comint-end-of-output-p): New function. * test/lisp/progmodes/python-tests.el (python-tests-shell-wait-for-prompt): Use `python-util-comint-end-of-output-p'. (python-completion-at-point-while-running-1) (python-ffap-module-path-1) (python-ffap-module-path-while-running-1) (python-eldoc--get-doc-at-point-1) (python-eldoc--get-doc-at-point-while-running-1): New tests. (Bug#58713)
| * Fix invalid search bound error in python-shell-completion-at-pointkobarity2022-10-161-9/+12
| | | | | | | | | | | | | | | | * lisp/progmodes/python.el (python-shell-completion-at-point): Add check if point is before line-start. * test/lisp/progmodes/python-tests.el (python-shell-completion-shell-buffer-1) (python-shell-completion-shell-buffer-native-1): New tests (bug#58548).
| * Disable completion when PDB is active in Python Shell bufferkobarity2022-10-161-1/+4
| | | | | | | | | | | | | | * lisp/progmodes/python.el (python-shell-completion-at-point): Disable completion in Python buffer when PDB is active in Python Shell buffer. * test/lisp/progmodes/python-tests.el (python-shell-completion-pdb-1): New test (bug#58562).
| * Fix Python completion when point in shell buffer is before promptkobarity2022-10-121-2/+4
| | | | | | | | | | | | | | * lisp/progmodes/python.el (python-shell-completion-at-point): Limit prompt boundaries check to shell buffer. * test/lisp/progmodes/python-tests.el (python-shell-completion-2): (python-shell-completion-native-2): New tests (bug#58441).
| * Fix Python completion failure under certain conditionskobarity2022-10-111-8/+18
| | | | | | | | | | | | | | | | | | | | | | * lisp/progmodes/python.el (python-shell-send-string-no-output): Save and restore `comint-last-prompt-overlay' or `comint-last-prompt'. * test/lisp/progmodes/python-tests.el (python-tests-shell-wait-for-prompt): New helper function. (python-tests-with-temp-buffer-with-shell): New helper macro. (python-shell-completion-1, python-shell-completion-native-1) (python-shell-completion-native-with-ffap-1) (python-shell-completion-native-with-eldoc-1): New tests (bug#58389).
* | ; Silence byte-compiler warningsEli Zaretskii2022-11-211-0/+9
| | | | | | | | | | | | | | | | | | | | * lisp/textmodes/css-mode.el: * lisp/progmodes/python.el: * lisp/progmodes/json-ts-mode.el: * lisp/progmodes/js.el: * lisp/progmodes/java-ts-mode.el: * lisp/progmodes/c-ts-mode.el: Add declarations of tree-sitter functions.
* | Add separate keymaps for js/python/css-ts-modeYuan Fu2022-11-211-1/+4
| | | | | | | | | | | | * lisp/progmodes/js.el (js-ts-mode-map) * lisp/progmodes/python.el (python-ts-mode-map) * lisp/textmodes/css-mode.el (css-ts-mode-map): New keymap.
* | Tweak python-ts-mode fontificationYuan Fu2022-11-211-4/+10
| | | | | | | | | | * lisp/progmodes/python.el (python--treesit-fontify-string): Make the matching condition for docstrings more specific.
* | Limit recursion level for tree-sitter imenu functionsYuan Fu2022-11-201-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Generating imenu index doesn't require going down to the bottom of the tree (defun's are usually top-level). Add limit so we don't go too far down on very large buffers. * lisp/progmodes/c-ts-mode.el (c-ts-mode--imenu) * lisp/progmodes/java-ts-mode.el (java-ts-mode--imenu) * lisp/progmodes/js.el (js--treesit-imenu) * lisp/progmodes/json-ts-mode.el (json-ts-mode--imenu) * lisp/progmodes/python.el (python-imenu-treesit-create-index) * lisp/textmodes/css-mode.el (css--treesit-imenu): Add limit to treesit-induce-sparse-tree.
* | ; Improve recently-modified documentationEli Zaretskii2022-11-201-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | * lisp/progmodes/python.el (python-base-mode) (python--treesit-fontify-string): * lisp/textmodes/css-mode.el (css-base-mode): * lisp/treesit.el (treesit-ready-p, treesit-comment-end) (treesit-simple-indent-presets): Fix typos and wording in doc strings. * doc/lispref/parsing.texi (Tree-sitter major modes): * doc/lispref/modes.texi (Parser-based Indentation): Fix wording and add cross-references.
* | Fix uses of treesit-ready-pYuan Fu2022-11-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | * lisp/progmodes/c-ts-mode.el (c-ts-mode) (c++-ts-mode) * lisp/progmodes/java-ts-mode.el (java-ts-mode) * lisp/progmodes/js.el (js-ts-mode) * lisp/progmodes/json-ts-mode.el (json-ts-mode) * lisp/progmodes/python.el (python-ts-mode) * lisp/progmodes/sh-script.el (sh-mode) * lisp/progmodes/ts-mode.el (ts-mode): Remove the MODE argument.
* | Merge function/class-name features in python-modeYuan Fu2022-11-191-7/+4
| | | | | | | | | | | | | | | | To keep consistency with other tree-sitter major modes. * lisp/progmodes/python.el (python--treesit-settings) (python-ts-mode): Merge function-name and class-name features into definition.
* | Split python-mode into native and tree-sitter variantYuan Fu2022-11-191-20/+29
| | | | | | | | | | | | | | * lisp/progmodes/python.el (python-base-mode): New virtual mode that contains most of the setup. (python-mode): Change to inherit from python-base-mode. (python-ts-mode): New mode that sets up tree-sitter.
* | Fix python-mode tree-sitter fontificationYuan Fu2022-11-191-10/+8
| | | | | | | | | | | | | | | | | | | | Forgot to update python-mode's code when I added the tree-sitter notifier facility. Now it doesn't need any special treatment anymore. Leaving it as is causes some incorrect fontification. * lisp/progmodes/python.el (python--treesit-fontify-string): Accept the string node rather than the quote node. (python--treesit-settings): Capture string node.
* | Utilize new font-lock faces for C/C++ and Python tree-sitter useRandy Taylor2022-11-171-6/+35
| | | | | | | | | | | | | | | | | | | | | | * lisp/progmodes/c-ts-mode.el (c-ts-mode--font-lock-settings): Use new escape, number, property, operator, bracket, and delimiter font-lock faces. (c-ts-mode--base-mode): Add them to the feature list. (c-ts-mode): Fix typo. * lisp/progmodes/python.el (python--treesit-settings): Use new number, property, operator, bracket, and delimiter font-lock faces. (python-mode): Add them to the feature list.
* | Make tree-sitter fontification automatically updateYuan Fu2022-11-151-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Now nodes that are affected and changed during re-parse will be correctly refontified. Nodes can change even if it corresponding text wasn't edited: additional text can complete the parse tree and resolve error nodes, for example. * lisp/progmodes/python.el (python-mode): Create Python parser before calling treesit-major-mode-setup. * lisp/treesit.el (treesit--font-lock-notifier): New function. (treesit-major-mode-setup): Register fontifier with every existing parser.
* | Remove the contextual hack in tree-sitter fontificationYuan Fu2022-11-151-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We now have a better facility that can replace the contextual hack. The C part is in the previous commit, and the Lisp part work will be in the next commit. * doc/lispref/modes.texi (Parser-based Font Lock): Update manual. * lisp/progmodes/js.el (js--treesit-font-lock-settings) * lisp/progmodes/python.el (python--treesit-settings) * lisp/progmodes/ts-mode.el (ts-mode--font-lock-settings): Stop marking contextual nodes. * lisp/treesit.el (treesit-font-lock-contextual-post-process): Remove function. (treesit-font-lock-fontify-region): Remove code processing contextual nodes.
* | Utilize new face font-lock-escape-face in python-modeYuan Fu2022-11-101-1/+1
| | | | | | | | | | * lisp/progmodes/python.el (python--treesit-settings): Use font-lock-escape-face rather than font-lock-constant-face.
* | Mimic existing python-mode beg/end-of-defun behavior betterYuan Fu2022-11-091-4/+52
| | | | | | | | | | | | | | * lisp/progmodes/python.el (python-treesit-beginning-of-defun) (python-treesit-end-of-defun): New functions. * lisp/progmodes/python.el (python-mode): Use custom beg/end-of-defun functions.
* | Pass region start and end to tree-sitter fontification functionsYuan Fu2022-11-021-5/+7
| | | | | | | | | | | | | | | | | | | | * doc/lispref/modes.texi (Parser-based Font Lock): Update manual. * lisp/progmodes/js.el (js--fontify-template-string) * lisp/progmodes/python.el (python--treesit-fontify-string): Update function to only fontify within the region. * lisp/treesit.el (treesit-font-lock-rules): Update docstring. (treesit-font-lock-fontify-region): Pass START and END to fontification functions.
* | Add handling of contextual entities in tree-sitter font-lockYuan Fu2022-11-021-8/+2
| | | | | | | | | | | | | | | | | | | | | | * lisp/progmodes/python.el: Remove function. (python--treesit-settings): Capture contextual node. * lisp/treesit.el (treesit--set-nonsticky): (treesit-font-lock-contextual-post-process): New functions. (treesit-font-lock-fontify-region): Change local variable START and END to NODE-START and NODE-END, handle special capture name "contextual". * doc/lispref/modes.texi (Parser-based Font Lock): Update manual.
* | Change signature of tree-sitter font-lock functionsYuan Fu2022-11-021-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change from (START END NODE OVERRIDE &rest _) to (NODE OVERRIDE &rest _) START and END aren't used frequently enough to justify. If a fontification function needs them, it can get them from NODE. * doc/lispref/modes.texi (Parser-based Font Lock): Update manual. * lisp/progmodes/js.el (js--fontify-template-string) * lisp/progmodes/python.el (python--treesit-fontify-string) (python--treesit-fontify-string-end): Change signature. * lisp/treesit.el (treesit-font-lock-rules): Update docstring. (treesit-font-lock-fontify-region): Remove START and END arguments.
* | Fix string fontification for tree-sitter python-modeYuan Fu2022-11-011-6/+10
| | | | | | | | | | | | | | | | | | | | | | Now when user inserts a ending quote, the whole string is ganranteed to be refontified and redisplayed. * lisp/progmodes/python.el (python--treesit-fontify-string): Change docstring, now it's called on the leading quote. (python--treesit-fontify-string-end): New function. (python--treesit-settings): Capture both leading and ending quote in a string.
* | Use treesit-fontify-with-override in tree-sitter functionsYuan Fu2022-10-311-3/+4
| | | | | | | | | | | | * lisp/progmodes/js.el (js--fontify-template-string) * lisp/progmodes/python.el (python--treesit-fontify-string): Use treesit-fontify-with-override.
* | Add an argument OVERRIDE to tree-sitter font-lock functionsYuan Fu2022-10-311-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | * doc/lispref/modes.texi (Parser-based Font Lock): Reflect this change in manual. * lisp/progmodes/js.el (js--fontify-template-string): Add _OVERRIDE argument. * lisp/progmodes/python.el (python--treesit-fontify-string): Add _OVERRIDE argument. * lisp/treesit.el (treesit-font-lock-rules): Update docstring. (treesit-fontify-with-override): New function. (treesit-font-lock-fontify-region): Extract out into treesit-fontify-with-override.
* | Improve python tree-sitter's string fontificationYuan Fu2022-10-311-9/+23
| | | | | | | | | | | | | | | | * lisp/progmodes/python.el (python--treesit-fontify-string): Handle not only f-strings, but also docstrings, and NODE is now the last quote rather than the whole string. (python--treesit-settings): Use python--treesit-fontify-string for every occasion.
* | Separate python tree-sitter fontification into featuresYuan Fu2022-10-291-31/+51
| | | | | | | | | | | | | | | | | | Level 1: comment string function-name class-name Level 2: keyword builtin constant type Level 3: assignment decorator escape-sequence string-interpolation * lisp/progmodes/python.el (python--treesit-settings): Separate. (python-mode): Set features.
* | Add tree-sitter navigation support to python-modeYuan Fu2022-10-261-0/+4
| | | | | | | | | | * lisp/progmodes/python.el (python-mode): Set treesit-defun-type-regexp.
* | New tree-sitter toggle schemeYuan Fu2022-10-251-21/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This version: central variable, everything controlled by treesit-settings. Major mode sets up tree-sitter/non-tree-sitter in a conditional branch, based on the setting. * lisp/treesit.el (treesit-settings): New option. (treesit-defun-type-regexp): Change docstring. (treesit-mode-supported) (treesit-required-languages) (treesit--local-variable-backup): Remove variables. (treesit--backup-local-variable) (treesit-mode) (global-treesit-mode--turn-on) (global-treesit-mode): Remove functions. (treesit--setting-for-mode): New function. (treesit-ready-p): New argument MODE, changed REPORT to QUIET, and LANGUAGEs to LANGUAGE (now it can be a single symbol or a list of them). (treesit-major-mode-setup): New function. Mostly comes from treesit-mode. * test/src/treesit-tests.el (treesit-misc): New test. * lisp/progmodes/python.el (python-mode): Move some setup code into the conditional branch at the end. * lisp/progmodes/js.el (js-json-mode) (js-mode): Move some setup code into the conditional branch at the end. * lisp/progmodes/ts-mode.el: Move tree-sitter setup into the conditional branch.
* | Revise the toggle scheme of tree-sitter (again)Yuan Fu2022-10-191-40/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now instead of a toggle function (major-mode-backend-function), we let major mode set local variables like treesit-font-lock-settings, treesit-imenu-function, then treesit-mode takes care of activating those things (clearing font-lock-keywords, setting imenu-create-index-function to treesit-imenu-function, etc). js.el and python.el: I've returned js-mode and python-mode to exactly what they were before tree-sitter change, plus lines at the end setting up tree-sitter variables. Sorry about all these fuss :-D * lisp/treesit.el (treesit-mode-inhibit-message): Remove option. (major-mode-backend-function) (treesit-remapped-major-mode-alist): Remove variables. (treesit-mode): Move down to the end of buffer. Do more things. (global-treesit-mode): Move down to the end of buffer. Don't handle major-mode-remap-alist anymore. (global-treesit-mode--turn-on): Move down to the end of buffer. (treesit-ready-p): Move down to the end of buffer. Changed signature. (treesit-font-lock-enable): Remove function. (treesit-defun-type-regexp): New variable. (treesit-beginning-of-defun) (treesit-end-of-defun): New function. (treesit-imenu-function): New variable. (treesit-mode-supported) (treesit-required-languages) (treesit--local-variable-backup): New variables. (treesit--backup-local-variable): New function * lisp/progmodes/js.el (js-use-tree-sitter): Remove option. (js--treesit-defun-type-regexp): Remove variable. (Now set inline in js-mode.) (js--treesit-beginning-of-defun) (js--treesit-end-of-defun): Remove functions. (Now use treesit-beginning/end-of-defun.) (js--backend-toggle) (js--json-backend-toggle): Remove function. (js-mode) (js-json-mode): Restore back to before tree-sitter changes. Add tree-sitter setup at the end. * lisp/progmodes/python.el (python--backend-toggle): Remove function. (python-mode): Restore back to before tree-sitter changes. Add tree-sitter setup at the end. * lisp/progmodes/ts-mode.el (ts-mode--font-lock-settings): Use js--fontify-template-string. (ts-mode--fontify-template-string): Remove function (because we can just use js--fontify-template-string). (ts-mode--defun-type-regexp): Remove variable (now set inline in ts-mode). (ts-mode--beginning-of-defun) (ts-mode--end-of-defun): Remove functions (now using treesit-beginning/end-of-defun). (ts-mode): Setup tree-sitter variables and then turn on treesit-mode or move to js-mode.