From 40467ba8764589cd135e06e55607a7ce4fbefd18 Mon Sep 17 00:00:00 2001 From: ueno Date: Mon, 17 Apr 2006 05:50:24 +0000 Subject: [PATCH] Fixed. --- epa-file.el | 55 ++++++++++++++++++++++++++++++------------------------- 1 file changed, 30 insertions(+), 25 deletions(-) diff --git a/epa-file.el b/epa-file.el index 4c34b45..42f04c9 100644 --- a/epa-file.el +++ b/epa-file.el @@ -52,31 +52,36 @@ (defvar last-coding-system-used) (defun epa-find-file () (when (string-match epa-file-name-regexp (buffer-file-name)) - (when (file-exists-p (expand-file-name (buffer-file-name))) - (make-local-variable 'epa-file) - (make-local-variable 'epa-passphrase) - (if (fboundp 'set-buffer-multibyte) - (set-buffer-multibyte t)) - (goto-char (point-min)) - (let ((context (epg-make-context))) - (epg-context-set-passphrase-callback - context - (cons #'epa-file-passphrase-callback-function - (current-buffer))) - (insert (epg-decrypt-file context - (expand-file-name (buffer-file-name)) - nil))) - (delete-region (point) (point-max)) - (decode-coding-region (point-min) (point-max) 'undecided) - (if (boundp 'last-coding-system-used) - (set-buffer-file-coding-system last-coding-system-used) - (set-buffer-file-coding-system default-buffer-file-coding-system)) - (set-auto-mode) - (hack-local-variables) - (auto-save-mode nil) - (set-buffer-modified-p nil) - (setq buffer-undo-list nil - epa-file (buffer-file-name))))) + (if (file-exists-p (expand-file-name (buffer-file-name))) + (let ((context (epg-make-context)) + passphrase) + (if (fboundp 'set-buffer-multibyte) + (set-buffer-multibyte t)) + (goto-char (point-min)) + (epg-context-set-passphrase-callback + context + (cons #'epa-file-passphrase-callback-function + (current-buffer))) + (make-local-variable 'epa-passphrase) + (insert (epg-decrypt-file context + (expand-file-name (buffer-file-name)) + nil)) + (setq passphrase epa-passphrase) + (delete-region (point) (point-max)) + (decode-coding-region (point-min) (point-max) 'undecided) + (if (boundp 'last-coding-system-used) + (set-buffer-file-coding-system last-coding-system-used) + (set-buffer-file-coding-system default-buffer-file-coding-system)) + (set-auto-mode) + (hack-local-variables) + (auto-save-mode nil) + (set-buffer-modified-p nil) + (setq buffer-undo-list nil) + (make-local-variable 'epa-passphrase) + (setq epa-passphrase passphrase))) + (make-local-variable 'epa-file) + (setq epa-file (buffer-file-name)) + (make-local-variable 'epa-passphrase))) (defun epa-write-file () (when epa-file -- 1.7.10.4