[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/lua-mode 98f7fb0 145/468: lua-calculate-indentation: remov
From: |
Philip Kaludercic |
Subject: |
[nongnu] elpa/lua-mode 98f7fb0 145/468: lua-calculate-indentation: remove unneeded variables & "let" form |
Date: |
Thu, 5 Aug 2021 04:58:25 -0400 (EDT) |
branch: elpa/lua-mode
commit 98f7fb0a511ba1e23656572724909cd71fcc26bb
Author: immerrr <immerrr+lua@gmail.com>
Commit: immerrr <immerrr+lua@gmail.com>
lua-calculate-indentation: remove unneeded variables & "let" form
---
lua-mode.el | 48 +++++++++++++++++++++++-------------------------
1 file changed, 23 insertions(+), 25 deletions(-)
diff --git a/lua-mode.el b/lua-mode.el
index 82fc2fd..0ee077d 100644
--- a/lua-mode.el
+++ b/lua-mode.el
@@ -981,31 +981,29 @@ to the left by the amount specified in lua-indent-level."
(defun lua-calculate-indentation (&optional parse-start)
"Return appropriate indentation for current line as Lua code."
- (let ((pos (point))
- (indent-amt 0))
- (save-excursion
- (let ((continuing-p (lua-is-continuing-statement-p)))
- (or
- ;; when calculating indentation, do the following:
- ;; 1. check, if the line starts with indentation-modifier (open/close
brace)
- ;; and if it should be indented/unindented in special way
- (lua-calculate-indentation-override)
-
- ;; 2. otherwise, use indentation modifiers from previous line + it's
own indentation
- ;; 3. if previous line doesn't contain indentation modifiers,
additionally check
- ;; if current line is a continuation line and add lua-indent-level
if it is
- (when (lua-forward-line-skip-blanks 'back)
- ;; the order of function calls here is important. block modifier
- ;; call may change the point to another line
- (let ((modifier
- (lua-calculate-indentation-block-modifier nil
(line-end-position))))
- (+ (if (and continuing-p (= 0 modifier))
- lua-indent-level
- modifier)
- (current-indentation))))
-
- ;; 4. if there's no previous line, indentation is 0
- 0)))))
+ (save-excursion
+ (let ((continuing-p (lua-is-continuing-statement-p)))
+ (or
+ ;; when calculating indentation, do the following:
+ ;; 1. check, if the line starts with indentation-modifier (open/close
brace)
+ ;; and if it should be indented/unindented in special way
+ (lua-calculate-indentation-override)
+
+ ;; 2. otherwise, use indentation modifiers from previous line + it's
own indentation
+ ;; 3. if previous line doesn't contain indentation modifiers,
additionally check
+ ;; if current line is a continuation line and add lua-indent-level
if it is
+ (when (lua-forward-line-skip-blanks 'back)
+ ;; the order of function calls here is important. block modifier
+ ;; call may change the point to another line
+ (let ((modifier
+ (lua-calculate-indentation-block-modifier nil
(line-end-position))))
+ (+ (if (and continuing-p (= 0 modifier))
+ lua-indent-level
+ modifier)
+ (current-indentation))))
+
+ ;; 4. if there's no previous line, indentation is 0
+ 0))))
(defun lua-beginning-of-proc (&optional arg)
"Move backward to the beginning of a lua proc (or similar).
- [nongnu] elpa/lua-mode 1716660 223/468: Fix interaction with electric-pair-mode (issue #54), (continued)
- [nongnu] elpa/lua-mode 1716660 223/468: Fix interaction with electric-pair-mode (issue #54), Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 4217513 230/468: Remove highlighting of numbers for consistency with other major-modes, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 248bea3 233/468: Remove syntax hacks for '.' & '_' characters, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode c5e9620 238/468: Fix stacktrace parsing in inferior process buffer, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode f834c21 105/468: lua-mark-all-multiline-literals: fix missed rename, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode aec4eea 117/468: lua-mark/-unmark-all-multiline-literals: fix error occurring on empty buffer (fixes #4 ?), Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 535ca1b 128/468: lua-mark-char-multiline-delim, lua-unmark-multiline-literals: inhibit after-change-functions to avoid running automarking twice on the same text, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode bb9330f 132/468: Fix string contents indentation (issue #6), Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode d57fdaf 134/468: String content indentation: put back code that forbidden ANY indentation unless it's enabled, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 8435a96 137/468: Major modifications to indentation logic., Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 98f7fb0 145/468: lua-calculate-indentation: remove unneeded variables & "let" form,
Philip Kaludercic <=
- [nongnu] elpa/lua-mode 167e046 147/468: lua-calculate-indentation-override: fix typo (caddr was a reference to wrong field of token table), Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode a0490fc 150/468: lua-font-lock-keywords: highlight hash-bang line as comment (#17), Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 6563aeb 156/468: Merge pull request #30 from vhallac/fix-22, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 9d75878 159/468: lua-font-lock-keywords: highlight numbers as constants (issue #15), Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode c2f8a7f 175/468: Use define-derived-mode, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 9f5107e 181/468: Fix population of lua-mode-syntax-table (issue #42), Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode f92ced5 283/468: lua-send-region: send extra printline, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 68cd23d 292/468: Merge pull request #85 from immerrr/beginning-of-proc-regex, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 532701b 298/468: Add missing Lua 5.3 functions and modules, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 445bad6 301/468: Merge pull request #92 from ramnes/master, Philip Kaludercic, 2021/08/05