summaryrefslogtreecommitdiff
path: root/.emacs.d/lisp/lua-mode.el
diff options
context:
space:
mode:
Diffstat (limited to '.emacs.d/lisp/lua-mode.el')
-rw-r--r--.emacs.d/lisp/lua-mode.el17
1 files changed, 7 insertions, 10 deletions
diff --git a/.emacs.d/lisp/lua-mode.el b/.emacs.d/lisp/lua-mode.el
index 4c543f5..6ab4d43 100644
--- a/.emacs.d/lisp/lua-mode.el
+++ b/.emacs.d/lisp/lua-mode.el
@@ -396,10 +396,7 @@ If the latter is nil, the keymap translates into `lua-mode-map' verbatim.")
396 "Buffer-local flag saying if this is a Lua REPL buffer.") 396 "Buffer-local flag saying if this is a Lua REPL buffer.")
397(make-variable-buffer-local 'lua--repl-buffer-p) 397(make-variable-buffer-local 'lua--repl-buffer-p)
398 398
399 399(defun lua--compilation-find-file (fn marker filename directory &rest formats)
400(defadvice compilation-find-file (around lua--repl-find-file
401 (marker filename directory &rest formats)
402 activate)
403 "Return Lua REPL buffer when looking for \"stdin\" file in it." 400 "Return Lua REPL buffer when looking for \"stdin\" file in it."
404 (if (and 401 (if (and
405 lua--repl-buffer-p 402 lua--repl-buffer-p
@@ -409,13 +406,12 @@ If the latter is nil, the keymap translates into `lua-mode-map' verbatim.")
409 (not (file-exists-p (expand-file-name 406 (not (file-exists-p (expand-file-name
410 filename 407 filename
411 (when directory (expand-file-name directory)))))) 408 (when directory (expand-file-name directory))))))
412 (setq ad-return-value (current-buffer)) 409 (current-buffer)
413 ad-do-it)) 410 (apply fn marker filename directory formats)))
414 411
412(advice-add 'compilation-find-file :around #'lua--compilation-find-file)
415 413
416(defadvice compilation-goto-locus (around lua--repl-goto-locus 414(defun lua--compilation-goto-locus (fn msg mk end-mk)
417 (msg mk end-mk)
418 activate)
419 "When message points to Lua REPL buffer, go to the message itself. 415 "When message points to Lua REPL buffer, go to the message itself.
420Usually, stdin:XX line number points to nowhere." 416Usually, stdin:XX line number points to nowhere."
421 (let ((errmsg-buf (marker-buffer msg)) 417 (let ((errmsg-buf (marker-buffer msg))
@@ -425,8 +421,9 @@ Usually, stdin:XX line number points to nowhere."
425 (progn 421 (progn
426 (compilation-set-window (display-buffer (marker-buffer msg)) msg) 422 (compilation-set-window (display-buffer (marker-buffer msg)) msg)
427 (goto-char msg)) 423 (goto-char msg))
428 ad-do-it))) 424 (funcall fn msg mk end-mk))))
429 425
426(advice-add 'compilation-goto-locus :around #'lua--compilation-goto-locus)
430 427
431(defcustom lua-indent-string-contents nil 428(defcustom lua-indent-string-contents nil
432 "If non-nil, contents of multiline string will be indented. 429 "If non-nil, contents of multiline string will be indented.