emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/go-mode da55ef1 413/495: Evaluate error conditions before


From: ELPA Syncer
Subject: [nongnu] elpa/go-mode da55ef1 413/495: Evaluate error conditions before prompting for new name
Date: Sat, 7 Aug 2021 09:05:59 -0400 (EDT)

branch: elpa/go-mode
commit da55ef1ad3a4802f7d056d3065f6962db3d6fd14
Author: Jonas Helgemo <jonas.helgemo@gmail.com>
Commit: Dominik Honnef <dominik@honnef.co>

    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,



reply via email to

[Prev in Thread] Current Thread [Next in Thread]