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

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

[nongnu] elpa/go-mode 004575e 330/495: Don't leave godef buffer around


From: ELPA Syncer
Subject: [nongnu] elpa/go-mode 004575e 330/495: Don't leave godef buffer around
Date: Sat, 7 Aug 2021 09:05:42 -0400 (EDT)

branch: elpa/go-mode
commit 004575eb128ab01a11b4a4d278c544f91cf752fd
Author: Yutian Li <hotpxless@gmail.com>
Commit: Dominik Honnef <dominik@honnef.co>

    Don't leave godef buffer around
    
    Closes: gh-143 [via git-merge-pr]
---
 go-mode.el | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/go-mode.el b/go-mode.el
index 8acc0e1..cc6422b 100644
--- a/go-mode.el
+++ b/go-mode.el
@@ -1527,25 +1527,25 @@ description at POINT."
       (error "godef does not reliably work in XEmacs, expect bad results"))
   (if (not (buffer-file-name (go--coverage-origin-buffer)))
       (error "Cannot use godef on a buffer without a file name")
-    (let ((outbuf (get-buffer-create "*godef*"))
+    (let ((outbuf (generate-new-buffer "*godef*"))
           (coding-system-for-read 'utf-8)
           (coding-system-for-write 'utf-8))
-      (with-current-buffer outbuf
-        (erase-buffer))
-      (call-process-region (point-min)
-                           (point-max)
-                           godef-command
-                           nil
-                           outbuf
-                           nil
-                           "-i"
-                           "-t"
-                           "-f"
-                           (file-truename (buffer-file-name 
(go--coverage-origin-buffer)))
-                           "-o"
-                           (number-to-string (go--position-bytes point)))
-      (with-current-buffer outbuf
-        (split-string (buffer-substring-no-properties (point-min) (point-max)) 
"\n")))))
+      (prog2
+          (call-process-region (point-min)
+                               (point-max)
+                               godef-command
+                               nil
+                               outbuf
+                               nil
+                               "-i"
+                               "-t"
+                               "-f"
+                               (file-truename (buffer-file-name 
(go--coverage-origin-buffer)))
+                               "-o"
+                               (number-to-string (go--position-bytes point)))
+          (with-current-buffer outbuf
+            (split-string (buffer-substring-no-properties (point-min) 
(point-max)) "\n"))
+        (kill-buffer outbuf)))))
 
 (defun godef--successful-p (output)
   (not (or (string= "-" output)



reply via email to

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