diff options
author | Kevin Ballard <kevin@sb.org> | 2009-11-10 20:05:24 -0800 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2009-11-10 20:05:24 -0800 |
commit | c57054f7b49539ca4ed6533267c1c20c39aaaaa5 (patch) | |
tree | b68305599abee671f80890777d0bbf1163ed5921 | |
parent | 022e3ae2659491e519d392e266acd86223a510f4 (diff) | |
download | go-weekly.2009-11-10.1.tar.gz go-weekly.2009-11-10.1.zip |
Implement new emacs command M-x gofmtweekly.2009-11-10.1
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
-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 feba035ee5..47d790db41 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)) |