[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/go-mode 10281b7 202/495: add godoc-at-point
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/go-mode 10281b7 202/495: add godoc-at-point |
Date: |
Sat, 7 Aug 2021 09:05:13 -0400 (EDT) |
branch: elpa/go-mode
commit 10281b73d6572886dfb5f798928e1478dcbbb669
Author: Dominik Honnef <dominikh@fork-bomb.org>
Commit: Dominik Honnef <dominikh@fork-bomb.org>
add godoc-at-point
show godoc for the function/method/type/variable at point. Due to
current limitations in godef and godoc, a method lookup discards the
type, which will result in documentation for both functions and methods
with the same name.
---
go-mode.el | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/go-mode.el b/go-mode.el
index b83027b..948942e 100644
--- a/go-mode.el
+++ b/go-mode.el
@@ -774,6 +774,23 @@ you save any file, kind of defeating the point of
autoloading."
'godoc--buffer-sentinel)
nil))
+(defun godoc-at-point (point)
+ (interactive "d")
+ (condition-case nil
+ (let* ((output (godef--call point))
+ (file (car output))
+ (name-parts (split-string (cadr output) " "))
+ (first (car name-parts)))
+ (if (not (godef--successful-p file))
+ (message "%s" (godef--error file))
+ (godoc (format "%s %s"
+ (mapconcat #'identity (butlast (split-string file
"/") 1) "/")
+ (if (or (string= first "type") (string= first
"const"))
+ (cadr name-parts)
+ (car name-parts))))))
+ (file-error (message "Could not run godef binary"))))
+
+
(defun go-goto-imports ()
"Move point to the block of imports.
- [nongnu] elpa/go-mode 520f070 182/495: allow users to customize path of 'go' tool., (continued)
- [nongnu] elpa/go-mode 520f070 182/495: allow users to customize path of 'go' tool., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 303ba8c 180/495: reformat code, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode ab6853d 183/495: use (buffer-base-buffer) instead of own local variable, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode de4e59a 194/495: require at least one space after "type", ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 9fde5fb 189/495: godef-jump: support jumping to package directories, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 7878794 187/495: send the correct content-length to the playground, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 68588e1 196/495: Support ff-find-other-file, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode a480b9a 205/495: more compact implementation of go--delete-whole-line, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 9d0732c 201/495: refactor godef error handling, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode f664cff 197/495: correctly fontify methods when go-fontify-function-calls is nil, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 10281b7 202/495: add godoc-at-point,
ELPA Syncer <=
- [nongnu] elpa/go-mode 6ed8eec 206/495: style adjustments as per CL 106010043, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 0e030ef 207/495: style adjustment, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode b626ee9 213/495: readd link to gocode in README, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 541e559 212/495: when parsing GOPATH, split on the platform-specific path separator, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 40b55e3 211/495: improve README, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode e639832 208/495: add documentation for godoc-at-point, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 7e22639 215/495: remove LEGAL, treat this repository as a mirror of misc/emacs, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 903fb9e 216/495: Cancel narrowing before gofmt, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 21cba0e 220/495: add gofmt-show-errors option, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 731b93c 152/495: godef: instead of printing just the first line of a definition, print all, ELPA Syncer, 2021/08/07