emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/lua-mode 0018e95 452/468: make-indentation-pair: don't cal


From: Philip Kaludercic
Subject: [nongnu] elpa/lua-mode 0018e95 452/468: make-indentation-pair: don't calculate full indentation on every closer
Date: Thu, 5 Aug 2021 04:59:27 -0400 (EDT)

branch: elpa/lua-mode
commit 0018e952090a10d9ac98ed6b02a5dcdc661ffe98
Author: immerrr <immerrr+lua@gmail.com>
Commit: immerrr <immerrr+lua@gmail.com>

    make-indentation-pair: don't calculate full indentation on every closer
---
 lua-mode.el | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/lua-mode.el b/lua-mode.el
index 8550286..1020261 100644
--- a/lua-mode.el
+++ b/lua-mode.el
@@ -1546,10 +1546,23 @@ Don't use standalone."
     (save-excursion
       (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)))))
+                             (<= line-beginning (point))))
+             (opener-pos (point))
+             opener-continuation-offset)
+        (if same-line
+            (cons 'remove-matching 0)
+          (back-to-indentation)
+          (setq opener-continuation-offset
+                (if (lua-is-continuing-statement-p-1) lua-indent-level 0))
+
+          ;; Accumulate indentation up to opener, including indentation. If
+          ;; there were no other indentation modifiers until said opener,
+          ;; ensure there is no continuation after the closer.
+          `(multiple . ((absolute . ,(- (current-indentation) 
opener-continuation-offset))
+                        ,@(when (/= opener-continuation-offset 0)
+                            (list (cons 'continued-line 
opener-continuation-offset)))
+                        ,@(delete nil (list (lua-calculate-indentation-info-1 
nil opener-pos)))
+                        (cancel-continued-line . nil)))))))
 
    ((member found-token '("do" "then"))
     `(multiple . ((cancel-continued-line . nil) (relative . 
,lua-indent-level))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]