[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/lua-mode 086736c 168/468: #36 Don't continue lines on some
From: |
Philip Kaludercic |
Subject: |
[nongnu] elpa/lua-mode 086736c 168/468: #36 Don't continue lines on some keywords |
Date: |
Thu, 5 Aug 2021 04:58:29 -0400 (EDT) |
branch: elpa/lua-mode
commit 086736c56c569d546c5ada8c1e21908b58446dff
Author: Vedat Hallac <vedathallac@gmail.com>
Commit: Vedat Hallac <vedathallac@gmail.com>
#36 Don't continue lines on some keywords
Certain keywords in lua ca never be part of a multi-line expression.
Check for these keywords in lua-is continuing-statement-p.
---
lua-mode.el | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/lua-mode.el b/lua-mode.el
index 4f79e82..ee3975d 100644
--- a/lua-mode.el
+++ b/lua-mode.el
@@ -859,6 +859,21 @@ previous one even though it looked like an
end-of-statement.")
;; the control inside this function
(re-search-forward lua-cont-bol-regexp line-end t))))
+(defconst lua-block-starter-regexp
+ (eval-when-compile
+ (concat
+ "\\(\\_<"
+ (regexp-opt '("do" "while" "repeat" "until" "if" "then"
+ "else" "elseif" "end" "for" "local") t)
+ "\\_>\\)")))
+
+(defun lua-first-token-starts-block-p ()
+ "Returns true if the first token on this line is a block starter token."
+ (let ((line-end (line-end-position)))
+ (save-excursion
+ (beginning-of-line)
+ (re-search-forward (concat "\\s *" lua-block-starter-regexp) line-end
t))))
+
(defun lua-is-continuing-statement-p (&optional parse-start)
"Return non-nil if the line continues a statement.
More specifically, return the point in the line that is continued.
@@ -873,6 +888,7 @@ The criteria for a continuing statement are:
(if parse-start (goto-char parse-start))
(save-excursion (setq prev-line (lua-forward-line-skip-blanks 'back)))
(and prev-line
+ (not (lua-first-token-starts-block-p))
(or (lua-first-token-continues-p)
(and (goto-char prev-line)
;; check last token of previous nonblank line
- [nongnu] elpa/lua-mode 8be4f4e 108/468: .gitignore: ignore byte-compiled files, (continued)
- [nongnu] elpa/lua-mode 8be4f4e 108/468: .gitignore: ignore byte-compiled files, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode c69e150 112/468: Makefile: add compile target, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 993e042 113/468: Merge branch 'multiline_literals', Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode d742cae 116/468: lua-mark-all-multiline-literals: comment out debug message, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 5542927 122/468: lua-automark-multiline: add function to enable automatical multiline construct marking when emacs is idle, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 6beb586 123/468: Add customizable lua-automark-multiline-interval variable, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode eab8fc0 136/468: Move docstrings to the end of constants., Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode a5cc71f 149/468: Bump version & URL, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode caa3d0c 162/468: lua-jump-to-traceback: fix compilation warning about goto-line func, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode fb53190 164/468: First part of the fix for #34, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 086736c 168/468: #36 Don't continue lines on some keywords,
Philip Kaludercic <=
- [nongnu] elpa/lua-mode b9541ce 173/468: lua-send-proc is now an alias to lua-send-defun, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 8d28342 187/468: Revisit block-close unindentation logic (issue #26), Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode b1ac542 191/468: Major refactoring of font-lock-keywords:, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 57c696c 192/468: Add var name highlighting in "for x, y in ..." construct, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 97ce427 198/468: Restore compatibility with Emacs23 broken by commit 8d28342, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode ff3f5e1 199/468: lua-font-lock-keywords: don't eval-when-compile initial value, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 2a0314b 200/468: Improve multiline highlighting via font-lock-syntactic-keywords, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode cd5c071 201/468: Clean up lua-mode start-up function a bit, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode b195cdc 205/468: Bump TODO, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode cee511c 206/468: for/local varname highlighting: match '=' at EOL properly, Philip Kaludercic, 2021/08/05