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

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

[nongnu] elpa/go-mode 3fdac08 233/495: use quit-window to hide the gofmt


From: ELPA Syncer
Subject: [nongnu] elpa/go-mode 3fdac08 233/495: use quit-window to hide the gofmt error window
Date: Sat, 7 Aug 2021 09:05:21 -0400 (EDT)

branch: elpa/go-mode
commit 3fdac0816abb5b71e7b2a8d079b87430bdf20fef
Author: Felix Lange <fjl@twurst.com>
Commit: Dominik Honnef <dominik@honnef.co>

    use quit-window to hide the gofmt error window
    
    gofmt pops up a window to display syntax error messages. When one fixes
    those errors and re-runs gofmt, the window shouldn't stay open. Note
    that quit-window will only delete the window if it was opened
    specifically for the *Gofmt Errors* buffer.
---
 AUTHORS    |  1 +
 go-mode.el | 10 ++++++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/AUTHORS b/AUTHORS
index 37c8d16..edea4ad 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -7,6 +7,7 @@ Charles Lee <zombie.fml@gmail.com>
 Dominik Honnef <dominikh@fork-bomb.org>
 Eric Eisner <eric.d.eisner@gmail.com>
 Evan Martin <evan.martin@gmail.com>
+Felix Lange <fjl@twurst.com>
 Florian Weimer <fw@deneb.enyo.de>
 Istvan Marko <mi-git@kismala.com>
 James Aguilar <jaguilar@google.com>
diff --git a/go-mode.el b/go-mode.el
index 09408a8..fad9e31 100644
--- a/go-mode.el
+++ b/go-mode.el
@@ -966,7 +966,7 @@ buffer."
                 (message "Buffer is already gofmted")
               (go--apply-rcs-patch patchbuf)
               (message "Applied gofmt"))
-            (if errbuf (kill-buffer errbuf)))
+            (if errbuf (gofmt--kill-error-buffer errbuf)))
         (message "Could not apply gofmt")
         (if errbuf (gofmt--process-errors (buffer-file-name) tmpfile errbuf)))
 
@@ -979,7 +979,7 @@ buffer."
     (if (eq gofmt-show-errors 'echo)
         (progn
           (message "%s" (buffer-string))
-          (kill-buffer errbuf))
+          (gofmt--kill-error-buffer errbuf))
       ;; Convert the gofmt stderr to something understood by the compilation 
mode.
       (goto-char (point-min))
       (insert "gofmt errors:\n")
@@ -988,6 +988,12 @@ buffer."
       (compilation-mode)
       (display-buffer errbuf))))
 
+(defun gofmt--kill-error-buffer (errbuf)
+  (let ((win (get-buffer-window errbuf)))
+    (if win
+        (quit-window t win)
+      (kill-buffer errbuf))))
+
 ;;;###autoload
 (defun gofmt-before-save ()
   "Add this to .emacs to run gofmt on the current buffer when saving:



reply via email to

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