]> Cypherpunks repositories - gostls13.git/commitdiff
[release-branch.go1.2] emacs: allow users to customize the gofmt command, in particul...
authorAndrew Gerrand <adg@golang.org>
Wed, 13 Nov 2013 03:34:24 +0000 (14:34 +1100)
committerAndrew Gerrand <adg@golang.org>
Wed, 13 Nov 2013 03:34:24 +0000 (14:34 +1100)
««« CL 23680043 / 341a490e4736
emacs: allow users to customize the gofmt command, in particular, to use goimports instead.

R=adonovan
CC=golang-dev
https://golang.org/cl/23680043
»»»

R=golang-dev
CC=golang-dev
https://golang.org/cl/25740043

misc/emacs/go-mode.el

index b74bc45e8d5d9a5254cd43974541b09b4175553b..3dfa8e335398fc6d5192b802ee7c8ba7988567fb 100644 (file)
@@ -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)