Skip to content

Commit

Permalink
Merge pull request #174 from immerrr/assorted-fixes
Browse files Browse the repository at this point in the history
Assorted fixes
  • Loading branch information
immerrr authored Sep 21, 2020
2 parents 5bfdea5 + 9d46ad3 commit 345ebfc
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 17 deletions.
33 changes: 30 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,44 @@ If you have a problem or a suggestion about **lua-mode**, please, let me know ab

## INSTALLATION

### MELPA INSTALLATION

**lua-mode**'s officially supported installation method is from [MELPA](https://melpa.org/#/) archive.

To get started, enable installing packages from MELPA:

```lisp
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(package-initialize)
```

To fetch the list of packages you can do

```
<M-x> package-refresh-contents
```

And after that **lua-mode** can be installed with

```
<M-x> package-install "lua-mode"
```

Please, refer to [MELPA documentation](https://melpa.org/#/getting-started) and [Emacs documentation on
packages](https://www.gnu.org/software/emacs/manual/html_node/emacs/Packages.html) for further information.

### EL-GET INSTALLATION

[El-get](https://github.com/dimitri/el-get) is a package manager which greatly simplifies adding
modules to your Emacs and keeping them up-to-date. Once you have **el-get** set up, installing
**lua-mode** can be done with
modules to your Emacs and keeping them up-to-date. Once you have **el-get** set up,
**lua-mode** can also be installed with

<M-x> el-get-install "lua-mode"

and updating is no more than

<M-x> el-get-update "lua-mode"`
<M-x> el-get-update "lua-mode"

Please, consult with [el-get documentation](https://github.com/dimitri/el-get/blob/master/README.md) for further information.

Expand Down
32 changes: 18 additions & 14 deletions lua-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,11 @@ element is itself expanded with `lua-rx-to-string'. "
:group 'lua)

(defcustom lua-default-application "lua"
"Default application to run in Lua process."
"Default application to run in Lua process.
Can be a string, where it denotes a command to be executed to
start Lua process, or a (HOST . PORT) cons, that can be used to
connect to Lua process running remotely."
:type '(choice (string)
(cons string integer))
:group 'lua)
Expand Down Expand Up @@ -1836,11 +1840,11 @@ This function just searches for a `end' at the beginning of a line."
(goto-char (point-min))
(while (re-search-forward "[\"'\\\t\\\n]" nil t)
(cond
((string= (match-string 0) "\n")
(replace-match "\\\\n"))
((string= (match-string 0) "\t")
(replace-match "\\\\t"))
(t
((string= (match-string 0) "\n")
(replace-match "\\\\n"))
((string= (match-string 0) "\t")
(replace-match "\\\\t"))
(t
(replace-match "\\\\\\&" t))))
(concat "'" (buffer-string) "'"))))

Expand All @@ -1863,13 +1867,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)
Expand All @@ -1878,7 +1875,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)
Expand Down

0 comments on commit 345ebfc

Please sign in to comment.