branch: elpa/go-mode
commit 2f302d236f120f0a1a2ae8cf0c300dc6cd97cb10
Author: Lowe Thiderman <[email protected]>
Commit: Dominik Honnef <[email protected]>
Update go--goto-opening-curly-brace to handle more cases
Add handling of anonymous interfaces.
By chance, also handle the case of a dotted return value like "a.B".
---
go-mode.el | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/go-mode.el b/go-mode.el
index b44273a..9642fc3 100644
--- a/go-mode.el
+++ b/go-mode.el
@@ -1636,11 +1636,23 @@ If ARG is non-nil, anonymous functions are ignored."
;; 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 "{"))
- (forward-word 1)
- (forward-char 1))))
+ ;; Place point at the next curly brace.
+ (search-forward "{")
+ (backward-char 1)
+ ;; Check of the end of the other parenthesis looks like "} {". If it does,
+ ;; we are looking at the definition of an anonymous intefrace return value.
+ ;; Move past the list and one char forward and we are done.
+ (when (save-excursion
+ (forward-list 1)
+ (backward-char 1)
+ (looking-at "} {"))
+ (forward-list 1)
+ (forward-char 1)))))
(defun go--in-function-p (compare-point)
"Return t if COMPARE-POINT lies inside the function immediately surrounding
point."