Fix some 'lua-ts-mode' options (Bug#74235)

* lisp/progmodes/lua-ts-mode.el (lua-ts-luacheck-program):
(lua-ts-inferior-program): Switch to 'file' type and remove 'nil'
as a choice.
(lua-ts-inferior-lua): Ensure 'lua-ts-inferior-program' is set.
This commit is contained in:
john muhl 2024-11-09 11:01:45 -06:00 committed by Eli Zaretskii
parent a0613372a7
commit 27aacbd172

View file

@ -72,7 +72,7 @@
(defcustom lua-ts-luacheck-program "luacheck" (defcustom lua-ts-luacheck-program "luacheck"
"Location of the Luacheck program." "Location of the Luacheck program."
:type '(choice (const :tag "None" nil) string) :type 'file
:version "30.1") :version "30.1")
(defcustom lua-ts-inferior-buffer "*Lua*" (defcustom lua-ts-inferior-buffer "*Lua*"
@ -83,7 +83,7 @@
(defcustom lua-ts-inferior-program "lua" (defcustom lua-ts-inferior-program "lua"
"Program to run in the inferior Lua process." "Program to run in the inferior Lua process."
:type '(choice (const :tag "None" nil) string) :type 'file
:version "30.1") :version "30.1")
(defcustom lua-ts-inferior-options '("-i") (defcustom lua-ts-inferior-options '("-i")
@ -643,6 +643,8 @@ Calls REPORT-FN directly."
(defun lua-ts-inferior-lua () (defun lua-ts-inferior-lua ()
"Run a Lua interpreter in an inferior process." "Run a Lua interpreter in an inferior process."
(interactive) (interactive)
(if (not lua-ts-inferior-program)
(user-error "You must set `lua-ts-inferior-program' to use this command")
(unless (comint-check-proc lua-ts-inferior-buffer) (unless (comint-check-proc lua-ts-inferior-buffer)
(apply #'make-comint-in-buffer (apply #'make-comint-in-buffer
(string-replace "*" "" lua-ts-inferior-buffer) (string-replace "*" "" lua-ts-inferior-buffer)
@ -669,8 +671,8 @@ Calls REPORT-FN directly."
;; Filter out the extra prompt characters that ;; Filter out the extra prompt characters that
;; accumulate in the output when sending regions ;; accumulate in the output when sending regions
;; to the inferior process. ;; to the inferior process.
(replace-regexp-in-string (rx-to-string (replace-regexp-in-string
`(: bol (rx-to-string `(: bol
(* ,lua-ts-inferior-prompt (* ,lua-ts-inferior-prompt
(? ,lua-ts-inferior-prompt) (? ,lua-ts-inferior-prompt)
(1+ space)) (1+ space))
@ -683,7 +685,7 @@ Calls REPORT-FN directly."
'((display-buffer-reuse-window '((display-buffer-reuse-window
display-buffer-pop-up-window) display-buffer-pop-up-window)
(reusable-frames . t)))) (reusable-frames . t))))
(get-buffer-process (current-buffer))) (get-buffer-process (current-buffer))))
(defun lua-ts-send-buffer () (defun lua-ts-send-buffer ()
"Send current buffer to the inferior Lua process." "Send current buffer to the inferior Lua process."