 						     output-buffer
 						     t)
 					       args)))))
-    (with-current-buffer output-buffer
-      (insert "\n")
-      (compilation-mode)
-      (setq compilation-error-screen-columns nil)
-
-      ;; Hide the file/line info to save space.
-      ;; Replace each with a little widget.
-      ;; compilation-mode + this loop = slooow.
-      ;; TODO(adonovan): have guru give us JSON
-      ;; and we'll do the markup directly.
-      (let ((buffer-read-only nil)
-            (p 1))
-        (while (not (null p))
-          (let ((np (compilation-next-single-property-change p 'compilation-message)))
-            (if np
-                (when (equal (line-number-at-pos p) (line-number-at-pos np))
-                  ;; Using a fixed width greatly improves readability, so
-                  ;; if the filename is longer than 20, show ".../last/17chars.go".
-                  ;; This usually includes the last segment of the package name.
-                  ;; Don't show the line or column number.
-                  (let* ((loc (buffer-substring p np)) ; "/home/foo/go/pkg/file.go:1:2-3:4"
-                         (i (search ":" loc)))
-                    (setq loc (cond
-                               ((null i)  "...")
-                               ((>= i 17) (concat "..." (substring loc (- i 17) i)))
-                               (t         (substring loc 0 i))))
-                    ;; np is (typically) the space following ":"; consume it too.
-                    (put-text-property p np 'display (concat loc ":")))
-                  (goto-char np)
-                  (insert " ")
-                  (incf np))) ; so we don't get stuck (e.g. on a panic stack dump)
-            (setq p np)))
-        (message nil))
-
-      (let ((w (display-buffer (current-buffer))))
-        (balance-windows)
-        (shrink-window-if-larger-than-buffer w)
-        (set-window-point w (point-min))))))
+    output-buffer))
+
+(defun go-guru--compilation-markup ()
+  "Present guru output in the current buffer using `compilation-mode'."
+  (insert "\n")
+  (compilation-mode)
+  (setq compilation-error-screen-columns nil)
+  
+  ;; Hide the file/line info to save space.
+  ;; Replace each with a little widget.
+  ;; compilation-mode + this loop = slooow.
+  ;; TODO(adonovan): have guru give us JSON
+  ;; and we'll do the markup directly.
+  (let ((buffer-read-only nil)
+	(p 1))
+    (while (not (null p))
+      (let ((np (compilation-next-single-property-change p 'compilation-message)))
+	(if np
+	    (when (equal (line-number-at-pos p) (line-number-at-pos np))
+	      ;; Using a fixed width greatly improves readability, so
+	      ;; if the filename is longer than 20, show ".../last/17chars.go".
+	      ;; This usually includes the last segment of the package name.
+	      ;; Don't show the line or column number.
+	      (let* ((loc (buffer-substring p np)) ; "/home/foo/go/pkg/file.go:1:2-3:4"
+		     (i (search ":" loc)))
+		(setq loc (cond
+			   ((null i)  "...")
+			   ((>= i 17) (concat "..." (substring loc (- i 17) i)))
+			   (t         (substring loc 0 i))))
+		;; np is (typically) the space following ":"; consume it too.
+		(put-text-property p np 'display (concat loc ":")))
+	      (goto-char np)
+	      (insert " ")
+	      (incf np))) ; so we don't get stuck (e.g. on a panic stack dump)
+	(setq p np)))
+    (message nil))
+  
+  (let ((w (display-buffer (current-buffer))))
+    (shrink-window-if-larger-than-buffer w)
+    (set-window-point w (point-min))))
 
 (defun go-guru--insert-modified-files ()
   "Insert the contents of each modified Go buffer into the


The scope specifies a set of arguments, separated by spaces.
It may be:
1) a set of packages whose main() functions will be analyzed.
2) a list of *.go filenames; they will treated like as a single
   package (see #3).
3) a single package whose main() function and/or Test* functions
   will be analyzed.

In the common case, this is similar to the argument(s) you would

  (go-guru--run "callstack" t))

(defun go-guru-definition ()
  "Jump to the definition of the selected identifier."
  (interactive)
  ;; TODO(adonovan): use -format=sexpr when available to avoid a
  ;; dependency and to simplify parsing.
  (let* ((res (with-current-buffer (go-guru--exec "definition" nil '("-format=json"))
	       (goto-char (point-min))
	       (cdr (car (json-read)))))
	 (desc (cdr (assoc 'desc res))))
    (go-guru--goto-pos (cdr (assoc 'objpos res)))
    (message "%s" desc)))

(defun go-guru-describe ()
  "Describe the selected syntax, its kind, type and methods."
