From: ueno Date: Sun, 31 Dec 2006 02:25:24 +0000 (+0000) Subject: * epa.el (epa-decrypt-region): Confirm user to replace the region. X-Git-Tag: epg-0_0_10~53 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=79ce4804c09351bbc1ccc2a12f442d6d6c2a40d6;p=elisp%2Fepg.git * epa.el (epa-decrypt-region): Confirm user to replace the region. --- 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)))))))