««« 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
(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)
(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 (")