diff options
author | Kevin Ballard <kevin@sb.org> | 2009-11-10 20:05:24 -0800 |
---|---|---|
committer | Kevin Ballard <kevin@sb.org> | 2009-11-10 20:05:24 -0800 |
commit | 7b3dbb03faf2b777d3ade8bb2c645a57192b4337 (patch) | |
tree | 86da442eaef40c76a539a39678abc9485bc86e14 /misc/emacs/go-mode.el | |
parent | df1b38aa7c09f7720e2e54ecfa6f92da11f4ceab (diff) | |
download | golang-7b3dbb03faf2b777d3ade8bb2c645a57192b4337.tar.gz |
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
http://codereview.appspot.com/154044
Committer: Russ Cox <rsc@golang.org>
Diffstat (limited to 'misc/emacs/go-mode.el')
-rw-r--r-- | misc/emacs/go-mode.el | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/misc/emacs/go-mode.el b/misc/emacs/go-mode.el index feba035ee..47d790db4 100644 --- a/misc/emacs/go-mode.el +++ b/misc/emacs/go-mode.el @@ -470,3 +470,9 @@ Useful for development work." (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)) |