branch: elpa/lua-mode
commit 4a22b3c0a43216db0e47f31f8d1c720facad2960
Author: Reuben Thomas <[email protected]>
Commit: immerrr <[email protected]>
Allow lua-start-process to be called interactively.
---
lua-mode.el | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/lua-mode.el b/lua-mode.el
index 91e8e5c..c3f65e5 100644
--- a/lua-mode.el
+++ b/lua-mode.el
@@ -929,10 +929,14 @@ This function just searches for a `end' at the beginning
of a line."
(forward-line)))
ret))
-(defun lua-start-process (name &optional program startfile &rest switches)
- "Start a lua process named NAME, running PROGRAM."
+(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."
+ (interactive)
(or switches
(setq switches lua-default-command-switches))
+ (setq name (or name lua-default-application))
(setq program (or program name))
(setq lua-process-buffer (apply 'make-comint name program startfile
switches))
(setq lua-process (get-buffer-process lua-process-buffer))
@@ -940,7 +944,10 @@ This function just searches for a `end' at the beginning
of a line."
(with-current-buffer lua-process-buffer
(while (not (lua-prompt-line))
(accept-process-output (get-buffer-process (current-buffer)))
- (goto-char (point-max)))))
+ (goto-char (point-max))))
+ ;; when called interactively, switch to process buffer
+ (if (called-interactively-p 'any)
+ (switch-to-buffer lua-process-buffer)))
(defun lua-kill-process ()
"Kill lua subprocess and its buffer."