[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/lua-mode 3d6f6ed 012/468: enforce interactive mode by defa
From: |
Philip Kaludercic |
Subject: |
[nongnu] elpa/lua-mode 3d6f6ed 012/468: enforce interactive mode by default: (defcustom lua-default-command-switches (list "-i")... |
Date: |
Thu, 5 Aug 2021 04:57:59 -0400 (EDT) |
branch: elpa/lua-mode
commit 3d6f6ed0bf58ac4040085a749d0964491356288d
Author: juergen <juergen>
Commit: juergen <juergen>
enforce interactive mode by default: (defcustom
lua-default-command-switches (list "-i")...
xemacs-compatibility: use make-temp-name if make-temp-file isn't available
xemacs-compatibility: don't use comint-next-prompt because of different
behavior on xemacs (lua-send-region)
---
lua-mode.el | 55 +++++++++++++++++++++++++++++++++++++------------------
1 file changed, 37 insertions(+), 18 deletions(-)
diff --git a/lua-mode.el b/lua-mode.el
index b7f5857..bc12b33 100755
--- a/lua-mode.el
+++ b/lua-mode.el
@@ -94,7 +94,7 @@
:type 'string
:group 'lua)
-(defcustom lua-default-command-switches nil
+(defcustom lua-default-command-switches (list "-i")
"Command switches for `lua-default-application'.
Should be a list of strings."
:type '(repeat string)
@@ -234,6 +234,20 @@ traceback location."
"Character set that constitutes whitespace for indentation in lua.")
;;}}}
+;;{{{ lua-make-temp-file
+
+(eval-and-compile
+ (defalias 'lua-make-temp-file
+ (if (fboundp 'make-temp-file)
+ 'make-temp-file
+ (lambda (prefix &optional dir-flag) ;; Simple implementation
+ (expand-file-name
+ (make-temp-name prefix)
+ (if (fboundp 'temp-directory)
+ (temp-directory)
+ temporary-file-directory))))))
+
+;;}}}
;;{{{ lua-mode
;;;###autoload
@@ -932,10 +946,10 @@ This function just searches for a `end' at the beginning
of a line."
(setq lua-process-buffer (apply 'make-comint name program startfile
switches))
(setq lua-process (get-buffer-process lua-process-buffer))
;; wait for prompt
- (save-excursion
- (set-buffer lua-process-buffer)
+ (with-current-buffer lua-process-buffer
(while (not (lua-prompt-line))
- (accept-process-output (get-buffer-process (current-buffer))))))
+ (accept-process-output (get-buffer-process (current-buffer)))
+ (goto-char (point-max)))))
;;}}}
;;{{{ lua-kill-process
@@ -982,8 +996,9 @@ If `lua-process' is nil or dead, start a new process first."
"Send region to lua subprocess."
(interactive "r")
;; make temporary lua file
- (let ((tempfile (make-temp-file "lua-"))
- (current-prompt nil)
+ (let ((tempfile (lua-make-temp-file "lua-"))
+ (last-prompt nil)
+ (prompt-found nil)
(lua-stdin-line-offset (count-lines (point-min) start))
(lua-stdin-buffer (current-buffer))
current-prompt )
@@ -995,31 +1010,35 @@ If `lua-process' is nil or dead, start a new process
first."
(if (fboundp 'process-kill-without-query)
(process-kill-without-query lua-process))
;; send dofile(tempfile)
- (save-excursion
- (set-buffer lua-process-buffer)
- (setq current-prompt (comint-next-prompt 1))
- (comint-simple-send (get-buffer-process (current-buffer)) (format
"dofile(\"%s\")" tempfile))
- ;; wait for prompt
- (while (or (= (comint-next-prompt 1) current-prompt)
- (not (lua-prompt-line)))
- (accept-process-output (get-buffer-process (current-buffer)))))
+ (with-current-buffer lua-process-buffer
+ (goto-char (point-max))
+ (setq last-prompt (count-lines (point-min) (point-max)))
+ (comint-simple-send (get-buffer-process (current-buffer))
+ (format "dofile(\"%s\")"
+ (replace-regexp-in-string
+ "\\\\" "\\\\\\\\" tempfile)))
+ ;; wait for prompt
+ (while (not prompt-found)
+ (accept-process-output (get-buffer-process (current-buffer)))
+ (goto-char (point-max))
+ (setq prompt-found (and (lua-prompt-line) (not (= (count-lines
(point-min) (point-max)) last-prompt)))))
;; remove temp. lua file
(delete-file tempfile)
- (lua-postprocess-output-buffer lua-process-buffer current-prompt
lua-stdin-line-offset)
+ (lua-postprocess-output-buffer lua-process-buffer last-prompt
lua-stdin-line-offset)
(if lua-always-show
- (display-buffer lua-process-buffer))))
+ (display-buffer lua-process-buffer)))))
;;}}}
;;{{{ lua-postprocess-output-buffer
-(defun lua-postprocess-output-buffer (buf start &optional
lua-stdin-line-offset)
+(defun lua-postprocess-output-buffer (buf start-line &optional
lua-stdin-line-offset)
"Highlight tracebacks found in buf. If an traceback occurred return
t, otherwise return nil. BUF must exist."
(let ((lua-stdin-line-offset (or lua-stdin-line-offset 0))
line file bol err-p)
(save-excursion
(set-buffer buf)
- (goto-char start)
+ (goto-line start-line)
(while (re-search-forward lua-traceback-line-re nil t)
(setq file (match-string 1)
line (string-to-int (match-string 2)))))
- [nongnu] elpa/lua-mode 05a9513 004/468: fixed copyright notice, (continued)
- [nongnu] elpa/lua-mode 05a9513 004/468: fixed copyright notice, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode f9cbb91 007/468: make lua-process-buffer and lua-process global, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode c13235f 008/468: fixed indention, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode d91bf2b 011/468: new buffer-local variable: lua-electric-flag, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 6a7929a 013/468: lua-postprocess-output-buffer: match first error, not last, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 78f7b78 014/468: emacs-compatibility: replace-in-string not available on GNU emacs, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode ea5c4a1 015/468: Documentation: Added installation notes, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 9d20d58 019/468: fold mode cleanup, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 78fc3ba 005/468: lua-postprocess-output-buffer: jump to lua errors in source files, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 8802c43 006/468: fixed lua-postprocess-output-buffer: start search from last prompt, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 3d6f6ed 012/468: enforce interactive mode by default: (defcustom lua-default-command-switches (list "-i")...,
Philip Kaludercic <=
- [nongnu] elpa/lua-mode 8ab6df6 026/468: Fix bug #619: Wrong identation with .. operator, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode d313ff5 024/468: New Release: 20061208, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 31acb6b 029/468: Fix bug #621: Wrong comment block detection, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 8f17c27 021/468: fix [#472] lua-mode colorization, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode b11a136 022/468: implemented lua-forward-sexp using lua-find-matching-token-word, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode c49fb68 023/468: Fixed lua-prompt-regex and handling of output without newline (bug #425), Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 99324a4 034/468: minor font-lock fix, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode c61bda2 040/468: Commit from Reuben:, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode cd5fa7d 010/468: lua-start-process: made program &optional argument (defaults to name), Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 13363db 017/468: Fixed typo (#470), Philip Kaludercic, 2021/08/05