* mm-decode.el (mm-save-part-to-file): Use `mm-write-region' instead of
authorDaiki Ueno <ueno@unixuser.org>
Mon, 22 Jan 2007 01:01:21 +0000 (01:01 +0000)
committerDaiki Ueno <ueno@unixuser.org>
Mon, 22 Jan 2007 01:01:21 +0000 (01:01 +0000)
`write-region' to respect `mm-inhibit-file-name-handlers'.

lisp/ChangeLog
lisp/mm-decode.el

index f28ec98..6c165b3 100644 (file)
@@ -1,3 +1,8 @@
+2007-01-22  Daiki Ueno  <ueno@unixuser.org>
+
+       * mm-decode.el (mm-save-part-to-file): Use `mm-write-region' instead of
+       `write-region' to respect `mm-inhibit-file-name-handlers'.
+
 2007-01-17  Teodor Zlatanov  <tzz@lifelogs.com>
 
        * encrypt.el (encrypt-insert-file-contents): Add better prompt
index e9ca1d4..c33dbec 100644 (file)
@@ -1210,17 +1210,13 @@ PROMPT overrides the default one used to ask user for a file name."
 (defun mm-save-part-to-file (handle file)
   (mm-with-unibyte-buffer
     (mm-insert-part handle)
-    (let ((coding-system-for-write 'binary)
-         (current-file-modes (default-file-modes))
+    (let ((current-file-modes (default-file-modes)))
+      (set-default-file-modes mm-attachment-file-modes)
+      (unwind-protect
          ;; Don't re-compress .gz & al.  Arguably we should make
          ;; `file-name-handler-alist' nil, but that would chop
          ;; ange-ftp, which is reasonable to use here.
-         (inhibit-file-name-operation 'write-region)
-         (inhibit-file-name-handlers
-          (cons 'jka-compr-handler inhibit-file-name-handlers)))
-      (set-default-file-modes mm-attachment-file-modes)
-      (unwind-protect
-         (write-region (point-min) (point-max) file)
+         (mm-write-region (point-min) (point-max) file nil nil nil 'binary t)
        (set-default-file-modes current-file-modes)))))
 
 (defun mm-pipe-part (handle)