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

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

[nongnu] elpa/go-mode 54a102e 046/495: do not move cursor to beginning o


From: ELPA Syncer
Subject: [nongnu] elpa/go-mode 54a102e 046/495: do not move cursor to beginning of line after indentation
Date: Sat, 7 Aug 2021 09:04:41 -0400 (EDT)

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

    do not move cursor to beginning of line after indentation
---
 go-mode.el | 48 ++++++++++++++++++++++++------------------------
 1 file changed, 24 insertions(+), 24 deletions(-)

diff --git a/go-mode.el b/go-mode.el
index 8739d28..6dafcc0 100644
--- a/go-mode.el
+++ b/go-mode.el
@@ -196,30 +196,30 @@ built-ins, functions, and some types.")
 
 (defun go-mode-indent-line ()
   (interactive)
-  (beginning-of-line)
-  (if (not (go-in-comment-p))
-      (let ((indent (go-indentation-at-point (point)))
-            shift-amt
-            end
-            (pos (- (point-max) (point)))
-            (beg (progn (beginning-of-line) (point))))
-        (back-to-indentation)
-        (if (looking-at "case .+:\\|default:")
-            (setq indent (- indent tab-width)))
-        (beginning-of-line)
-        (if (and (looking-at 
"^[[:space:]]*[[:word:]]+:\\([[:space:]]*/.+\\)?$")
-                 (not (looking-at "^[[:space:]]*default:")))
-            (setq indent 0))
-        (skip-chars-forward " \t")
-        (setq shift-amt (- indent (current-column)))
-        (if (zerop shift-amt)
-            nil
-          (delete-region beg (point))
-          (indent-to indent))
-        ;; If initial point was within line's indentation,
-        ;; position after the indentation.  Else stay at same point in text.
-        (if (> (- (point-max) pos) (point))
-            (goto-char (- (point-max) pos))))))
+  (let ((indent (go-indentation-at-point (point)))
+        shift-amt
+        end
+        (pos (- (point-max) (point)))
+        (beg (progn (beginning-of-line) (point))))
+    (back-to-indentation)
+    (if (go-in-comment-p) ;; Do not change the indentation of multi-line 
comments
+        nil
+      (if (looking-at "case .+:\\|default:")
+          (setq indent (- indent tab-width)))
+      (beginning-of-line)
+      (if (and (looking-at "^[[:space:]]*[[:word:]]+:\\([[:space:]]*/.+\\)?$")
+               (not (looking-at "^[[:space:]]*default:")))
+          (setq indent 0))
+      (skip-chars-forward " \t")
+      (setq shift-amt (- indent (current-column)))
+      (if (zerop shift-amt)
+          nil
+        (delete-region beg (point))
+        (indent-to indent))
+      ;; If initial point was within line's indentation,
+      ;; position after the indentation.  Else stay at same point in text.
+      (if (> (- (point-max) pos) (point))
+          (goto-char (- (point-max) pos))))))
 
 (defun go-beginning-of-defun (&optional count)
   (unless count (setq count 1))



reply via email to

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