Eli Zaretskii writes: > You can try. I would like to start a full feature freeze in a day or > two, so I'm not sure you will have enough time. And it isn't like we > didn't try various approaches during the past two months, so frankly I > don't think that a better way even exists. But if you come up with > some very bright idea, who knows? I have attached a sketch of my proposal with support for Python. Instead of a separate python-ts-mode, we regulate tree-sitter support using a user option `treesit-enabled-modes'. It can either be a list --8<---------------cut here---------------start------------->8--- (setq treesit-enabled-modes '(python-mode c-mode)) --8<---------------cut here---------------end--------------->8--- or generally enable tree-sitter --8<---------------cut here---------------start------------->8--- (setq treesit-enabled-modes t) --8<---------------cut here---------------end--------------->8--- All a major modes has to do is pass a parser configuration --8<---------------cut here---------------start------------->8--- (define-derived-mode python-mode prog-mode "Python" "Major mode for editing Python files. \\{python-mode-map}" :syntax-table python-mode-syntax-table :parser-conf python-mode--treesit-conf ... --8<---------------cut here---------------end--------------->8--- that expands to --8<---------------cut here---------------start------------->8--- (when-let ((conf python-mode--treesit-conf) ((cond ((listp treesit-enabled-modes) (memq 'python-mode treesit-enabled-modes)) ((eq treesit-enabled-modes t)))) ((treesit-ready-p (nth 0 conf))) (parser (treesit-parser-create (nth 0 conf)))) (setq-local treesit-font-lock-feature-list (nth 1 conf) treesit-font-lock-settings (nth 2 conf) treesit-defun-name-function (nth 3 conf) treesit-defun-type-regexp (nth 4 conf) imenu-create-index-function (nth 5 conf)) (treesit-major-mode-setup)) --8<---------------cut here---------------end--------------->8--- at *the end* of the major mode definition. Note that if no parser configuration was parsed, the entire expression is byte-compiled away, so there is no run-time overhead for other modes. The parser configuration is currently a list but if might as well be a vector, a structure or anything else. This is just a rushed proposal to meet the deadline. How does it look like?