* epa-file.el (epa-file-write-region): Set a dummy filename
authorueno <ueno>
Fri, 2 Feb 2007 09:51:18 +0000 (09:51 +0000)
committerueno <ueno>
Fri, 2 Feb 2007 09:51:18 +0000 (09:51 +0000)
for buffer-file-name when calling select-safe-coding-system.

ChangeLog
epa-file.el

index 7de5ecc..cc7a34a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2007-02-02  Daiki Ueno  <ueno@unixuser.org>
+
+       * epa-file.el (epa-file-write-region): Set a dummy filename
+       for buffer-file-name when calling select-safe-coding-system.
+
 2007-01-30  Daiki Ueno  <ueno@unixuser.org>
 
        * epg.el (epg-last-status): New variable.
index 1f939c1..0e40924 100644 (file)
@@ -165,8 +165,13 @@ May either be a string or a list of strings.")
   (setq file (expand-file-name file))
   (let* ((coding-system (or coding-system-for-write
                            (if (fboundp 'select-safe-coding-system)
-                               (select-safe-coding-system
-                                (point-min) (point-max))
+                               ;; This is needed since Emacs 22 has
+                               ;; no-conversion setting for *.gpg in
+                               ;; `auto-coding-alist'.
+                               (let ((buffer-file-name
+                                      (file-name-sans-extension file)))
+                                 (select-safe-coding-system
+                                  (point-min) (point-max)))
                              buffer-file-coding-system)))
         (context (epg-make-context))
         (coding-system-for-write 'binary)