GNU bug report logs - #21947
24.5; epa: option for always replace encrypted text without asking

Previous Next

Package: emacs;

Reported by: Christian Schwarzgruber <c.schwarzgruber.cs <at> gmail.com>

Date: Tue, 17 Nov 2015 22:18:02 UTC

Severity: wishlist

Tags: patch

Found in version 24.5

Done: Daiki Ueno <ueno <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 21947 in the body.
You can then email your comments to 21947 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#21947; Package emacs. (Tue, 17 Nov 2015 22:18:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Christian Schwarzgruber <c.schwarzgruber.cs <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 17 Nov 2015 22:18:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Christian Schwarzgruber <c.schwarzgruber.cs <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.5; epa: option for always replace encrypted text without asking
Date: Tue, 17 Nov 2015 23:04:49 +0100
[Message part 1 (text/plain, inline)]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

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: c.schwarzgruber.cs <at> gmail.com
GPG key ID: C57AB673
[0001-lisp-epa.el-add-option-to-always-replace-original-te.patch (text/x-patch, inline)]
From ce12716f1c2760fd356aadf0fffff118fd5643d9 Mon Sep 17 00:00:00 2001
From: Christian Schwarzgruber <c.schwarzgruber.cs <at> gmail.com>
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

[Message part 3 (text/plain, inline)]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJWS6R9AAoJEJpBtqnFerZzEHcP/jbW5atRNXOoZ7QYrt+p8EJA
xeVUdVEBXmsbCp+lRcMSSrrMG84/cZQF2zgjOQd/zqcW4S3L7KU4d/NdCk2Sr5vL
wDZwIn61W6mTVDsrOUcwVZOACeunin4ODCO7yeGQcnzI/+hEOEzGHBEVViwCHTYL
RNdzsQZq6RSR4y7HTqVziuGWwknESqhNx4CzUSnfwkB5EgPgAHRjCF4kT39ujqGS
xnIQvs1zt3emNcgRJ/Vga1awKEeroC0dsvKCWYFvQIJghExyyKZWdl07oFUq5U8f
J0LybrVBwPIXcu91v40aeOplZv00A+KfUJnk0drqC54xZ8CGTuep0qLTCi4z5vyQ
ITbOtkB95Ps/9b9JOh4ZgET2pn7aQADfs+sBJ8nykCxF41d93tlXrWFbAGLVPuh0
ayYOl/MX1hi9dexacAA6FcjERuLwwiHXwQ18Y/OGuYBhGh4khmNOWsvJrHDpDOLx
Wre9Xaw9lfVg4KkOW8Eqha1xJItHiTo6V0jSBXM7jhjqAMlXCbLZ201yQaarRPPw
+227tLhuSAPCWxhcHF3+uB/jnXj97PElTiEQh9fzqAOm8dv2UueHg7HyK5REUDCr
8r+JL1lxoaubupvWA1sQfoWYOLDiIMZQ2zf6KbzsxIrwM+tSdCjivCJtvzBrHMrw
zUzgtTS3KbzW6bo1E061
=CPhT
-----END PGP SIGNATURE-----

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21947; Package emacs. (Wed, 18 Nov 2015 02:06:01 GMT) Full text and rfc822 format available.

Message #8 received at 21947 <at> debbugs.gnu.org (full text, mbox):

From: Daiki Ueno <ueno <at> gnu.org>
To: Christian Schwarzgruber <c.schwarzgruber.cs <at> gmail.com>
Cc: 21947 <at> debbugs.gnu.org
Subject: Re: bug#21947: 24.5;
 epa: option for always replace encrypted text without asking
Date: Wed, 18 Nov 2015 11:05:17 +0900
Christian Schwarzgruber <c.schwarzgruber.cs <at> gmail.com> writes:

> 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.

That sounds reasonable.

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

I tend to make this a choice of three: never (nil), ask (a symbol),
always (t).  Would that make sense?

