cmd/guru: emacs: add go-guru-debug variable

Don't print debug messages unless go-guru-debug is set.

Change-Id: I1332a0b10eba1d1107ef987734b2b787ae28d9c2
Reviewed-on: https://go-review.googlesource.com/20432
Reviewed-by: Alan Donovan <adonovan@google.com>
This commit is contained in:
Dominik Honnef 2016-03-08 22:11:22 +01:00 committed by Alan Donovan
parent b023cf6107
commit c5b51756ce
1 changed files with 9 additions and 3 deletions

View File

@ -50,6 +50,11 @@
:type 'string
:group 'go-guru)
(defcustom go-guru-debug nil
"Print debug messages when running guru."
:type 'boolean
:group 'go-guru)
;; Extend go-mode-map.
(let ((m (define-prefix-command 'go-guru-map)))
(define-key m "d" #'go-guru-describe)
@ -133,9 +138,10 @@ a scope if not already set. Return the output buffer."
flags
(list mode posn))))
;; Log the command to *Messages*, for debugging.
(message "Command: %s:" args)
(message nil) ; clears/shrinks minibuffer
(message "Running guru %s..." mode)
(when go-guru-debug
(message "Command: %s:" args)
(message nil) ; clears/shrinks minibuffer
(message "Running guru %s..." mode))
;; Use dynamic binding to modify/restore the environment
(let* ((process-environment (list* goroot-env gopath-env process-environment))
(c-p-args (append (list (point-min)