[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/lua-mode 4a45c6d 410/468: lua-make-indentation-info-pair:
From: |
Philip Kaludercic |
Subject: |
[nongnu] elpa/lua-mode 4a45c6d 410/468: lua-make-indentation-info-pair: optimize "same-line" checks |
Date: |
Thu, 5 Aug 2021 04:59:19 -0400 (EDT) |
branch: elpa/lua-mode
commit 4a45c6d40d927f6272b01c9f38b0fc411a7c2220
Author: immerrr <immerrr+lua@gmail.com>
Commit: immerrr <immerrr+lua@gmail.com>
lua-make-indentation-info-pair: optimize "same-line" checks
---
lua-mode.el | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/lua-mode.el b/lua-mode.el
index a60bc4c..8a327db 100644
--- a/lua-mode.el
+++ b/lua-mode.el
@@ -1430,9 +1430,10 @@ Don't use standalone."
;; nullify a previous then if on the same line.
((member found-token (list "until" "elseif"))
(save-excursion
- (let ((line (line-number-at-pos)))
- (if (and (lua-goto-matching-block-token found-pos 'backward)
- (= line (line-number-at-pos)))
+ (let* ((line-beginning (line-beginning-position))
+ (same-line (and (lua-goto-matching-block-token found-pos
'backward)
+ (<= line-beginning (point)))))
+ (if same-line
(cons 'remove-matching 0)
(cons 'relative 0)))))
@@ -1442,9 +1443,10 @@ Don't use standalone."
;; line will remove the effect of the else.
((string-equal found-token "else")
(save-excursion
- (let ((line (line-number-at-pos)))
- (if (and (lua-goto-matching-block-token found-pos 'backward)
- (= line (line-number-at-pos)))
+ (let* ((line-beginning (line-beginning-position))
+ (same-line (and (lua-goto-matching-block-token found-pos
'backward)
+ (<= line-beginning (point)))))
+ (if same-line
(cons 'replace-matching (cons 'relative lua-indent-level))
(cons 'relative lua-indent-level)))))
@@ -1453,9 +1455,10 @@ Don't use standalone."
;; indentation back to the matching block opener.
((member found-token (list ")" "}" "]" "end"))
(save-excursion
- (let ((line (line-number-at-pos)))
- (lua-goto-matching-block-token found-pos 'backward)
- (if (/= line (line-number-at-pos))
+ (let* ((line-beginning (line-beginning-position))
+ (same-line (and (lua-goto-matching-block-token found-pos
'backward)
+ (<= line-beginning (point)))))
+ (if (not same-line)
(lua-calculate-indentation-info (point))
(cons 'remove-matching 0)))))
- [nongnu] elpa/lua-mode 4342dd1 372/468: Fix compatibility with new rx package from Emacs 27, (continued)
- [nongnu] elpa/lua-mode 4342dd1 372/468: Fix compatibility with new rx package from Emacs 27, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 50d94a4 373/468: tests: silence "Indenting region..." messages, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode d746b7e 381/468: Fix typos, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode dc30240 384/468: Merge pull request #160 from tarsiiformes/typo, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 4db05e8 389/468: Use cl-lib instead of cl, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 3f67365 394/468: Renamed word “Result” to “Actual” in matcher's message, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 658bf8f 397/468: Merge pull request #166 from veprbl/patch-1, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 6436a45 398/468: Index "require" as imenu items, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 0e6813a 405/468: Refactor indentation tests to use test cases defined in *.lua files, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode acbcdc9 407/468: Don't prevent "block starter" tokens from starting continuation lines, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 4a45c6d 410/468: lua-make-indentation-info-pair: optimize "same-line" checks,
Philip Kaludercic <=
- [nongnu] elpa/lua-mode 8270df5 411/468: lua-is-continuing-statement-p: remove N^2 complexity on openers/closers, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode bf80b7e 414/468: Enable continuation after comma outside of parens/braces/brackets, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode afd5aa3 415/468: test-indentation: remove unused subr-x dependency, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode b170500 416/468: Add backport of string-trim not available in Emacs 24, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 5bfdea5 420/468: Merge pull request #177 from immerrr/refactor-variable-list-fontification, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 0546418 423/468: Extend lua-default-application doc a bit, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 9d46ad3 424/468: Update readme, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 345ebfc 425/468: Merge pull request #174 from immerrr/assorted-fixes, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 85d01e9 429/468: `lua-funcname-at-point': fix regexes, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode b647537 428/468: `lua-start-proces': don't hang if already running, Philip Kaludercic, 2021/08/05