Also please adjust `epa-verify-region' as well.

Regards,
-- 
Daiki Ueno




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21947; Package emacs. (Wed, 18 Nov 2015 21:41:02 GMT) Full text and rfc822 format available.

Message #11 received at 21947 <at> debbugs.gnu.org (full text, mbox):

From: Christian Schwarzgruber <c.schwarzgruber.cs <at> gmail.com>
To: Daiki Ueno <ueno <at> gnu.org>
Cc: 21947 <at> debbugs.gnu.org
Subject: Re: bug#21947: 24.5;
 epa: option for always replace encrypted text without asking
Date: Wed, 18 Nov 2015 22:39:43 +0100
[Message part 1 (text/plain, inline)]
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.

Daiki Ueno <ueno <at> gnu.org> writes:

> Christian Schwarzgruber <c.schwarzgruber.cs <at> gmail.com> writes:
>
>> 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.
>
> That sounds reasonable.
>
>> So I patched epa.el and added a boolean `defcustom', when set to `t',
>> the text will always be replaced without asking.
>
> I tend to make this a choice of three: never (nil), ask (a symbol),
> always (t).  Would that make sense?
>
> Also please adjust `epa-verify-region' as well.
>
> Regards,

Regards,
--
Christian Schwarzgruber
[0001-lisp-epa.el-add-defcustom-to-replace-original-text.patch (text/x-patch, inline)]
From 9041f5bbe05cbf28dafdfb31f6f731e9ea7e023c Mon Sep 17 00:00:00 2001
From: Christian Schwarzgruber <c.schwarzgruber.cs <at> gmail.com>
Date: Sun, 15 Nov 2015 22:31:41 +0100
Subject: [PATCH] lisp/epa.el: add `defcustom' to replace original text

Possible options are: `ask', `always', `never'. Default is `ask'.
---
 lisp/epa.el | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/lisp/epa.el b/lisp/epa.el
index 9f112c4..794fa5f 100644
--- a/lisp/epa.el
+++ b/lisp/epa.el
@@ -34,6 +34,15 @@ epa
   :link '(custom-manual "(epa) Top")
   :group 'epg)
 
+(defcustom epa-replace-original-text 'ask
+  "Whether the original text shall be replaced by the decrypted.
+
+Possible options are: `never', `ask' and `always'."
+  :type '(choice (const :tag "never" nil)
+		 (const ask)
+		 (const :tag "always" t))
+  :group 'epa)
+
 (defcustom epa-popup-info-window t
   "If non-nil, display status information from epa commands in another window."
   :type 'boolean
@@ -872,7 +881,11 @@ 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 (cond
+	     ((eq 'ask epa-replace-original-text)
+	      (y-or-n-p "Replace the original text? "))
+	     ((null epa-replace-original-text) nil)
+	     (t t))
 	    (let ((inhibit-read-only t))
 	      (delete-region start end)
 	      (goto-char start)
@@ -968,7 +981,11 @@ epa-verify-region
 		 (or coding-system-for-read
 		     (get-text-property start 'epa-coding-system-used)
 		     'undecided)))
-    (if (y-or-n-p "Replace the original text? ")
+    (if (cond
+	 ((eq 'ask epa-replace-original-text)
+	  (y-or-n-p "Replace the original text? "))
+	 ((null epa-replace-original-text) nil)
+	 (t t))
 	(let ((inhibit-read-only t)
 	      buffer-read-only)
 	  (delete-region start end)
-- 
2.5.0


Reply sent to Daiki Ueno <ueno <at> gnu.org>:
You have taken responsibility. (Thu, 19 Nov 2015 03:13:02 GMT) Full text and rfc822 format available.

Notification sent to Christian Schwarzgruber <c.schwarzgruber.cs <at> gmail.com>:
bug acknowledged by developer. (Thu, 19 Nov 2015 03:13:03 GMT) Full text and rfc822 format available.

Message #16 received at 21947-done <at> debbugs.gnu.org (full text, mbox):

From: Daiki Ueno <ueno <at> gnu.org>
To: Christian Schwarzgruber <c.schwarzgruber.cs <at> gmail.com>
Cc: 21947-done <at> debbugs.gnu.org
Subject: Re: bug#21947: 24.5;
 epa: option for always replace encrypted text without asking
Date: Thu, 19 Nov 2015 12:12:22 +0900
Christian Schwarzgruber <c.schwarzgruber.cs <at> gmail.com> 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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21947; Package emacs. (Thu, 19 Nov 2015 07:54:02 GMT) Full text and rfc822 format available.

Message #19 received at 21947-done <at> debbugs.gnu.org (full text, mbox):

From: Christian Schwarzgruber <c.schwarzgruber.cs <at> gmail.com>
To: Daiki Ueno <ueno <at> gnu.org>
Cc: 21947-done <at> debbugs.gnu.org
Subject: Re: bug#21947: 24.5;
 epa: option for always replace encrypted text without asking
Date: Thu, 19 Nov 2015 08:53:32 +0100
Daiki Ueno <ueno <at> gnu.org> writes:

> 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.

I Took a look at the changes you made, thanks! I just have started learning
emacs lisp.
I haven't made any paper work so far. If it is required please let me know it
and I will fill out the copyright assignment and send it to the FSF.

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

Hmmmm, I'm still using emacs 24.5.1 (Fedora), but I can patch it my self until
emacs-25 lands in Fedora, this should be, hopefully, quite soon (Assuming
emacs-25 is officially released).

Regards,
--
Christian Schwarzgruber




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 17 Dec 2015 12:24:03 GMT) Full text and rfc822 format available.

bug unarchived. Request was from Christian Schwarzgruber <c.schwarzgruber.cs <at> gmail.com> to control <at> debbugs.gnu.org. (Thu, 06 Apr 2017 21:11:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21947; Package emacs. (Thu, 06 Apr 2017 21:18:02 GMT) Full text and rfc822 format available.

Message #26 received at 21947-done <at> debbugs.gnu.org (full text, mbox):

From: Christian Schwarzgruber <c.schwarzgruber.cs <at> gmail.com>
To: Daiki Ueno <ueno <at> gnu.org>
Cc: 21947-done <at> debbugs.gnu.org
Subject: Re: bug#21947: 24.5;
 epa: option for always replace encrypted text without asking
Date: Thu, 06 Apr 2017 23:17:03 +0200
Hey,

my bug report has been closed quite a while back now. The provided patch has
been landed in Emacs (master). Will this patch make it into Emacs 25.3, maybe?

Thank you for your attention!

Christian Schwarzgruber

Daiki Ueno <ueno <at> gnu.org> writes:

> Christian Schwarzgruber <c.schwarzgruber.cs <at> gmail.com> 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,




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21947; Package emacs. (Thu, 06 Apr 2017 22:12:01 GMT) Full text and rfc822 format available.

Message #29 received at 21947 <at> debbugs.gnu.org (full text, mbox):

From: npostavs <at> users.sourceforge.net
To: Christian Schwarzgruber <c.schwarzgruber.cs <at> gmail.com>
Cc: 21947 <at> debbugs.gnu.org, Daiki Ueno <ueno <at> gnu.org>
Subject: Re: bug#21947: 24.5;
 epa: option for always replace encrypted text without asking
Date: Thu, 06 Apr 2017 18:12:27 -0400
Christian Schwarzgruber <c.schwarzgruber.cs <at> gmail.com> writes:
>
> my bug report has been closed quite a while back now. The provided patch has
> been landed in Emacs (master). Will this patch make it into Emacs 25.3, maybe?

Hard to say before there has even been a decision about whether to
release 25.3 at all.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21947; Package emacs. (Fri, 07 Apr 2017 09:49:02 GMT) Full text and rfc822 format available.

Message #32 received at 21947 <at> debbugs.gnu.org (full text, mbox):

From: Christian Schwarzgruber <c.schwarzgruber.cs <at> gmail.com>
To: 21947 <at> debbugs.gnu.org
Cc: Daiki Ueno <ueno <at> gnu.org>, npostavs <at> users.sourceforge.net
Subject: Re: bug#21947: 24.5;
 epa: option for always replace encrypted text without asking
Date: Fri, 07 Apr 2017 11:48:40 +0200
Ok, just wanted to make sure it has not been lost.

Thanks!

Christian Schwarzgruber

npostavs <at> users.sourceforge.net writes:

> Christian Schwarzgruber <c.schwarzgruber.cs <at> gmail.com> writes:
>>
>> my bug report has been closed quite a while back now. The provided patch has
>> been landed in Emacs (master). Will this patch make it into Emacs 25.3, maybe?
>
> Hard to say before there has even been a decision about whether to
> release 25.3 at all.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 05 May 2017 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 8 years and 47 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.