mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-11-27 07:37:33 +00:00
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:
parent
a0613372a7
commit
27aacbd172
@ -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,47 +643,49 @@ 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)
|
||||||
(unless (comint-check-proc lua-ts-inferior-buffer)
|
(if (not lua-ts-inferior-program)
|
||||||
(apply #'make-comint-in-buffer
|
(user-error "You must set `lua-ts-inferior-program' to use this command")
|
||||||
(string-replace "*" "" lua-ts-inferior-buffer)
|
(unless (comint-check-proc lua-ts-inferior-buffer)
|
||||||
lua-ts-inferior-buffer
|
(apply #'make-comint-in-buffer
|
||||||
lua-ts-inferior-program
|
(string-replace "*" "" lua-ts-inferior-buffer)
|
||||||
lua-ts-inferior-startfile
|
lua-ts-inferior-buffer
|
||||||
lua-ts-inferior-options)
|
lua-ts-inferior-program
|
||||||
(when lua-ts-inferior-history
|
lua-ts-inferior-startfile
|
||||||
|
lua-ts-inferior-options)
|
||||||
|
(when lua-ts-inferior-history
|
||||||
(set-process-sentinel (get-buffer-process lua-ts-inferior-buffer)
|
(set-process-sentinel (get-buffer-process lua-ts-inferior-buffer)
|
||||||
'lua-ts-inferior--write-history))
|
'lua-ts-inferior--write-history))
|
||||||
(with-current-buffer lua-ts-inferior-buffer
|
(with-current-buffer lua-ts-inferior-buffer
|
||||||
(setq-local comint-input-ignoredups t
|
(setq-local comint-input-ignoredups t
|
||||||
comint-input-ring-file-name lua-ts-inferior-history
|
comint-input-ring-file-name lua-ts-inferior-history
|
||||||
comint-prompt-read-only t
|
comint-prompt-read-only t
|
||||||
comint-prompt-regexp (rx-to-string `(: bol
|
comint-prompt-regexp (rx-to-string `(: bol
|
||||||
,lua-ts-inferior-prompt
|
,lua-ts-inferior-prompt
|
||||||
(1+ space))))
|
(1+ space))))
|
||||||
(comint-read-input-ring t)
|
(comint-read-input-ring t)
|
||||||
(add-hook 'comint-preoutput-filter-functions
|
(add-hook 'comint-preoutput-filter-functions
|
||||||
(lambda (string)
|
(lambda (string)
|
||||||
(if (equal string (concat lua-ts-inferior-prompt-continue " "))
|
(if (equal string (concat lua-ts-inferior-prompt-continue " "))
|
||||||
string
|
string
|
||||||
(concat
|
(concat
|
||||||
;; 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))
|
||||||
(group (* nonl))))
|
(group (* nonl))))
|
||||||
"\\1" string)
|
"\\1" string)
|
||||||
;; Re-add the prompt for the next line.
|
;; Re-add the prompt for the next line.
|
||||||
lua-ts-inferior-prompt " ")))
|
lua-ts-inferior-prompt " ")))
|
||||||
nil t)))
|
nil t)))
|
||||||
(select-window (display-buffer lua-ts-inferior-buffer
|
(select-window (display-buffer lua-ts-inferior-buffer
|
||||||
'((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."
|
||||||
|
Loading…
Reference in New Issue
Block a user