branch: elpa/go-mode
commit 4c13588cabe91fc05a98cda8d6be7df840590faf
Author: Dominik Honnef <[email protected]>
Commit: Dominik Honnef <[email protected]>

    replace go-goto-opening-parenthesis implementation with backward-up-list
---
 go-mode.el                 | 16 +++-------------
 indentation_tests/gh-15.go |  2 +-
 2 files changed, 4 insertions(+), 14 deletions(-)

diff --git a/go-mode.el b/go-mode.el
index 00300e4..977b6b4 100644
--- a/go-mode.el
+++ b/go-mode.el
@@ -81,6 +81,8 @@
       (concat "\\<" s "\\>")
     (concat "\\_<" s "\\_>")))
 
+(defalias 'go-goto-opening-parenthesis 'backward-up-list)
+
 (defconst go-dangling-operators-regexp "[^-]-\\|[^+]\\+\\|[/*&><.=|^]")
 (defconst go-identifier-regexp "[[:word:][:multibyte:]]+")
 (defconst go-label-regexp go-identifier-regexp)
@@ -287,18 +289,6 @@ curly brace we are checking. If they match, we return 
non-nil."
             (if (and (= (go-paren-level) start-nesting) (= old-point (point)))
                 t))))))
 
-(defun go-goto-opening-parenthesis (&optional char)
-  (let ((start-nesting (go-paren-level)))
-    (while (and (not (bobp))
-                (>= (go-paren-level) start-nesting))
-      (if (zerop (skip-chars-backward
-                  (if char
-                      (case char (?\] "^[") (?\} "^{") (?\) "^("))
-                    "^[{(")))
-          (if (go-in-string-or-comment-p)
-              (go-goto-beginning-of-string-or-comment)
-            (backward-char))))))
-
 (defun go--indentation-for-opening-parenthesis ()
   "Return the semantic indentation for the current opening parenthesis.
 
@@ -323,7 +313,7 @@ current line will be returned."
        ((go-in-string-p)
         (current-indentation))
        ((looking-at "[])}]")
-        (go-goto-opening-parenthesis (char-after))
+        (go-goto-opening-parenthesis)
         (if (go-previous-line-has-dangling-op-p)
             (- (current-indentation) tab-width)
           (go--indentation-for-opening-parenthesis)))
diff --git a/indentation_tests/gh-15.go b/indentation_tests/gh-15.go
index 4e8a9a4..5489529 100644
--- a/indentation_tests/gh-15.go
+++ b/indentation_tests/gh-15.go
@@ -1,7 +1,7 @@
 package gh15
 
 func somewhatLongFunctionName(
-       arg1 package1.RatherLongTypeName, arg2 package2.AnotherLongTypeName) {
+       arg1 package1.RatherLongTypeName, arg3 struct{}) {
        return
 }
 

Reply via email to