GNU bug report logs -
#79853
[PATCH] Fix non-interactive use of 'lua-start-process'
Previous Next
To reply to this bug, email your comments to 79853 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org:
bug#79853; Package
emacs.
(Mon, 17 Nov 2025 16:20:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
john muhl <jm <at> pub.pink>:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org.
(Mon, 17 Nov 2025 16:20:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Tags: patch
This fixes a couple of problems with non-interactive use of
lua-start-process.
Namely that passing NAME would cause 2 processes to be started
(one with the passed name and another with the default) since
lua-send-string ends up calling lua-start-process without any
arguments.
Passing switches as a list of strings as described in the
docstring would cause the call to fail since rest wrapped the
switches in a list so you end up with '(("-i" "-W")) which comint
doesn’t understand.
switch-to-buffer is replaced with pop-to-buffer so users can
customize display-buffer-alist to control the behavior of the
process window.
Information forwarded
to
bug-gnu-emacs <at> gnu.org:
bug#79853; Package
emacs.
(Mon, 17 Nov 2025 16:26:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 79853 <at> debbugs.gnu.org (full text, mbox):
[0001-Fix-non-interactive-use-of-lua-start-process.patch (text/x-patch, attachment)]
From fe040001acbf269f5a28bbe795dee8e36b4888e2 Mon Sep 17 00:00:00 2001
From: john muhl <jm <at> pub.pink>
Date: Mon, 17 Nov 2025 09:59:04 -0600
Subject: [PATCH] Fix non-interactive use of 'lua-start-process'
* lisp/progmodes/lua-mode.el (lua-process-init-code): Add newline.
(lua-start-process): Use 'process-send-string' to avoid starting
two processes. Flatten 'switches' argument since rest arguments
get added to a list. Replace 'switch-to-buffer' with
'pop-to-buffer' so that the process window behavior can be
customized with 'display-buffer-alist'. Expand docstring and
update it to match the code. (Bug#79853)
---
lisp/progmodes/lua-mode.el | 35 +++++++++++++++++++++++------------
1 file changed, 23 insertions(+), 12 deletions(-)
diff --git a/lisp/progmodes/lua-mode.el b/lisp/progmodes/lua-mode.el
index 8f59e32e586..faeadf212de 100644
--- a/lisp/progmodes/lua-mode.el
+++ b/lisp/progmodes/lua-mode.el
@@ -1801,7 +1801,8 @@ lua-process-init-code
" error(e)"
" end"
" return x()"
- "end")
+ "end"
+ "\n")
" "))
(defun lua-make-lua-string (str)
@@ -1843,27 +1844,34 @@ 'run-lua
;;;###autoload
(defun lua-start-process (&optional name program startfile &rest switches)
"Start a Lua process named NAME, running PROGRAM.
-PROGRAM defaults to NAME, which defaults to `lua-default-application'.
When called interactively, switch to the process buffer.
-STARTFILE is the name of a file, whose contents are sent to the process
-as its initial input.
+NAME is the name of the created process; default is
+`lua-process-buffer-name' or `lua-default-application'.
-SWITCHES is a list of strings passed as arguments to PROGRAM."
+PROGRAM is the executable to run; default is `lua-default-application'.
+
+STARTFILE is a file, whose contents are sent to the process as initial
+input; default is `lua-process-startfile'.
+
+SWITCHES is a list of strings passed as arguments to PROGRAM; default is
+`lua-default-command-switches'."
(interactive)
(if (not lua-default-application)
(user-error "You must set `lua-default-application' to use this command")
- (let* ((name (or name lua-process-buffer-name
- (if (consp lua-default-application)
- (car lua-default-application)
- lua-default-application)))
+ (let* ((name (or name
+ lua-process-buffer-name
+ (if (consp lua-default-application)
+ (car lua-default-application)
+ lua-default-application)))
(program (or program lua-default-application)))
;; Don't re-initialize if there already is a Lua process.
(unless (comint-check-proc (format "*%s*" name))
(setq lua-process-buffer
(apply #'make-comint name program
(or startfile lua-process-startfile)
- (or switches lua-default-command-switches)))
+ (or (flatten-tree switches)
+ lua-default-command-switches)))
(setq lua-process (get-buffer-process lua-process-buffer))
(set-process-query-on-exit-flag lua-process nil)
(with-current-buffer lua-process-buffer
@@ -1877,10 +1885,13 @@ lua-start-process
(while (not (lua-prompt-line))
(accept-process-output (get-buffer-process (current-buffer)))
(goto-char (point-max)))
- (lua-send-string lua-process-init-code)))
+ (process-send-string lua-process lua-process-init-code)))
;; When called interactively, switch to process buffer
(when (called-interactively-p 'any)
- (switch-to-buffer lua-process-buffer)))))
+ (pop-to-buffer lua-process-buffer
+ '((display-buffer-pop-up-window
+ display-buffer-reuse-window)
+ (reusable-frames . t)))))))
(defun lua-get-create-process ()
"Return active Lua process creating one if necessary."
--
2.51.2
This bug report was last modified 2 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.