branch: elpa/go-mode
commit 2db2ff6801c02ec25700e1b0abdef97ac3f87dc5
Author: Alan Donovan <[email protected]>
Commit: Dominik Honnef <[email protected]>
go.tools/oracle: change -pos flag syntax from "file pos-pos" to
file:pos-pos.
Pro: no shell quotation needed.
Con: can't be parsed by (the perpetually useless) Scanf.
R=crawshaw, dgryski
CC=golang-dev
https://golang.org/cl/13441043
---
guru_import/cmd/oracle/oracle.el | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/guru_import/cmd/oracle/oracle.el b/guru_import/cmd/oracle/oracle.el
index 7b64a85..50e5830 100644
--- a/guru_import/cmd/oracle/oracle.el
+++ b/guru_import/cmd/oracle/oracle.el
@@ -75,11 +75,14 @@ result."
(if (string-equal "" go-oracle-scope)
(go-oracle-set-scope))
(let* ((filename (file-truename buffer-file-name))
- (pos (if (use-region-p)
- (format "%s-%s"
- (1- (go--position-bytes (region-beginning)))
- (1- (go--position-bytes (region-end))))
- (format "%s" (1- (position-bytes (point))))))
+ (posflag (if (use-region-p)
+ (format "-pos=%s:%s-%s"
+ filename
+ (1- (go--position-bytes (region-beginning)))
+ (1- (go--position-bytes (region-end))))
+ (format "-pos=%s:%s"
+ filename
+ (1- (position-bytes (point))))))
;; This would be simpler if we could just run 'go tool oracle'.
(env-vars (go-root-and-paths))
(goroot-env (concat "GOROOT=" (car env-vars)))
@@ -89,7 +92,7 @@ result."
(erase-buffer)
(insert "Go Oracle\n")
(let ((args (append (list go-oracle-command nil t nil
- (format "-pos=%s %s" filename pos)
+ posflag
(format "-mode=%s" mode))
(split-string go-oracle-scope " " t))))
;; Log the command to *Messages*, for debugging.