branch: elpa/go-mode
commit da55ef1ad3a4802f7d056d3065f6962db3d6fd14
Author: Jonas Helgemo <[email protected]>
Commit: Dominik Honnef <[email protected]>
Evaluate error conditions before prompting for new name
Closes: gh-196 [via git-merge-pr]
---
go-rename.el | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/go-rename.el b/go-rename.el
index 5b75e65..1f55dd9 100644
--- a/go-rename.el
+++ b/go-rename.el
@@ -40,8 +40,10 @@
"Rename the entity denoted by the identifier at point, using
the `gorename' tool. With FORCE, call `gorename' with the
`-force' flag."
- (interactive (list (read-string "New name: " (thing-at-point 'symbol))
- current-prefix-arg))
+ (interactive (list
+ (unless (buffer-modified-p (or (not buffer-file-name)))
+ (read-string "New name: " (thing-at-point 'symbol)))
+ current-prefix-arg))
(if (not buffer-file-name)
(error "Cannot use go-rename on a buffer without a file name"))
;; It's not sufficient to save the current buffer if modified,