mirror of
https://github.com/golang/go
synced 2024-11-15 03:20:31 -07:00
[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
This commit is contained in:
parent
645a023474
commit
f17adc0765
@ -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 (")
|
||||
|
Loading…
Reference in New Issue
Block a user