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

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

[nongnu] elpa/go-mode 426d2df 050/495: Improve indentation speed by not


From: ELPA Syncer
Subject: [nongnu] elpa/go-mode 426d2df 050/495: Improve indentation speed by not trying to indent unnested lines
Date: Sat, 7 Aug 2021 09:04:41 -0400 (EDT)

branch: elpa/go-mode
commit 426d2df753820ba8033e3c9ea6f8235418986a28
Author: Dominik Honnef <dominikh@fork-bomb.org>
Commit: Dominik Honnef <dominikh@fork-bomb.org>

    Improve indentation speed by not trying to indent unnested lines
    
    If a line has a nesting of zero, there's no way it could be indented at any 
level other than zero
---
 go-mode.el | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/go-mode.el b/go-mode.el
index 777ccc4..6075bb4 100644
--- a/go-mode.el
+++ b/go-mode.el
@@ -175,18 +175,20 @@ built-ins, functions, and some types.")
                 (+ (current-indentation) tab-width))
             (go--backward-irrelevant)
             (setq line-begin (line-beginning-position))
-            (while (and
-                    (not (bobp))
-                    (>= (go-paren-level) start-nesting))
-              (if (= 0 (skip-chars-backward "^[]{}()"))
-                  (backward-char))
-              (if (go-in-string-p)
-                  (progn
-                    (go--backward-irrelevant)
-                    (setq line-begin (line-beginning-position)))))
-            (if (and (< (go-paren-level) start-nesting))
-                (+ (current-indentation) tab-width (- outindent))
-              (- (current-indentation) outindent))))))))
+            (if (= (go-paren-level) 0)
+                0
+              (while (and
+                      (not (bobp))
+                      (>= (go-paren-level) start-nesting))
+                (if (= 0 (skip-chars-backward "^[]{}()"))
+                    (backward-char))
+                (if (go-in-string-p)
+                    (progn
+                      (go--backward-irrelevant)
+                      (setq line-begin (line-beginning-position)))))
+              (if (and (< (go-paren-level) start-nesting))
+                  (+ (current-indentation) tab-width (- outindent))
+                (- (current-indentation) outindent)))))))))
 
 (defun go-mode-indent-line ()
   (interactive)



reply via email to

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