summaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorDominik Honnef <dominik.honnef@gmail.com>2013-10-22 12:35:04 -0400
committerDominik Honnef <dominik.honnef@gmail.com>2013-10-22 12:35:04 -0400
commitc7595e7132d0bb28a65304d1d2267de9ed12f305 (patch)
tree482a13bdbf2ba866853ac9124fb43b1f96cdc142 /misc
parent94490634d182879b1043f759f7ee17d87f652d9a (diff)
downloadgo-c7595e7132d0bb28a65304d1d2267de9ed12f305.tar.gz
misc/emacs: handle empty "import ()" in go-goto-imports
R=adonovan CC=golang-dev https://codereview.appspot.com/14454058 Committer: Alan Donovan <adonovan@google.com>
Diffstat (limited to 'misc')
-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 f5d504d37..6cc03edb0 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 (")