branch: elpa/go-mode
commit 8991b832d21ef98e7ff18145271136aa1ede08ff
Author: Dominik Honnef <[email protected]>
Commit: Dominik Honnef <[email protected]>

    refactor/rename: emacs: kill go-rename buffer correctly
    
    Match gofmt's behaviour of closing the status buffer. Don't display the
    buffer in case of success as we were going to hide it instantly again,
    anyway. Also, instead of using delete-window, use
    gofmt--kill-error-buffer. gofmt--kill-error-buffer uses quit-window if
    there's a window for the buffer, kill-buffer otherwise.
    
    quit-window only deletes the window if it was created explicitly for the
    status buffer and if it is still displaying it. This way, we won't close
    windows that the user created or repurposed himself.
    
    Additionally, this change ensures that we don't leave a *go-rename*
    buffer lying around when gorename succeeded.
    
    Fixes golang/go#10972.
    
    Change-Id: Id1efb60d399f0062d870e925138aa827e12f3e58
    Reviewed-on: https://go-review.googlesource.com/10453
    Reviewed-by: Alan Donovan <[email protected]>
---
 rename_import/refactor/rename/rename.el | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/rename_import/refactor/rename/rename.el 
b/rename_import/refactor/rename/rename.el
index ea6c744..d1741d5 100644
--- a/rename_import/refactor/rename/rename.el
+++ b/rename_import/refactor/rename/rename.el
@@ -65,12 +65,12 @@ the `gorename' tool. With FORCE, call `gorename' with the
 
       ;; On success, print the one-line result in the message bar,
       ;; and hide the *go-rename* buffer.
-      (let ((w (display-buffer (current-buffer))))
-        (if success
-            (progn
-              (message "%s" (go--buffer-string-no-trailing-space))
-              (delete-window w))
-          ;; failure
+      (if success
+          (progn
+            (message "%s" (go--buffer-string-no-trailing-space))
+            (gofmt--kill-error-buffer (current-buffer)))
+        ;; failure
+        (let ((w (display-buffer (current-buffer))))
           (message "gorename exited")
           (shrink-window-if-larger-than-buffer w)
           (set-window-point w (point-min)))))))

Reply via email to