Commit c57054f7 authored by Kevin Ballard's avatar Kevin Ballard Committed by Russ Cox

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
parent 022e3ae2
...@@ -470,3 +470,9 @@ Useful for development work." ...@@ -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))
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment