emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master ebad964: epa.el: Add option to replace original tex


From: Daiki Ueno
Subject: [Emacs-diffs] master ebad964: epa.el: Add option to replace original text
Date: Thu, 19 Nov 2015 02:03:38 +0000

branch: master
commit ebad964b3afbe5ef77085be94cf566836450c74c
Author: Christian Schwarzgruber <address@hidden>
Commit: Daiki Ueno <address@hidden>

    epa.el: Add option to replace original text
    
    * lisp/epa.el (epa-replace-original-text): New user option.
    (Bug#21947)
    
    Copyright-paperwork-exempt: yes
---
 lisp/epa.el |   19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/lisp/epa.el b/lisp/epa.el
index 9f112c4..e51d5d8 100644
--- a/lisp/epa.el
+++ b/lisp/epa.el
@@ -34,6 +34,17 @@
   :link '(custom-manual "(epa) Top")
   :group 'epg)
 
+(defcustom epa-replace-original-text 'ask
+  "Whether the original text shall be replaced by the decrypted.
+
+If t, replace the original text without any confirmation.
+If nil, don't replace the original text and show the result in a new buffer.
+If neither t nor nil, ask user for confirmation."
+  :type '(choice (const :tag "Never" nil)
+                (const :tag "Ask the user" 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 +883,9 @@ For example:
          (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 (eq epa-replace-original-text t)
+                (and epa-replace-original-text
+                     (y-or-n-p "Replace the original text? ")))
            (let ((inhibit-read-only t))
              (delete-region start end)
              (goto-char start)
@@ -968,7 +981,9 @@ For example:
                 (or coding-system-for-read
                     (get-text-property start 'epa-coding-system-used)
                     'undecided)))
-    (if (y-or-n-p "Replace the original text? ")
+    (if (or (eq epa-replace-original-text t)
+            (and epa-replace-original-text
+                 (y-or-n-p "Replace the original text? ")))
        (let ((inhibit-read-only t)
              buffer-read-only)
          (delete-region start end)



reply via email to

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