From 637c551de58aaac8763bce03aae5208c5d095d78 Mon Sep 17 00:00:00 2001 From: mattias Date: Tue, 30 Aug 2022 13:29:24 +0200 Subject: [PATCH 1/2] Look for major modes and extensions for grammar loading See https://github.com/emacs-tree-sitter/tree-sitter-langs/pull/116 --- lisp/tree-sitter.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lisp/tree-sitter.el b/lisp/tree-sitter.el index 6686ae13..0079e8b6 100644 --- a/lisp/tree-sitter.el +++ b/lisp/tree-sitter.el @@ -150,7 +150,9 @@ OLD-LEN is the char length of the old text." "Enable `tree-sitter' in the current buffer." (unless tree-sitter-language ;; Determine the language symbol based on `major-mode' . - (let ((lang-symbol (alist-get major-mode tree-sitter-major-mode-language-alist))) + (let* + ((file-extension (if (eq major-mode 'tuareg-mode) (file-name-extension buffer-file-name) nil)) + (lang-symbol (alist-get (list major-mode file-extension) tree-sitter-major-mode-language-alist nil nil 'equal))) (unless lang-symbol (error "No language registered for major mode `%s'" major-mode)) (setq tree-sitter-language (tree-sitter-require lang-symbol)))) From 9dfbfcf49585e26546afa3bba8e286524b2a5c60 Mon Sep 17 00:00:00 2001 From: mattiasdrp <5543639+mattiasdrp@users.noreply.github.com> Date: Tue, 30 Aug 2022 14:07:15 +0200 Subject: [PATCH 2/2] make langs track the correct commit --- langs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/langs b/langs index 599570cd..d03628df 160000 --- a/langs +++ b/langs @@ -1 +1 @@ -Subproject commit 599570cd2a6d1b43a109634896b5c52121e155e3 +Subproject commit d03628df5dc61e22accd8e7be0a587694f8b3d6e