branch: elpa/go-mode
commit 9d5f10a78de75e34797a52bb3bada360fcfc7e98
Author: Dominik Honnef <[email protected]>
Commit: Dominik Honnef <[email protected]>
cmd/guru: emacs: store output in separate buffer
Now that we have both interactive and non-interactive uses of the guru,
we should separate the command output buffer from the display buffer.
Change-Id: I50082fdc3847c7b12869e204509141e906df3852
Reviewed-on: https://go-review.googlesource.com/20473
Reviewed-by: Alan Donovan <[email protected]>
---
guru_import/cmd/guru/go-guru.el | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/guru_import/cmd/guru/go-guru.el b/guru_import/cmd/guru/go-guru.el
index ec4fa8e..7d8ad65 100644
--- a/guru_import/cmd/guru/go-guru.el
+++ b/guru_import/cmd/guru/go-guru.el
@@ -118,8 +118,13 @@ region of the current buffer. If NEED-SCOPE, prompt for a
scope
if not already set. Mark up the output using `compilation-mode`,
replacing each file name with a small hyperlink, and display the
result."
- (with-current-buffer (go-guru--exec mode need-scope)
- (go-guru--compilation-markup)))
+ (let ((output (go-guru--exec mode need-scope))
+ (display (get-buffer-create "*go-guru*")))
+ (with-current-buffer display
+ (setq buffer-read-only nil)
+ (erase-buffer)
+ (insert-buffer-substring output)
+ (go-guru--compilation-markup))))
(defun go-guru--exec (mode &optional need-scope flags allow-unnamed)
"Execute the Go guru in the specified MODE, passing it the
@@ -151,7 +156,7 @@ Return the output buffer."
(env-vars (go-root-and-paths))
(goroot-env (concat "GOROOT=" (car env-vars)))
(gopath-env (concat "GOPATH=" (mapconcat #'identity (cdr env-vars)
":")))
- (output-buffer (get-buffer-create "*go-guru*"))
+ (output-buffer (get-buffer-create "*go-guru-output*"))
(buf (current-buffer)))
(with-current-buffer output-buffer
(setq buffer-read-only nil)
@@ -192,6 +197,7 @@ Return the output buffer."
(defun go-guru--compilation-markup ()
"Present guru output in the current buffer using `compilation-mode'."
+ (goto-char (point-max))
(insert "\n")
(compilation-mode)
(setq compilation-error-screen-columns nil)
@@ -438,12 +444,6 @@ timeout."
(defun go-guru--hl-identifiers-before-change-function (_beg _end)
(go-guru-unhighlight-identifiers))
-;; FIXME(dominikh): currently we're using the same buffer for
-;; interactive and non-interactive output. E.g. if a user ran the
-;; referrers query, and then the hl-identifier timer ran a what query,
-;; the what query's json response would be visible and overwrite the
-;; referrers output
-
;; TODO(dominikh): a future feature may be to cycle through all uses
;; of an identifier.