+(defun uuencode-external-write-decoded-region (start end filename)
+ "Decode and write current region encoded by uuencode into FILENAME.
+START and END are buffer positions."
+ (interactive
+ (list (region-beginning) (region-end)
+ (read-file-name "Write decoded region to file: ")))
+ (save-excursion
+ (let ((file (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 mime-temp-directory))
+ (if file
+ (as-binary-process
+ (apply (function call-process-region)
+ start end (car uuencode-external-decoder)
+ nil nil nil (cdr uuencode-external-decoder))
+ (rename-file file filename 'overwrites)
+ )))))
+