From: okada Date: Wed, 14 Apr 2004 06:45:07 +0000 (+0000) Subject: * mel-u.el (mime-write-decoded-region): Use make-temp-file. X-Git-Tag: flim-1_14_7~17 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=37072b50a75b6ba70085bf7b35d98457bd2361bc;p=elisp%2Fflim.git * mel-u.el (mime-write-decoded-region): Use make-temp-file. (mime-write-decoded-region): Ditto. --- diff --git a/ChangeLog b/ChangeLog index 2bb6eea..bbb00c4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2004-04-13 Kenichi Okada + + * mel-u.el (mime-write-decoded-region): Use make-temp-file. + (mime-write-decoded-region): Ditto. + 2004-04-12 Kenichi Okada * mel-u.el (mime-write-decoded-region): Use temporary filename. diff --git a/mel-u.el b/mel-u.el index e6612cd..9e37489 100644 --- a/mel-u.el +++ b/mel-u.el @@ -69,22 +69,22 @@ This function uses external uuencode decoder which is specified by variable `uuencode-external-decoder'." (interactive "*r") (save-excursion - (let ((filename (save-excursion - (save-restriction - (narrow-to-region start end) - (goto-char start) - (if (re-search-forward "^begin [0-9]+ " nil t) - (if (looking-at ".+$") - (buffer-substring (match-beginning 0) - (match-end 0))))))) - (default-directory temporary-file-directory)) - (if filename - (let ((coding-system-for-read 'binary) - (coding-system-for-write 'binary)) - (apply (function call-process-region) - start end (car uuencode-external-decoder) - t nil nil - (cdr uuencode-external-decoder)) + (let ((the-buf (current-buffer)) + (filename (make-temp-file "x-uue"))) + (save-excursion + (save-restriction + (set-mark end) + (narrow-to-region start end) + (goto-char start) + (when (and (re-search-forward "^begin [0-9]+ " nil t) + (looking-at ".+$")) + (replace-match filename) + (let ((coding-system-for-read 'binary) + (coding-system-for-write 'binary)) + (apply (function call-process-region) + start (mark) (car uuencode-external-decoder) + t nil nil + (cdr uuencode-external-decoder))) (insert-file-contents filename) ;; The previous line causes the buffer to be made read-only, I ;; do not pretend to understand the control flow leading to this @@ -92,7 +92,7 @@ variable `uuencode-external-decoder'." ;; Use `inhibit-read-only' to avoid to force ;; buffer-read-only nil. - tomo. (let ((inhibit-read-only t)) - (delete-file filename))))))) + (delete-file filename)))))))) (mel-define-method-function (mime-encode-region start end (nil "x-uue")) 'uuencode-external-encode-region) @@ -136,7 +136,7 @@ START and END are buffer positions." (save-excursion (let ((the-buf (current-buffer)) (clone-buf (clone-buffer " *x-uue*")) - (file (make-temp-name "x-uue"))) + (file (make-temp-file "x-uue"))) (save-excursion (save-restriction (set-buffer clone-buf) @@ -147,8 +147,7 @@ START and END are buffer positions." (looking-at ".+$")) (replace-match file) (let ((coding-system-for-read 'binary) - (coding-system-for-write 'binary) - (default-directory temporary-file-directory)) + (coding-system-for-write 'binary)) (apply (function call-process-region) (point-min) (point-max) (car uuencode-external-decoder) nil nil nil