Subject: Re: bug#74951: [PATCH] Add 'lua-ts-mode' to 'interpreter-mode-alist'

From: john muhl <[email-masked]>
Date: Wed, 18 Dec 2024 13:20:24 -0600

>From 375f901d152b929d7f64bd2c18fa6a02bd4ba233 Mon Sep 17 00:00:00 2001
From: john muhl <[email-masked]>
Date: Wed, 18 Dec 2024 10:59:19 -0600
Subject: [PATCH] Add 'lua-ts-mode' to 'interpreter-mode-alist'

* lisp/progmodes/lua-ts-mode.el: Enable 'lua-ts-mode' for Lua
scripts based on their interpreter line.  (Bug#74951)
---
 lisp/progmodes/lua-ts-mode.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/progmodes/lua-ts-mode.el b/lisp/progmodes/lua-ts-mode.el
index 9d2969d6ac4..6fa3e51b34b 100644
--- a/lisp/progmodes/lua-ts-mode.el
+++ b/lisp/progmodes/lua-ts-mode.el
@@ -839,7 +839,8 @@ lua-ts-mode
 (derived-mode-add-parents 'lua-ts-mode '(lua-mode))
 
 (when (treesit-ready-p 'lua)
-  (add-to-list 'auto-mode-alist '("\\.lua\\'" . lua-ts-mode)))
+  (add-to-list 'auto-mode-alist '("\\.lua\\'" . lua-ts-mode))
+  (add-to-list 'interpreter-mode-alist '("\\<lua\\(?:jit\\)?" . lua-ts-mode)))
 
 (provide 'lua-ts-mode)
 
-- 
2.47.1

john muhl <[email-masked]> writes:

> Tags: patch
>
> Make is so that extensionless Lua scripts get recognized based on
> the interpreter line.