From: ueno Date: Tue, 20 Mar 2007 08:33:18 +0000 (+0000) Subject: (epa-display-info): Generate new *Info* buffer if buffer X-Git-Tag: epg-0_0_11~54 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=3bfd46a3a01ba562bb6c901f521cb14e9ee217d5;p=elisp%2Fepg.git (epa-display-info): Generate new *Info* buffer if buffer is not alive. (epa-verify-cleartext-in-region): s/armor/cleartext/g. --- diff --git a/ChangeLog b/ChangeLog index e5681b0..a2a5b48 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2007-03-20 Daiki Ueno + * epa.el (epa-display-info): Generate new *Info* buffer if buffer + is not alive. + (epa-verify-cleartext-in-region): s/armor/cleartext/g. + * Makefile.am (info_TEXINFOS): Added epa.texi. * epa.texi: New file. diff --git a/epa.el b/epa.el index 85421f2..66e0d3a 100644 --- a/epa.el +++ b/epa.el @@ -561,7 +561,7 @@ If SECRET is non-nil, list secret keys instead of public keys." (defun epa-display-info (info) (if epa-popup-info-window (save-selected-window - (unless epa-info-buffer + (unless (and epa-info-buffer (buffer-live-p epa-info-buffer)) (setq epa-info-buffer (generate-new-buffer "*Info*"))) (if (get-buffer-window epa-info-buffer) (delete-window (get-buffer-window epa-info-buffer))) @@ -819,16 +819,28 @@ Don't use this command in Lisp programs!" Don't use this command in Lisp programs!" (interactive "r") - (let ((context (epg-make-context epa-protocol))) + (let ((context (epg-make-context epa-protocol)) + plain) (epg-context-set-progress-callback context #'epa-progress-callback-function "Verifying...") - (epg-verify-string context - (epa--encode-coding-string - (buffer-substring start end) - (or coding-system-for-write - (get-text-property start - 'epa-coding-system-used)))) + (setq plain (epg-verify-string + context + (epa--encode-coding-string + (buffer-substring start end) + (or coding-system-for-write + (get-text-property start + 'epa-coding-system-used))))) + (if (y-or-n-p "Replace the original text? ") + (let ((inhibit-read-only t) + buffer-read-only) + (delete-region start end) + (goto-char start) + (insert plain)) + (with-output-to-temp-buffer "*Temp*" + (set-buffer standard-output) + (insert plain) + (epa-info-mode))) (if (epg-context-result-for context 'verify) (epa-display-info (epg-verify-result-to-string (epg-context-result-for context 'verify)))))) @@ -844,19 +856,19 @@ Don't use this command in Lisp programs!" (save-restriction (narrow-to-region start end) (goto-char start) - (let (armor-start armor-end) + (let (cleartext-start cleartext-end) (while (re-search-forward "-----BEGIN PGP SIGNED MESSAGE-----$" nil t) - (setq armor-start (match-beginning 0)) + (setq cleartext-start (match-beginning 0)) (unless (re-search-forward "^-----BEGIN PGP SIGNATURE-----$" nil t) (error "Invalid cleartext signed message")) - (setq armor-end (re-search-forward + (setq cleartext-end (re-search-forward "^-----END PGP SIGNATURE-----$" nil t)) - (unless armor-end - (error "No armor tail")) - (epa-verify-region armor-start armor-end)))))) + (unless cleartext-end + (error "No cleartext tail")) + (epa-verify-region cleartext-start cleartext-end)))))) (if (fboundp 'select-safe-coding-system) (defalias 'epa--select-safe-coding-system 'select-safe-coding-system)