aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--misc/emacs/go-mode.el6
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))