summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Gerrand <adg@golang.org>2013-11-13 14:34:24 +1100
committerAndrew Gerrand <adg@golang.org>2013-11-13 14:34:24 +1100
commite64ec9687496ee95c8b77819ae33b325c31a247f (patch)
tree10e166981f4b5ec2a777606c3758d67d24d83076
parent1eaeb2da38671f1710677f320743fc2b1e2f4374 (diff)
downloadgo-e64ec9687496ee95c8b77819ae33b325c31a247f.tar.gz
[release-branch.go1.2] emacs: allow users to customize the gofmt command, in particular, to use goimports instead.
??? CL 23680043 / 341a490e4736 emacs: allow users to customize the gofmt command, in particular, to use goimports instead. R=adonovan CC=golang-dev https://codereview.appspot.com/23680043 ??? R=golang-dev CC=golang-dev https://codereview.appspot.com/25740043
-rw-r--r--misc/emacs/go-mode.el8
1 files changed, 7 insertions, 1 deletions
diff --git a/misc/emacs/go-mode.el b/misc/emacs/go-mode.el
index b74bc45e8..3dfa8e335 100644
--- a/misc/emacs/go-mode.el
+++ b/misc/emacs/go-mode.el
@@ -157,6 +157,12 @@ customize this variable to point to the wrapper script."
:type 'string
:group 'go)
+(defcustom gofmt-command "gofmt"
+ "The 'gofmt' command. Some users may replace this with 'goimports'
+from https://github.com/bradfitz/goimports."
+ :type 'string
+ :group 'go)
+
(defface go-coverage-untracked
'((t (:foreground "#505050")))
"Coverage color of untracked code."
@@ -638,7 +644,7 @@ buffer."
;; We're using errbuf for the mixed stdout and stderr output. This
;; is not an issue because gofmt -w does not produce any stdout
;; output in case of success.
- (if (zerop (call-process "gofmt" nil errbuf nil "-w" tmpfile))
+ (if (zerop (call-process gofmt-command nil errbuf nil "-w" tmpfile))
(if (zerop (call-process-region (point-min) (point-max) "diff" nil patchbuf nil "-n" "-" tmpfile))
(progn
(kill-buffer errbuf)