From adb6ad2f0f841fbd143835196d5ab976d04695d8 Mon Sep 17 00:00:00 2001 From: ueno Date: Sat, 29 Apr 2006 22:16:10 +0000 Subject: [PATCH] Erase pgg-*-buffer. --- pgg-epg.el | 46 ++++++++++++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/pgg-epg.el b/pgg-epg.el index a6ede0e..6ca5e60 100644 --- a/pgg-epg.el +++ b/pgg-epg.el @@ -69,8 +69,11 @@ passphrase cache or user." (epg-context-set-armor context t) (epg-context-set-textmode context pgg-text-mode) (epg-context-set-passphrase-callback context #'pgg-epg-passphrase-callback) - (get-buffer-create pgg-output-buffer) - (get-buffer-create pgg-errors-buffer) + (save-excursion + (set-buffer (get-buffer-create pgg-output-buffer)) + (erase-buffer) + (set-buffer (get-buffer-create pgg-errors-buffer)) + (erase-buffer)) (condition-case error (setq cipher (epg-encrypt-string context @@ -90,7 +93,6 @@ passphrase cache or user." (signal (car error) (cdr error)))) (save-excursion (set-buffer (get-buffer-create pgg-output-buffer)) - (erase-buffer) (insert cipher)) t)) @@ -116,8 +118,11 @@ passphrase cache or user." (epg-context-set-armor context t) (epg-context-set-textmode context pgg-text-mode) (epg-context-set-passphrase-callback context #'pgg-epg-passphrase-callback) - (get-buffer-create pgg-output-buffer) - (get-buffer-create pgg-errors-buffer) + (save-excursion + (set-buffer (get-buffer-create pgg-output-buffer)) + (erase-buffer) + (set-buffer (get-buffer-create pgg-errors-buffer)) + (erase-buffer)) (condition-case error (setq plain (epg-decrypt-string context (buffer-substring start end)) pgg-epg-secret-key-id-list nil) @@ -128,7 +133,6 @@ passphrase cache or user." (signal (car error) (cdr error)))) (save-excursion (set-buffer (get-buffer-create pgg-output-buffer)) - (erase-buffer) (insert plain)) t)) @@ -145,8 +149,11 @@ passphrase cache or user." (epg-context-set-armor context t) (epg-context-set-textmode context pgg-text-mode) (epg-context-set-passphrase-callback context #'pgg-epg-passphrase-callback) - (get-buffer-create pgg-output-buffer) - (get-buffer-create pgg-errors-buffer) + (save-excursion + (set-buffer (get-buffer-create pgg-output-buffer)) + (erase-buffer) + (set-buffer (get-buffer-create pgg-errors-buffer)) + (erase-buffer)) (condition-case error (setq signature (epg-sign-string context @@ -162,7 +169,6 @@ passphrase cache or user." (signal (car error) (cdr error)))) (save-excursion (set-buffer (get-buffer-create pgg-output-buffer)) - (erase-buffer) (insert signature)) t)) @@ -176,8 +182,11 @@ Verify region between START and END as the detached signature SIGNATURE." (inhibit-redisplay t)) ;Gnus users don't like flickering (epg-context-set-armor context t) (epg-context-set-textmode context pgg-text-mode) - (get-buffer-create pgg-output-buffer) - (get-buffer-create pgg-errors-buffer) + (save-excursion + (set-buffer (get-buffer-create pgg-output-buffer)) + (erase-buffer) + (set-buffer (get-buffer-create pgg-errors-buffer)) + (erase-buffer)) (if signature (epg-verify-string context (with-temp-buffer @@ -189,7 +198,6 @@ Verify region between START and END as the detached signature SIGNATURE." (set-buffer (get-buffer-create pgg-errors-buffer)) (make-local-variable 'pgg-epg-signatures) (setq pgg-epg-signatures (epg-context-result-for context 'verify)) - (erase-buffer) (insert (epg-verify-result-to-string pgg-epg-signatures))) t)) @@ -202,8 +210,11 @@ Insert public key at point." ) (epg-context-set-armor context t) (epg-context-set-textmode context pgg-text-mode) - (get-buffer-create pgg-output-buffer) - (get-buffer-create pgg-errors-buffer) + (save-excursion + (set-buffer (get-buffer-create pgg-output-buffer)) + (erase-buffer) + (set-buffer (get-buffer-create pgg-errors-buffer)) + (erase-buffer)) (insert (epg-export-keys-to-string context pgg-default-user-id)))) (defun pgg-epg-snarf-keys-region (start end) @@ -215,8 +226,11 @@ Add all public keys in region between START and END to the keyring." ) (epg-context-set-armor context t) (epg-context-set-textmode context pgg-text-mode) - (get-buffer-create pgg-output-buffer) - (get-buffer-create pgg-errors-buffer) + (save-excursion + (set-buffer (get-buffer-create pgg-output-buffer)) + (erase-buffer) + (set-buffer (get-buffer-create pgg-errors-buffer)) + (erase-buffer)) (epg-import-keys-from-string context (buffer-substring start end)))) (eval-when-compile -- 1.7.10.4