branch: elpa/go-mode
commit 94ffc7a29624d6afe807972cc00d5065d7d572b6
Author: Lowe Thiderman <[email protected]>
Commit: Dominik Honnef <[email protected]>
go-goto-docstring: insert function name even if empty comment
It only inserted slashes, not the function name like the case when there
is no docstring at all.
Also clarify confusing docstring.
---
go-mode.el | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/go-mode.el b/go-mode.el
index 49c7346..e22bea9 100644
--- a/go-mode.el
+++ b/go-mode.el
@@ -1731,7 +1731,7 @@ an error is raised."
(defun go-goto-docstring (&optional arg)
"Go to the top of the docstring of the current function.
-If there is none, add slashes to start writing one.
+If there is none, add one beginning with the name of the current function.
Anonymous functions do not have docstrings, so when this is called
interactively anonymous functions will be skipped. If called programmatically,
@@ -1755,7 +1755,7 @@ an error is raised."
;; If we are looking at an empty comment, add a single space in front of it.
((looking-at "^//$")
(forward-char 2)
- (insert " "))
+ (insert (format " %s " (go--get-function-name))))
;; If we are not looking at the function signature, we are looking at a
docstring.
;; Move to the beginning of the first word of it.
((not (looking-at "^func"))