1
0
mirror of https://github.com/golang/go synced 2024-11-22 01:54:42 -07:00

Implement new emacs command M-x gofmt

Define a new interactive function in go-mode.el called gofmt.
This function passes the current buffer through the external `gofmt`
tool and replaces the buffer with the result.

R=agl, rsc
https://golang.org/cl/154044
This commit is contained in:
Kevin Ballard 2009-11-10 20:05:24 -08:00 committed by Russ Cox
parent 022e3ae265
commit c57054f7b4

View File

@ -470,3 +470,9 @@ Useful for development work."
(go-mode)) (go-mode))
(provide 'go-mode) (provide 'go-mode)
(defun gofmt ()
"Pipe the current buffer through the external tool `gofmt`."
(interactive)
(shell-command-on-region 1 (+ (buffer-size) 1) "gofmt" t t shell-command-default-error-buffer))