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

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

[nongnu] elpa/with-editor 7b8520b 096/140: with-editor-kill-buffer-noop:


From: Jonas Bernoulli
Subject: [nongnu] elpa/with-editor 7b8520b 096/140: with-editor-kill-buffer-noop: When killing Emacs silently cancel
Date: Fri, 6 Aug 2021 12:51:27 -0400 (EDT)

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

    with-editor-kill-buffer-noop: When killing Emacs silently cancel
    
    Closes #64.
---
 with-editor.el | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/with-editor.el b/with-editor.el
index 80929d5..bbbf3ad 100644
--- a/with-editor.el
+++ b/with-editor.el
@@ -1,6 +1,6 @@
 ;;; with-editor.el --- Use the Emacsclient as $EDITOR -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 2014-2018  The Magit Project Contributors
+;; Copyright (C) 2014-2019  The Magit Project Contributors
 ;;
 ;; You should have received a copy of the AUTHORS.md file.  If not,
 ;; see https://github.com/magit/with-editor/blob/master/AUTHORS.md.
@@ -432,8 +432,13 @@ And some tools that do not handle $EDITOR properly also 
break."
 (put 'with-editor-mode 'permanent-local t)
 
 (defun with-editor-kill-buffer-noop ()
-  (user-error (substitute-command-keys "\
-Don't kill this buffer.  Instead cancel using \\[with-editor-cancel]")))
+  (if (memq this-command '(save-buffers-kill-terminal
+                           save-buffers-kill-emacs))
+      (let ((run-hook-with-args-until-failure nil))
+        (with-editor-cancel nil)
+        t)
+    (user-error (substitute-command-keys "\
+Don't kill this buffer.  Instead cancel using \\[with-editor-cancel]"))))
 
 (defun with-editor-usage-message ()
   ;; Run after `server-execute', which is run using



reply via email to

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