From: john muhl <jm@pub.pink>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 74235@debbugs.gnu.org
Subject: bug#74235: [PATCH] ; Remove 'nil' from some 'lua-ts-mode' options
Date: Sun, 10 Nov 2024 08:48:39 -0600 [thread overview]
Message-ID: <87y11r87qw.fsf@pub.pink> (raw)
In-Reply-To: <86r07jlk3j.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 10 Nov 2024 07:43:28 +0200")
[-- Attachment #1: Type: text/plain, Size: 737 bytes --]
Eli Zaretskii <eliz@gnu.org> writes:
>> From: john muhl <jm@pub.pink>
>> Cc: 74235@debbugs.gnu.org
>> Date: Sat, 09 Nov 2024 14:54:47 -0600
>>
>> + (if (or (not lua-ts-inferior-program)
>> + (not (executable-find lua-ts-inferior-program)))
>> + (user-error "You must set `lua-ts-inferior-program' to use this command")
>
> The text of user-error should say something about being unable to find
> the program, not just about the variable being nil, since you use
> executable-find.
>
> Otherwise, LGTM, thanks.
I guess the executable-find check is redundant anyway since
comint/process will tell you “Searching for program: No such file
or directory, luaz” if you get it wrong.
Thanks again.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-some-lua-ts-mode-options-Bug-74235.patch --]
[-- Type: text/x-patch, Size: 5969 bytes --]
From b170e406f834806842761726de47ca3afeb05cfe Mon Sep 17 00:00:00 2001
From: john muhl <jm@pub.pink>
Date: Sat, 9 Nov 2024 11:01:45 -0600
Subject: [PATCH] ; 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.
---
lisp/progmodes/lua-ts-mode.el | 84 ++++++++++++++++++-----------------
1 file changed, 43 insertions(+), 41 deletions(-)
diff --git a/lisp/progmodes/lua-ts-mode.el b/lisp/progmodes/lua-ts-mode.el
index 4ea453c9b65..a7763377177 100644
--- a/lisp/progmodes/lua-ts-mode.el
+++ b/lisp/progmodes/lua-ts-mode.el
@@ -72,7 +72,7 @@ lua-ts-indent-offset
(defcustom lua-ts-luacheck-program "luacheck"
"Location of the Luacheck program."
- :type '(choice (const :tag "None" nil) string)
+ :type 'file
:version "30.1")
(defcustom lua-ts-inferior-buffer "*Lua*"
@@ -83,7 +83,7 @@ lua-ts-inferior-buffer
(defcustom lua-ts-inferior-program "lua"
"Program to run in the inferior Lua process."
- :type '(choice (const :tag "None" nil) string)
+ :type 'file
:version "30.1")
(defcustom lua-ts-inferior-options '("-i")
@@ -632,47 +632,49 @@ lua-ts-flymake-luacheck
(defun lua-ts-inferior-lua ()
"Run a Lua interpreter in an inferior process."
(interactive)
- (unless (comint-check-proc lua-ts-inferior-buffer)
- (apply #'make-comint-in-buffer
- (string-replace "*" "" lua-ts-inferior-buffer)
- lua-ts-inferior-buffer
- lua-ts-inferior-program
- lua-ts-inferior-startfile
- lua-ts-inferior-options)
- (when lua-ts-inferior-history
+ (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)
+ (apply #'make-comint-in-buffer
+ (string-replace "*" "" lua-ts-inferior-buffer)
+ lua-ts-inferior-buffer
+ lua-ts-inferior-program
+ lua-ts-inferior-startfile
+ lua-ts-inferior-options)
+ (when lua-ts-inferior-history
(set-process-sentinel (get-buffer-process lua-ts-inferior-buffer)
'lua-ts-inferior--write-history))
- (with-current-buffer lua-ts-inferior-buffer
- (setq-local comint-input-ignoredups t
- comint-input-ring-file-name lua-ts-inferior-history
- comint-prompt-read-only t
- comint-prompt-regexp (rx-to-string `(: bol
- ,lua-ts-inferior-prompt
- (1+ space))))
- (comint-read-input-ring t)
- (add-hook 'comint-preoutput-filter-functions
- (lambda (string)
- (if (equal string (concat lua-ts-inferior-prompt-continue " "))
- string
- (concat
- ;; Filter out the extra prompt characters that
- ;; accumulate in the output when sending regions
- ;; to the inferior process.
- (replace-regexp-in-string (rx-to-string
- `(: bol
- (* ,lua-ts-inferior-prompt
- (? ,lua-ts-inferior-prompt)
- (1+ space))
- (group (* nonl))))
- "\\1" string)
- ;; Re-add the prompt for the next line.
- lua-ts-inferior-prompt " ")))
- nil t)))
- (select-window (display-buffer lua-ts-inferior-buffer
- '((display-buffer-reuse-window
- display-buffer-pop-up-window)
- (reusable-frames . t))))
- (get-buffer-process (current-buffer)))
+ (with-current-buffer lua-ts-inferior-buffer
+ (setq-local comint-input-ignoredups t
+ comint-input-ring-file-name lua-ts-inferior-history
+ comint-prompt-read-only t
+ comint-prompt-regexp (rx-to-string `(: bol
+ ,lua-ts-inferior-prompt
+ (1+ space))))
+ (comint-read-input-ring t)
+ (add-hook 'comint-preoutput-filter-functions
+ (lambda (string)
+ (if (equal string (concat lua-ts-inferior-prompt-continue " "))
+ string
+ (concat
+ ;; Filter out the extra prompt characters that
+ ;; accumulate in the output when sending regions
+ ;; to the inferior process.
+ (replace-regexp-in-string
+ (rx-to-string `(: bol
+ (* ,lua-ts-inferior-prompt
+ (? ,lua-ts-inferior-prompt)
+ (1+ space))
+ (group (* nonl))))
+ "\\1" string)
+ ;; Re-add the prompt for the next line.
+ lua-ts-inferior-prompt " ")))
+ nil t)))
+ (select-window (display-buffer lua-ts-inferior-buffer
+ '((display-buffer-reuse-window
+ display-buffer-pop-up-window)
+ (reusable-frames . t))))
+ (get-buffer-process (current-buffer))))
(defun lua-ts-send-buffer ()
"Send current buffer to the inferior Lua process."
--
2.47.0
next prev parent reply other threads:[~2024-11-10 14:48 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-06 21:19 bug#74235: [PATCH] ; Remove 'nil' from some 'lua-ts-mode' options john muhl
2024-11-06 21:22 ` john muhl
2024-11-07 5:58 ` Eli Zaretskii
2024-11-07 15:04 ` john muhl
2024-11-08 14:57 ` john muhl
2024-11-08 15:24 ` Eli Zaretskii
2024-11-09 20:54 ` john muhl
2024-11-10 5:43 ` Eli Zaretskii
2024-11-10 14:48 ` john muhl [this message]
2024-11-14 8:26 ` Eli Zaretskii
2024-11-10 5:45 ` Philip Kaludercic
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87y11r87qw.fsf@pub.pink \
--to=jm@pub.pink \
--cc=74235@debbugs.gnu.org \
--cc=eliz@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).