From 79ce4804c09351bbc1ccc2a12f442d6d6c2a40d6 Mon Sep 17 00:00:00 2001 From: ueno Date: Sun, 31 Dec 2006 02:25:24 +0000 Subject: [PATCH] * epa.el (epa-decrypt-region): Confirm user to replace the region. --- ChangeLog | 1 + epa.el | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0dcf182..c423628 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,7 @@ (epa-encrypt): New command. (epa-import-armor-in-region): New command. (epa-import): New command. + (epa-decrypt-region): Confirm user to replace the region. 2006-12-29 Daiki Ueno diff --git a/epa.el b/epa.el index 6c48380..39ad100 100644 --- a/epa.el +++ b/epa.el @@ -743,12 +743,18 @@ Don't use this command in Lisp programs!" (message "Decrypting...") (setq plain (epg-decrypt-string context (buffer-substring start end))) (message "Decrypting...done") - (delete-region start end) - (goto-char start) - (insert (epa--decode-coding-string plain - (or coding-system-for-read - (get-text-property - start 'epa-coding-system-used)))) + (setq plain (epa--decode-coding-string + plain + (or coding-system-for-read + (get-text-property start 'epa-coding-system-used)))) + (if (y-or-n-p "Replace the text in the region? ") + (let ((inhibit-read-only t) + buffer-read-only) + (delete-region start end) + (goto-char start) + (insert plain)) + (let ((epa-popup-info-window t)) + (epa-display-info plain))) (if (epg-context-result-for context 'verify) (epa-display-info (epg-verify-result-to-string (epg-context-result-for context 'verify))))))) -- 1.7.10.4