[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/lua-mode afc1ea0 235/468: Send init-code in lua-start-proc
From: |
Philip Kaludercic |
Subject: |
[nongnu] elpa/lua-mode afc1ea0 235/468: Send init-code in lua-start-process, enable compilation-shell-minor-mode |
Date: |
Thu, 5 Aug 2021 04:58:43 -0400 (EDT) |
branch: elpa/lua-mode
commit afc1ea04740fc7bc51c84d50736128b945888db4
Author: immerrr <immerrr+lua@gmail.com>
Commit: immerrr <immerrr+lua@gmail.com>
Send init-code in lua-start-process, enable compilation-shell-minor-mode
---
lua-mode.el | 40 ++++++++++++++++++++++------------------
1 file changed, 22 insertions(+), 18 deletions(-)
diff --git a/lua-mode.el b/lua-mode.el
index a67d56b..336e93a 100644
--- a/lua-mode.el
+++ b/lua-mode.el
@@ -1524,6 +1524,21 @@ This function just searches for a `end' at the beginning
of a line."
(forward-line)))
ret))
+(defvar lua-process-init-code
+ (concat "function luamode_dofile(fname, displayname)"
+ " local f = assert(io.open(fname))"
+ " local d = f:read('*all')"
+ " f:close()"
+ " x, e = loadstring(d, '@'..displayname)"
+ " if fname ~= displayname then"
+ " os.remove(fname)"
+ " end"
+ " if e then"
+ " error(e)"
+ " end"
+ " return x()"
+ "end"))
+
(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'.
@@ -1535,37 +1550,26 @@ When called interactively, switch to the process
buffer."
(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))
- ;; wait for prompt
(with-current-buffer lua-process-buffer
+ ;; wait for prompt
(while (not (lua-prompt-line))
(accept-process-output (get-buffer-process (current-buffer)))
- (goto-char (point-max))))
+ (goto-char (point-max)))
+ ;; send initialization code
+ (comint-simple-send nil lua-process-init-code)
+ ;; enable error highlighting in stack traces
+ (compilation-shell-minor-mode))
+
;; when called interactively, switch to process buffer
(if (lua--called-interactively-p 'any)
(switch-to-buffer lua-process-buffer)))
-(defvar lua-process-init-code
- (concat "function luamode_dofile(fname, displayname)"
- " local f = assert(io.open(fname))"
- " local d = f:read('*all')"
- " f:close()"
- " x, e = loadstring(d, '@'..displayname)"
- " if fname ~= displayname then"
- " os.remove(fname)"
- " end"
- " if e then"
- " error(e)"
- " end"
- " return x()"
- "end"))
-
(defun lua-get-create-process ()
(or (and (comint-check-proc lua-process-buffer)
lua-process)
(prog1 (lua-start-process)
(when (fboundp 'process-kill-without-query)
(process-kill-without-query lua-process))))
- (comint-simple-send lua-process lua-process-init-code)
lua-process)
(defun lua-kill-process ()
- [nongnu] elpa/lua-mode a3016a2 176/468: Avoid polluting "global namespace" when striving for backward compatibility, (continued)
- [nongnu] elpa/lua-mode a3016a2 176/468: Avoid polluting "global namespace" when striving for backward compatibility, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode b124dd0 194/468: Add field containing commit SHA expanded during archive creation., Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 64c1e94 197/468: lua--builtins: add "self" as keyword, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode d6c8419 202/468: Fix incorrect error highlighting in 'for x = ...' statements, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 2d94dee 204/468: Don't unindent comment close-bracket if it doesn't match open-bracket, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode c1fcfb6 211/468: Add NEWS file, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode d0fa50d 217/468: lua-make-delimited-matcher: wrap into eval-and-compile, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode b684790 219/468: Revert "Rename lua--function-name-rx, use it in font-lock keywords init", Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 8e19d23 231/468: Add basic indentation tests, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 6729533 234/468: Rewrite lua-send-buffer function (should fix issue #60), Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode afc1ea0 235/468: Send init-code in lua-start-process, enable compilation-shell-minor-mode,
Philip Kaludercic <=
- [nongnu] elpa/lua-mode 1ede907 242/468: Fix several cases for `indent-new-comment-line' (M-j), Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 6c55abb 245/468: Add lua-rx/-to-string wrappers to simplify writing Lua-specific regexps, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 1452f8e 244/468: should-lua-indent: accept strings rather than lists to simplify writing tests, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode a0f3a6f 250/468: Simplify font-lock & imenu regexps with lua-rx, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode e430d01 252/468: Remove deprecated test code from test/, put current code there instead, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 1d21a10 259/468: Reorganize test structure, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode dc55356 261/468: lua-forward-regexp: make sure direction is `forward', Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 0a986f7 266/468: Add hideshow support for "repeat... until" blocks, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 8d27d2c 268/468: fixed up tests && improved lua-kill-process, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 82daeb5 297/468: Merge pull request #88 from tarsius/master, Philip Kaludercic, 2021/08/05