[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/go-mode b36d2fd 352/495: cmd/guru: emacs: report an error
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/go-mode b36d2fd 352/495: cmd/guru: emacs: report an error when the guru command fails |
Date: |
Sat, 7 Aug 2021 09:05:46 -0400 (EDT) |
branch: elpa/go-mode
commit b36d2fd65b1e2c86501c1ddad39c0f297d8a34c9
Author: Alan Donovan <alan@alandonovan.net>
Commit: Dominik Honnef <dominik@honnef.co>
cmd/guru: emacs: report an error when the guru command fails
Don't just display the output buffer or, worse, parse it as JSON.
Change-Id: I1125ff235a5073b07f45f587ef8844b8a12f05ac
Reviewed-on: https://go-review.googlesource.com/19508
Reviewed-by: Michael Matloob <matloob@golang.org>
---
guru_import/cmd/guru/guru.el | 27 +++++++++++++++++----------
1 file changed, 17 insertions(+), 10 deletions(-)
diff --git a/guru_import/cmd/guru/guru.el b/guru_import/cmd/guru/guru.el
index 137d35e..619b8db 100644
--- a/guru_import/cmd/guru/guru.el
+++ b/guru_import/cmd/guru/guru.el
@@ -127,14 +127,21 @@ a scope if not already set. Return the output buffer."
(message nil) ; clears/shrinks minibuffer
(message "Running guru...")
;; Use dynamic binding to modify/restore the environment
- (let ((process-environment (list* goroot-env gopath-env
process-environment)))
- (apply #'call-process-region (append (list (point-min)
- (point-max)
- go-guru-command
- nil ; delete
- output-buffer
- t)
- args)))))
+ (let* ((process-environment (list* goroot-env gopath-env
process-environment))
+ (c-p-args (append (list (point-min)
+ (point-max)
+ go-guru-command
+ nil ; delete
+ output-buffer
+ t)
+ args))
+ (exitcode (apply #'call-process-region c-p-args)))
+ ;; If the command fails, don't show the output buffer,
+ ;; but use its contents (sans final \n) as an error.
+ (unless (zerop exitcode)
+ (with-current-buffer output-buffer
+ (bury-buffer)
+ (error "%s" (buffer-substring (point-min) (1- (point-max)))))))))
output-buffer))
(defun go-guru--compilation-markup ()
@@ -227,8 +234,8 @@ function containing the current point."
;; 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)))))
+ (goto-char (point-min))
+ (cdr (car (json-read)))))
(desc (cdr (assoc 'desc res))))
(go-guru--goto-pos (cdr (assoc 'objpos res)))
(message "%s" desc)))
- [nongnu] elpa/go-mode 648ad3d 311/495: Use null-device instead of /dev/null, (continued)
- [nongnu] elpa/go-mode 648ad3d 311/495: Use null-device instead of /dev/null, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode e035e60 309/495: Mention GOPATH detection in README, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 43da263 313/495: Simplify go-root-and-paths by using process-lines, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 95c74ba 324/495: Update URL to gogetdoc tool., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 228ded4 314/495: Use cons instead of append, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 205672f 322/495: Use separate godoc commands for godoc and godoc-at-point, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 737611e 329/495: Update URL to goimports, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode b65e408 334/495: go.tools/cmd/oracle: cosmetic tweaks to Emacs., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode e76464a 331/495: go.tools/oracle: an oracle that answers questions about Go source code., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 8560557 354/495: cmd/guru: fix bug in mode map caused by bad merge, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode b36d2fd 352/495: cmd/guru: emacs: report an error when the guru command fails,
ELPA Syncer <=
- [nongnu] elpa/go-mode d41ebaf 341/495: go.tools/oracle: improvements to command set and performance., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 385153c 338/495: go.tools/oracle: new query 'referrers' returns all references to an identifier., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode f18b4eb 369/495: cmd/guru: support streaming plain and -json output, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 9a5284b 362/495: cmd/guru: emacs: update scope documentation, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 4dfa1c4 350/495: cmd/guru: add support for loading modified files, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode fdb5dfa 335/495: go.tools/oracle: change notation for byte offsets to "-pos=file.go:#123-#456", ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 1dc6fb5 357/495: cmd/guru: fix mode map, again, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode fac4a24 336/495: go.tools/importer: negate "cgo" build tag to avoid native code in "net"., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 5b5ac61 364/495: cmd/guru: emacs: highlight all instances of an identifier, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 4146860 373/495: cmd/guru: Emacs: run guru asynchronously using compilation-mode, ELPA Syncer, 2021/08/07