diff options
author | Dominik Honnef <dominik.honnef@gmail.com> | 2013-08-16 00:22:38 -0400 |
---|---|---|
committer | Dominik Honnef <dominik.honnef@gmail.com> | 2013-08-16 00:22:38 -0400 |
commit | 0eb76006c371f23b08d0eb38be6c321b9fe62a7d (patch) | |
tree | e71272b6fe853672c36227988593e2cd711064c4 | |
parent | d6d890fe1b139904273a2cd4f7df573ea4244e61 (diff) | |
download | go-0eb76006c371f23b08d0eb38be6c321b9fe62a7d.tar.gz |
misc/emacs: allow godef to work in coverage buffers
Jumps to the same file will use the original buffer, not the
coverage buffer. Making it work for the coverage buffer isn't
worth the trouble, especially because it would break as soon as
you jump to a different file and back.
Use error instead of message so it actually terminates
R=adonovan
CC=golang-dev
https://codereview.appspot.com/13041043
Committer: Alan Donovan <adonovan@google.com>
-rw-r--r-- | misc/emacs/go-mode.el | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/misc/emacs/go-mode.el b/misc/emacs/go-mode.el index 341c03614..5a0048045 100644 --- a/misc/emacs/go-mode.el +++ b/misc/emacs/go-mode.el @@ -948,13 +948,24 @@ visit FILENAME and go to line LINE and column COLUMN." "Call godef, acquiring definition position and expression description at POINT." (if (go--xemacs-p) - (message "godef does not reliably work in XEmacs, expect bad results")) - (if (not buffer-file-name) - (message "Cannot use godef on a buffer without a file name") + (error "godef does not reliably work in XEmacs, expect bad results")) + (if (not (buffer-file-name (go--coverage-origin-buffer))) + (error "Cannot use godef on a buffer without a file name") (let ((outbuf (get-buffer-create "*godef*"))) (with-current-buffer outbuf (erase-buffer)) - (call-process-region (point-min) (point-max) "godef" nil outbuf nil "-i" "-t" "-f" (file-truename buffer-file-name) "-o" (number-to-string (go--position-bytes (point)))) + (call-process-region (point-min) + (point-max) + "godef" + nil + outbuf + nil + "-i" + "-t" + "-f" + (file-truename (buffer-file-name (go--coverage-origin-buffer))) + "-o" + (number-to-string (go--position-bytes (point)))) (with-current-buffer outbuf (split-string (buffer-substring-no-properties (point-min) (point-max)) "\n"))))) |