[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/go-mode aa733d8 339/495: go.tools/oracle: turn emacs integ
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/go-mode aa733d8 339/495: go.tools/oracle: turn emacs integration into minor-mode |
Date: |
Sat, 7 Aug 2021 09:05:43 -0400 (EDT) |
branch: elpa/go-mode
commit aa733d8a5c461a8042e9fe00b1825396a5649a6d
Author: Dominik Honnef <dominik.honnef@gmail.com>
Commit: Dominik Honnef <dominik@honnef.co>
go.tools/oracle: turn emacs integration into minor-mode
Define a minor mode called go-oracle-mode. Right now its sole
purpose is to define a keymap but it might later be used to add
hooks or add other features to go-mode.
R=adonovan
CC=golang-dev
https://golang.org/cl/13412048
---
guru_import/cmd/oracle/oracle.el | 39 ++++++++++++++++++++++++++++++---------
1 file changed, 30 insertions(+), 9 deletions(-)
diff --git a/guru_import/cmd/oracle/oracle.el b/guru_import/cmd/oracle/oracle.el
index 92d625b..57fc88f 100644
--- a/guru_import/cmd/oracle/oracle.el
+++ b/guru_import/cmd/oracle/oracle.el
@@ -7,9 +7,9 @@
;;; % mv $GOPATH/bin/oracle $GOROOT/bin/
;;;
;;; Load this file into Emacs and set go-oracle-scope to your
-;;; configuration. Then, find a file of Go source code, select an
-;;; expression of interest, and press F4 (for "describe") or run one
-;;; of the other go-oracle-xxx commands.
+;;; configuration. Then, find a file of Go source code, enable
+;;; go-oracle-mode, select an expression of interest, and press `C-c C-o d'
+;;; (for "describe") or run one of the other go-oracle-xxx commands.
;;;
;;; TODO(adonovan): simplify installation and configuration by making
;;; oracle a subcommand of 'go tool'.
@@ -36,8 +36,28 @@
nil
"History of values supplied to `go-oracle-set-scope'.")
+(defvar go-oracle-mode-map
+ (let ((m (make-sparse-keymap)))
+ (define-key m (kbd "C-c C-o d") #'go-oracle-describe)
+ (define-key m (kbd "C-c C-o f") #'go-oracle-freevars)
+ (define-key m (kbd "C-c C-o g") #'go-oracle-callgraph)
+ (define-key m (kbd "C-c C-o i") #'go-oracle-implements)
+ (define-key m (kbd "C-c C-o p") #'go-oracle-peers)
+ (define-key m (kbd "C-c C-o r") #'go-oracle-referrers)
+ (define-key m (kbd "C-c C-o s") #'go-oracle-callstack)
+ (define-key m (kbd "C-c C-o <") #'go-oracle-callers)
+ (define-key m (kbd "C-c C-o >") #'go-oracle-callees)
+ m))
+
+;; TODO(dominikh): Rethink set-scope some. Setting it to a file is
+;; painful because it doesn't use find-file, and variables/~ aren't
+;; expanded. Setting it to an import path is somewhat painful because
+;; it doesn't make use of go-mode's import path completion. One option
+;; would be having two different functions, but then we can't
+;; automatically call it when no scope has been set. Also it wouldn't
+;; easily allow specifying more than one file/package.
(defun go-oracle-set-scope ()
- "Sets the scope for the Go oracle, prompting the user to edit the
+ "Set the scope for the Go oracle, prompting the user to edit the
previous scope.
The scope specifies a set of arguments, separated by spaces.
@@ -181,10 +201,11 @@ identifier."
(interactive)
(go-oracle--run "referrers"))
-;; TODO(adonovan): don't mutate the keymap; just document how users
-;; can do this themselves. But that means freezing the API, so don't
-;; do that yet; wait till v1.0.
-(add-hook 'go-mode-hook
- #'(lambda () (local-set-key (kbd "<f4>") #'go-oracle-describe)))
+;; TODO(dominikh): better docstring
+(define-minor-mode go-oracle-mode "Oracle minor mode for go-mode
+
+Keys specific to go-oracle-mode:
+\\{go-oracle-mode-map}"
+ nil " oracle" go-oracle-mode-map)
(provide 'go-oracle)
- [nongnu] elpa/go-mode 0b5b29d 316/495: Reformat code, (continued)
- [nongnu] elpa/go-mode 0b5b29d 316/495: Reformat code, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode a6717a1 318/495: Fix filename replacement in gofmt error buffer, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 50bceae 326/495: Use HTTPS with go-play-region, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 49521d5 310/495: Add go-reset-gopath, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode b767500 325/495: Set compilation-error-screen-columns to nil, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 15ea9a4 320/495: No longer provide a default in M-x godoc, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 22cbf11 321/495: Support unsaved buffers with gogetdoc, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 0b25cb5 327/495: Generate HTTPS URL for playground entry, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode f63d982 323/495: Make godoc interactive again, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 218d8c5 346/495: cmd/oracle: emacs: look for oracle on $PATH and nowhere else, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode aa733d8 339/495: go.tools/oracle: turn emacs integration into minor-mode,
ELPA Syncer <=
- [nongnu] elpa/go-mode cbf7274 343/495: x/tools/oracle: add whicherrs query mode, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 01dff21 358/495: cmd/guru: emacs: package.el compatibility changes, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode dc424ef 361/495: cmd/guru: emacs: add default key binding for whicherrs, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 6bfbd41 371/495: cmd/guru: emacs: report most specific element in expand-region, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 9753f6a 342/495: go.tools: use golang.org/x/... import paths, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode aa9a40c 351/495: cmd/guru: in Emacs, change 'definition' to jump directly, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 95e7a6f 377/495: cmd/guru: emacs: Use cl-lib.el instead of cl.el, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 2e9ec69 376/495: cmd/guru: update Emacs installation documentation, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 37f595f 365/495: cmd/guru: emacs: support running on nameless buffers, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 9d5f10a 366/495: cmd/guru: emacs: store output in separate buffer, ELPA Syncer, 2021/08/07