diff options
| author | Jonas Bernoulli <jonas@bernoul.li> | 2022-06-05 22:36:26 +0200 |
|---|---|---|
| committer | Jonas Bernoulli <jonas@bernoul.li> | 2022-06-05 22:36:26 +0200 |
| commit | 7344bb67855278e3884e970b681c5aae09717920 (patch) | |
| tree | 0d6a847925ab04d0ee7de8358cae9393a5f507a8 /lisp | |
| parent | 4ab8c6148bb2698ff793d4a8acdbd8d0d642e133 (diff) | |
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.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/with-editor.el | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lisp/with-editor.el b/lisp/with-editor.el index 3db5404..0b9bcc4 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. |
