- (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 mime-temp-directory))
- (if filename
- (as-binary-process
- (apply (function call-process-region)
- start end (car uuencode-external-decoder)
- t nil nil (cdr uuencode-external-decoder))
- (as-binary-input-file (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
- ;; but suspect it has something to do with image-mode. -slb
- ;; Use `inhibit-read-only' to avoid to force
- ;; buffer-read-only nil. - tomo.
- (let ((inhibit-read-only t))
- (delete-file filename)
- )
- ))
- )))
+ (let ((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
+ ;; but suspect it has something to do with image-mode. -slb
+ ;; Use `inhibit-read-only' to avoid to force
+ ;; buffer-read-only nil. - tomo.
+ (let ((inhibit-read-only t))
+ (delete-file filename))))))))