aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Gerrand <adg@golang.org>2013-11-01 11:12:28 +1100
committerAlan Donovan <adonovan@google.com>2013-11-01 11:12:28 +1100
commitf17adc07650a3af1e10cf081764d8c761320e30a (patch)
tree7e17626e495f02c814d389a83aa1600d12340e4f
parent645a023474a33ff04b335060d3e7ccf593a1a222 (diff)
downloadgo-f17adc07650a3af1e10cf081764d8c761320e30a.tar.gz
go-f17adc07650a3af1e10cf081764d8c761320e30a.zip
[release-branch.go1.2] misc/emacs: handle empty "import ()" in go-goto-imports
««« CL 14454058 / 6b8f33ab7ca4 misc/emacs: handle empty "import ()" in go-goto-imports R=adonovan CC=golang-dev https://golang.org/cl/14454058 »»» R=golang-dev CC=golang-dev https://golang.org/cl/20590043
-rw-r--r--misc/emacs/go-mode.el5
1 files changed, 5 insertions, 0 deletions
diff --git a/misc/emacs/go-mode.el b/misc/emacs/go-mode.el
index f5d504d377..6cc03edb06 100644
--- a/misc/emacs/go-mode.el
+++ b/misc/emacs/go-mode.el
@@ -749,6 +749,9 @@ declaration."
(let ((old-point (point)))
(goto-char (point-min))
(cond
+ ((re-search-forward "^import ()" nil t)
+ (backward-char 1)
+ 'block-empty)
((re-search-forward "^import ([^)]+)" nil t)
(backward-char 2)
'block)
@@ -843,6 +846,8 @@ uncommented, otherwise a new import will be added."
(uncomment-region (line-beginning-position) (line-end-position))
(case (go-goto-imports)
('fail (message "Could not find a place to add import."))
+ ('block-empty
+ (insert "\n\t" line "\n"))
('block
(save-excursion
(re-search-backward "^import (")