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

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

[nongnu] elpa/inf-clojure 6c719c6 197/313: Avoid leaking buffers from in


From: ELPA Syncer
Subject: [nongnu] elpa/inf-clojure 6c719c6 197/313: Avoid leaking buffers from inf-clojure--process-response
Date: Wed, 11 Aug 2021 10:00:15 -0400 (EDT)

branch: elpa/inf-clojure
commit 6c719c6e8bdaedf4f98888bcba31afe1989c9229
Author: Andrea Richiardi <a.richiardi.work@gmail.com>
Commit: Bozhidar Batsov <bozhidar.batsov@gmail.com>

    Avoid leaking buffers from inf-clojure--process-response
---
 inf-clojure.el | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/inf-clojure.el b/inf-clojure.el
index e9920f9..817147d 100644
--- a/inf-clojure.el
+++ b/inf-clojure.el
@@ -1220,25 +1220,25 @@ output from and including the `inf-clojure-prompt`."
         (sanitized-command (inf-clojure--sanitize-command command)))
     (when (not (string-empty-p sanitized-command))
       (inf-clojure--log-string command "----CMD->")
-      (set-buffer (inf-clojure--get-redirect-buffer))
-      (erase-buffer)
-      (comint-redirect-send-command-to-process sanitized-command 
redirect-buffer-name process nil t)
+      (with-current-buffer (inf-clojure--get-redirect-buffer)
+        (erase-buffer)
+        (comint-redirect-send-command-to-process sanitized-command 
redirect-buffer-name process nil t))
       ;; Wait for the process to complete
-      (set-buffer (process-buffer process))
-      (while (and (null comint-redirect-completed)
-                  (accept-process-output process 1 0 t))
-        (sleep-for 0.01))
+      (with-current-buffer (process-buffer process)
+        (while (and (null comint-redirect-completed)
+                    (accept-process-output process 1 0 t))
+          (sleep-for 0.01)))
       ;; Collect the output
-      (set-buffer redirect-buffer-name)
-      (goto-char (point-min))
-      (let* ((buffer-string (buffer-substring-no-properties (point-min) 
(point-max)))
-             (boundaries (inf-clojure--string-boundaries buffer-string 
inf-clojure-prompt beg-regexp end-regexp))
-             (beg-pos (car boundaries))
-             (end-pos (car (cdr boundaries)))
-             (prompt-pos (car (cdr (cdr boundaries))))
-             (response-string (substring buffer-string beg-pos (min end-pos 
prompt-pos))))
-        (inf-clojure--log-string buffer-string "<-RES----")
-        response-string))))
+      (with-current-buffer redirect-buffer-name
+        (goto-char (point-min))
+        (let* ((buffer-string (buffer-substring-no-properties (point-min) 
(point-max)))
+               (boundaries (inf-clojure--string-boundaries buffer-string 
inf-clojure-prompt beg-regexp end-regexp))
+               (beg-pos (car boundaries))
+               (end-pos (car (cdr boundaries)))
+               (prompt-pos (car (cdr (cdr boundaries))))
+               (response-string (substring buffer-string beg-pos (min end-pos 
prompt-pos))))
+          (inf-clojure--log-string buffer-string "<-RES----")
+          response-string)))))
 
 (defun inf-clojure--nil-string-match-p (string)
   "Return true iff STRING is not nil.



reply via email to

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