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

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

[nongnu] elpa/go-mode 45a8131 284/495: Implement go--goto-opening-curly-


From: ELPA Syncer
Subject: [nongnu] elpa/go-mode 45a8131 284/495: Implement go--goto-opening-curly-brace as in go-end-of-defun
Date: Sat, 7 Aug 2021 09:05:32 -0400 (EDT)

branch: elpa/go-mode
commit 45a81314bece383ae41370f90bf5bc270da3e071
Author: Dominik Honnef <dominik@honnef.co>
Commit: Dominik Honnef <dominik@honnef.co>

    Implement go--goto-opening-curly-brace as in go-end-of-defun
---
 go-mode.el | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/go-mode.el b/go-mode.el
index b094f92..fb00b73 100644
--- a/go-mode.el
+++ b/go-mode.el
@@ -1642,19 +1642,19 @@ If ARG is non-nil, anonymous functions are ignored."
     (go-goto-function arg))))
 
 (defun go--goto-opening-curly-brace ()
+  ;; Find the { that starts the function, i.e., the next { that isn't
+  ;; preceded by struct or interface, or a comment or struct tag.  BUG:
+  ;; breaks if there's a comment between the struct/interface keyword and
+  ;; bracket, like this:
+  ;;
+  ;;     struct /* why? */ {
   (go--goto-return-values)
-  ;; Try to place the point on the opening brace.
-  (cond
-   ((looking-at "(")
-    ;; Multiple return values! Just walk past the list and we're done!
-    (forward-list 1)
-    (forward-char 1))
-
-   ((not (looking-at "{"))
-    ;; Go to the end of the defun and back up and we'll be where we want to be.
-    (end-of-defun)
-    (backward-char 1)
-    (backward-list 1))))
+  (while (progn
+           (skip-chars-forward "^{")
+           (forward-char)
+           (or (go-in-string-or-comment-p)
+               (looking-back "\\(struct\\|interface\\)\\s-*{"))))
+  (backward-char))
 
 (defun go--in-function-p (compare-point)
   "Return t if COMPARE-POINT lies inside the function immediately surrounding 
point."



reply via email to

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