branch: elpa/lua-mode
commit 5fe5f572b1d244f64df96cde8255f3c2102f818d
Author: immerrr <[email protected]>
Commit: immerrr <[email protected]>
Fix wait-for-prompt to take lua-prompt-regexp into account
---
lua-mode.el | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/lua-mode.el b/lua-mode.el
index 32f9750..74a6cf6 100644
--- a/lua-mode.el
+++ b/lua-mode.el
@@ -1863,13 +1863,6 @@ When called interactively, switch to the process buffer."
(setq lua-process (get-buffer-process lua-process-buffer))
(set-process-query-on-exit-flag lua-process nil)
(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)))
- ;; send initialization code
- (lua-send-string lua-process-init-code)
-
;; enable error highlighting in stack traces
(require 'compile)
(setq lua--repl-buffer-p t)
@@ -1878,7 +1871,14 @@ When called interactively, switch to the process buffer."
(cons (list lua-traceback-line-re 1 2)
compilation-error-regexp-alist))
(compilation-shell-minor-mode 1)
- (setq-local comint-prompt-regexp lua-prompt-regexp))
+ (setq-local comint-prompt-regexp lua-prompt-regexp)
+
+ ;; 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)))
+ (lua-send-string lua-process-init-code))
;; when called interactively, switch to process buffer
(if (called-interactively-p 'any)