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

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

[nongnu] elpa/with-editor 7344bb6785: with-editor-return: Make sure proc


From: ELPA Syncer
Subject: [nongnu] elpa/with-editor 7344bb6785: with-editor-return: Make sure process buffer is killed
Date: Tue, 7 Jun 2022 07:59:00 -0400 (EDT)

branch: elpa/with-editor
commit 7344bb67855278e3884e970b681c5aae09717920
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>

    with-editor-return: Make sure process buffer is killed
    
    If there is a client but it is not live anymore, likely because
    an error occurred while responding to the edit request, then
    `server-delete-client' will never be called, while we relied on
    that killing the buffer.
---
 lisp/with-editor.el | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/lisp/with-editor.el b/lisp/with-editor.el
index 3db54042aa..0b9bcc421f 100644
--- a/lisp/with-editor.el
+++ b/lisp/with-editor.el
@@ -366,10 +366,14 @@ And some tools that do not handle $EDITOR properly also 
break."
     (cond (cancel
            (save-buffer)
            (if clients
-               (dolist (client clients)
-                 (ignore-errors
-                   (server-send-string client "-error Canceled by user"))
-                 (delete-process client))
+               (let ((buf (current-buffer)))
+                 (dolist (client clients)
+                   (message "client %S" client)
+                   (ignore-errors
+                     (server-send-string client "-error Canceled by user"))
+                   (delete-process client))
+                 (when (buffer-live-p buf)
+                   (kill-buffer buf)))
              ;; Fallback for when emacs was used as $EDITOR
              ;; instead of emacsclient or the sleeping editor.
              ;; See https://github.com/magit/magit/issues/2258.



reply via email to

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