diff options
author | Andrew Gerrand <adg@golang.org> | 2013-11-01 11:24:57 +1100 |
---|---|---|
committer | Andrew Gerrand <adg@golang.org> | 2013-11-01 11:24:57 +1100 |
commit | 1341a3e6dc0e77991600685ecd046da663177c62 (patch) | |
tree | 4b37fe4435a5c103146437ed23241ee91c6dd400 | |
parent | 660cb51640dfad63a1b8d4d39c3c72fe424e9c46 (diff) | |
download | go-1341a3e6dc0e77991600685ecd046da663177c62.tar.gz |
[release-branch.go1.2] misc/emacs: support godef-jump on import statements
??? CL 18230043 / f2b59b5163b0
misc/emacs: support godef-jump on import statements
The newest version of godef supports jumping to a package's source
directory if point is on an import statement.
R=adonovan
CC=golang-dev
https://codereview.appspot.com/18230043
Committer: Alan Donovan <adonovan@google.com>
???
R=golang-dev
CC=golang-dev
https://codereview.appspot.com/20620043
-rw-r--r-- | misc/emacs/go-mode.el | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/misc/emacs/go-mode.el b/misc/emacs/go-mode.el index 6cc03edb0..b74bc45e8 100644 --- a/misc/emacs/go-mode.el +++ b/misc/emacs/go-mode.el @@ -950,11 +950,12 @@ will be commented, otherwise they will be removed completely." "Given a file name in the format of `filename:line:column', visit FILENAME and go to line LINE and column COLUMN." (if (not (string-match "\\(.+\\):\\([0-9]+\\):\\([0-9]+\\)" specifier)) - (error "Unexpected godef output: %s" specifier) + ;; We've only been given a directory name + (funcall (if other-window #'find-file-other-window #'find-file) specifier) (let ((filename (match-string 1 specifier)) (line (string-to-number (match-string 2 specifier))) (column (string-to-number (match-string 3 specifier)))) - (with-current-buffer (funcall (if other-window 'find-file-other-window 'find-file) filename) + (with-current-buffer (funcall (if other-window #'find-file-other-window #'find-file) filename) (go--goto-line line) (beginning-of-line) (forward-char (1- column)) @@ -1008,6 +1009,8 @@ description at POINT." (message "%s" file)) ((go--string-prefix-p "godef: no declaration found for " file) (message "%s" file)) + ((go--string-prefix-p "error finding import path for " file) + (message "%s" file)) (t (push-mark) (ring-insert find-tag-marker-ring (point-marker)) |