2 ;;; $Id: tm-comp.el,v 1.1 1994/08/21 22:00:44 morioka Exp morioka $
7 (defvar mime/message-max-length 1000)
8 (defvar mime/message-sender-alist
9 '((mail-mode . sendmail-send-it)
10 (mh-letter-mode . (lambda ()
11 (write-region (point-min) (point-max)
14 (expand-file-name mh-send-prog mh-progs)
15 nil nil nil mime/draft-file-name)
17 (news-reply-mode . gnus-inews-article)
19 (defvar mime/window-config-alist
21 (mh-letter-mode . mh-previous-window-config)
22 (news-reply-mode . (prog1
23 gnus-winconf-post-news
24 (setq gnus-winconf-post-news nil)
28 (defun mime/split-and-send (&optional cmd)
31 (setq cmd (cdr (assq major-mode mime/message-sender-alist)))
33 (let ((mime/draft-file-name (buffer-file-name))
34 (lines (count-lines (point-min)(point-max)))
35 (separator mail-header-separator)
36 (config (eval (cdr (assq major-mode mime/window-config-alist))))
38 (if (null mime/draft-file-name)
39 (setq mime/draft-file-name "/tmp/tm-draft")
42 (if (<= lines mime/message-max-length)
44 (let ((header (message/get-header-string-except
45 "^Content-" separator))
47 (replace-space-with-underline (current-time-string))
48 "@" (system-name) "\""))
50 (goto-char (point-min))
51 (if (re-search-forward (concat "^" (regexp-quote separator) "$")
55 (let* ((total (+ (/ lines mime/message-max-length)
56 (if (> (mod lines mime/message-max-length) 0)
58 (i 0)(l mime/message-max-length)
59 (the-buf (current-buffer))
60 (buf (get-buffer "*tmp-send*"))
64 (switch-to-buffer buf)
66 (switch-to-buffer the-buf)
68 (setq buf (get-buffer-create "*tmp-send*"))
70 (switch-to-buffer buf)
71 (make-variable-buffer-local 'mail-header-separator)
72 (setq mail-header-separator separator)
73 (switch-to-buffer the-buf)
74 (goto-char (point-min))
76 (setq buf (get-buffer "*tmp-send*"))
78 (setq data (buffer-substring
84 (switch-to-buffer buf)
88 "Content-Type: message/partial; id=%s; number=%d; total=%d\n%s\n"
89 id (+ i 1) total separator))
93 (switch-to-buffer the-buf)
94 (setq l (+ l mime/message-max-length))
98 (set-buffer-modified-p nil)
99 (kill-buffer (current-buffer))
101 (set-window-configuration config)
105 (add-hook 'mime-mode-hook
108 (if (not (fboundp 'default-mime-mode-exit-and-run))
110 (make-variable-buffer-local 'mime/send-message-method)
111 (fset 'default-mime-mode-exit-and-run
112 'mime-mode-exit-and-run)
113 (fset 'mime-mode-exit-and-run
114 'mime/split-and-send)
117 (defun message/get-header-string-except (pat boundary)
120 (narrow-to-region (goto-char (point-min))
122 (re-search-forward boundary nil t)
125 (goto-char (point-min))
127 (while (re-search-forward message/field-regexp nil t)
128 (setq field (buffer-substring (match-beginning 0)
131 (if (not (string-match pat field))
132 (setq header (concat header field "\n"))
137 (defun replace-space-with-underline (str)