Function: lua-start-process
lua-start-process is an autoloaded, interactive and byte-compiled
function defined in lua-mode.el.gz.
Signature
(lua-start-process &optional NAME PROGRAM STARTFILE &rest SWITCHES)
Documentation
Start a Lua process named NAME, running PROGRAM.
When called interactively, switch to the process buffer.
NAME is the name of the created process; default is
lua-process-buffer-name or lua-default-application.
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.
Key Bindings
Aliases
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/lua-mode.el.gz
;;;###autoload
(defun lua-start-process (&optional name program startfile &rest switches)
"Start a Lua process named NAME, running PROGRAM.
When called interactively, switch to the process buffer.
NAME is the name of the created process; default is
`lua-process-buffer-name' or `lua-default-application'.
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)))
(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 (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
(setq-local comint-prompt-regexp lua-prompt-regexp)
(setq-local comint-input-ring-file-name lua-process-history-file)
(comint-read-input-ring t)
(compilation-shell-minor-mode)
(add-hook 'kill-buffer-hook #'comint-write-input-ring nil t)
;; Don't send initialization code until seeing the prompt to
;; ensure that the interpreter is ready.
(while (not (lua-prompt-line))
(accept-process-output (get-buffer-process (current-buffer)))
(goto-char (point-max)))
(process-send-string lua-process lua-process-init-code)))
;; When called interactively, switch to process buffer
(when (called-interactively-p 'any)
(pop-to-buffer lua-process-buffer
'((display-buffer-pop-up-window
display-buffer-reuse-window)
(reusable-frames . t)))))))