Subject: bug#21947: closed (Re: bug#21947: 24.5; epa: option for always replace encrypted text without asking)

From: [email-masked] (GNU bug Tracking System)
Date: Thu, 19 Nov 2015 03:13:03 +0000

Your bug report

#21947: 24.5; epa: option for always replace encrypted text without asking

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
21947: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=21947
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#21947: 24.5; epa: option for always replace encrypted text without asking
From: Daiki Ueno <[email-masked]>
To: Christian Schwarzgruber <[email-masked]>
Cc: [email-masked]
Date: Thu, 19 Nov 2015 12:12:22 +0900
List-Id: <debbugs-submit.debbugs.gnu.org>

Christian Schwarzgruber <[email-masked]> writes:

> I made all the changes, hope I did it the way you guys want it (see
> inline patch).
>
> I tested all possible options, with `epa-decrypt-region', as well as
> epa-verify-region.

Thanks.  I have modified it a bit (to accept any symbol value for "ask")
and pushed it to the git master, assuming that the change is small
enough not to require copyright assignment.

Since this is a self-contained change, is it okay to push it to
emacs-25?

Regards,
-- 
Daiki Ueno

Subject: 24.5; epa: option for always replace encrypted text without asking
From: Christian Schwarzgruber <[email-masked]>
To: [email-masked]
Date: Tue, 17 Nov 2015 23:04:49 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Hey,

I would like to provide a patch for a new functionality in epa.el.

When I get a new encrypted email and I hit `C-c C-e d' (epa-mail-decrypt) epa
asks, if I want replace the original text. Which in my opinion is a bit
superfluous in this case. This will become especially unpleasant once the
auto-decrypt functionality is implemented in mu/mu4e.

So I patched epa.el and added a boolean `defcustom', when set to `t',
the text will always be replaced without asking.

Thank you for your attention!

- --
Christian Schwarzgruber
E: [email-masked]
GPG key ID: C57AB673
>From ce12716f1c2760fd356aadf0fffff118fd5643d9 Mon Sep 17 00:00:00 2001
From: Christian Schwarzgruber <[email-masked]>
Date: Sun, 15 Nov 2015 22:31:41 +0100
Subject: [PATCH] lisp/epa.el: add option to always replace original text

---
 lisp/epa.el | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/lisp/epa.el b/lisp/epa.el
index 9f112c4..af5688b 100644
--- a/lisp/epa.el
+++ b/lisp/epa.el
@@ -34,6 +34,11 @@ epa
   :link '(custom-manual "(epa) Top")
   :group 'epg)
 
+(defcustom epa-always-replace-original-text nil
+  "Always replace original text with decrypted."
+  :type 'boolean
+  :group 'epa)
+
 (defcustom epa-popup-info-window t
   "If non-nil, display status information from epa commands in another window."
   :type 'boolean
@@ -872,7 +877,8 @@ epa-decrypt-region
 	  (with-current-buffer (funcall make-buffer-function)
 	    (let ((inhibit-read-only t))
 	      (insert plain)))
-	(if (y-or-n-p "Replace the original text? ")
+	(if (or epa-always-replace-original-text
+		(y-or-n-p "Replace the original text? "))
 	    (let ((inhibit-read-only t))
 	      (delete-region start end)
 	      (goto-char start)
-- 
2.5.0