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

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

[nongnu] elpa/lua-mode 70b9384 448/468: Don't evaluate lua-is-continuing


From: Philip Kaludercic
Subject: [nongnu] elpa/lua-mode 70b9384 448/468: Don't evaluate lua-is-continuing-statement-p-1 twice
Date: Thu, 5 Aug 2021 04:59:27 -0400 (EDT)

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

    Don't evaluate lua-is-continuing-statement-p-1 twice
---
 lua-mode.el | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/lua-mode.el b/lua-mode.el
index 48598e1..018184a 100644
--- a/lua-mode.el
+++ b/lua-mode.el
@@ -1470,11 +1470,15 @@ This true is when the line :
     ;; opener line, ") + long_function_name2({", which in its turn is decided
     ;; by the "long_function_name(" line, which is a continuation line
     ;; because the line before it ends with a binary operator.
-    (while (and (lua--goto-line-beginning-rightmost-closer)
-                (lua--backward-up-list-noerror)
-                (lua-is-continuing-statement-p-1)))
-    (lua-is-continuing-statement-p-1)))
-
+    (cl-loop
+     ;; Go to opener line
+     while (and (lua--goto-line-beginning-rightmost-closer)
+               (lua--backward-up-list-noerror))
+     ;; If opener line is continuing, repeat. If opener line is not
+     ;; continuing, return nil.
+     always (lua-is-continuing-statement-p-1)
+     ;; We get here if there was no opener to go to: check current line.
+     finally return (lua-is-continuing-statement-p-1))))
 
 (defun lua-make-indentation-info-pair (found-token found-pos)
   "Create a pair from FOUND-TOKEN and FOUND-POS for indentation calculation.



reply via email to

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