mirror of https://github.com/golang/go.git
emacs: allow users to customize the gofmt command, in particular, to use goimports instead.
R=adonovan CC=golang-dev https://golang.org/cl/23680043
This commit is contained in:
parent
6be1cb8c7a
commit
19dda5cd74
|
|
@ -157,6 +157,12 @@ customize this variable to point to the wrapper script."
|
||||||
:type 'string
|
:type 'string
|
||||||
:group 'go)
|
: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
|
(defface go-coverage-untracked
|
||||||
'((t (:foreground "#505050")))
|
'((t (:foreground "#505050")))
|
||||||
"Coverage color of untracked code."
|
"Coverage color of untracked code."
|
||||||
|
|
@ -638,7 +644,7 @@ buffer."
|
||||||
;; We're using errbuf for the mixed stdout and stderr output. This
|
;; We're using errbuf for the mixed stdout and stderr output. This
|
||||||
;; is not an issue because gofmt -w does not produce any stdout
|
;; is not an issue because gofmt -w does not produce any stdout
|
||||||
;; output in case of success.
|
;; 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))
|
(if (zerop (call-process-region (point-min) (point-max) "diff" nil patchbuf nil "-n" "-" tmpfile))
|
||||||
(progn
|
(progn
|
||||||
(kill-buffer errbuf)
|
(kill-buffer errbuf)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue