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

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

[nongnu] elpa/go-mode b1bb0e0 111/495: replace shell-command-on-region w


From: ELPA Syncer
Subject: [nongnu] elpa/go-mode b1bb0e0 111/495: replace shell-command-on-region with call-process-region
Date: Sat, 7 Aug 2021 09:04:54 -0400 (EDT)

branch: elpa/go-mode
commit b1bb0e04cca9a8c5a1cce4e0d326680e853eaae8
Author: Dominik Honnef <dominikh@fork-bomb.org>
Commit: Dominik Honnef <dominikh@fork-bomb.org>

    replace shell-command-on-region with call-process-region
    
    shell-command-on-region sometimes prints process output in the echo
    area. We do not want this.
---
 go-mode.el | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/go-mode.el b/go-mode.el
index 983bf9b..e4ecc88 100644
--- a/go-mode.el
+++ b/go-mode.el
@@ -423,9 +423,13 @@ recommended that you look at goflymake
       (erase-buffer))
 
     (write-region nil nil tmpfile)
-    (if (zerop (shell-command (concat "gofmt -w " (shell-quote-argument 
tmpfile)) nil errbuf))
+
+    ;; We're using errbuf for the mixed stdout and stderr output. This
+    ;; is not an issue because gofmt -w does not produce any stdout
+    ;; output in case of success.
+    (if (zerop (call-process "gofmt" nil errbuf nil "-w" tmpfile))
         (progn
-          (if (zerop (shell-command-on-region (point-min) (point-max) (concat 
"diff -n - " (shell-quote-argument tmpfile)) patchbuf))
+          (if (zerop (call-process-region (point-min) (point-max) "diff" nil 
patchbuf nil "-n" "-" tmpfile))
               (message "Buffer is already gofmted")
             (go--apply-rcs-patch patchbuf)
             (kill-buffer errbuf)



reply via email to

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