From a435a82ee2ae8ce526c53aa18b9e92e2ff9da22b Mon Sep 17 00:00:00 2001 From: ueno Date: Sun, 10 Sep 2006 02:41:36 +0000 Subject: [PATCH] * epa-file.el (epa-file-insert-file-contents): Use decode-coding-inserted-region if available. --- ChangeLog | 5 +++++ epa-file.el | 15 +++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2118027..93107b0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-09-10 Daiki Ueno + + * epa-file.el (epa-file-insert-file-contents): Use + decode-coding-inserted-region if available. + 2006-09-05 Hiroya Murata * epg-config.el (epg-configuration): Fixed the last change; diff --git a/epa-file.el b/epa-file.el index 4a59d8d..d02e789 100644 --- a/epa-file.el +++ b/epa-file.el @@ -98,14 +98,21 @@ (cons "Opening input file" (cdr error))))) (if (or beg end) (setq string (substring string (or beg 0) end))) - (setq string - (decode-coding-string string - (or coding-system-for-read '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)) (save-excursion - (insert string) + (if (and (null coding-system-for-read) + (fboundp 'decode-coding-inserted-region)) + (save-restriction + (narrow-to-region (point) (point)) + (insert string) + (decode-coding-inserted-region + (point-min) (point-max) + (substring file 0 (string-match epa-file-name-regexp file)) + visit beg end replace)) + (insert (decode-coding-string string (or coding-system-for-read + 'undecided)))) (setq length (length string)) (if replace (delete-region (point) (point-max))))) -- 1.7.10.4