0
|
1 ; This autoloaded file implements the "m" command of mhe. We call "comp" to
|
|
2 ; compose the message into buffer "draft", and then when we are ready to
|
|
3 ; send it we call "send" to do the evil deed.
|
|
4 (defun
|
|
5 (&mh-send actn exfl sm
|
|
6 (save-window-excursion
|
|
7 (&mh-save-killbuffer)
|
|
8 (message "Composing a message...") (sit-for 0)
|
|
9 (error-occured
|
|
10 (unlink-file (concat mh-path "/draft")))
|
|
11 (pop-to-buffer (concat "+" mh-folder))
|
|
12 (setq sm mode-line-format)
|
|
13 (delete-other-windows)
|
|
14 (pop-to-buffer "draft") (erase-buffer)
|
|
15 (if (file-exists
|
|
16 (concat mh-path "/components"))
|
|
17 (insert-file (concat mh-path "/components"))
|
|
18 (insert-file (concat mh-progs "/components"))
|
|
19 )
|
|
20 (write-named-file (concat mh-path "/draft"))
|
|
21 (local-bind-to-key "exit-emacs" "\\")
|
|
22 (mail-mode) (header-line-position)
|
|
23 (sit-for 0) (setq exfl 0)
|
|
24 (while (= exfl 0)
|
|
25 (error-occured
|
|
26 (save-window-excursion
|
|
27 (pop-to-buffer (concat "+" mh-folder))
|
|
28 (setq mode-line-format
|
|
29 "{%b} ^X^C exits to top level %M")
|
|
30 (pop-to-buffer "draft")
|
|
31 (setq mode-line-format
|
|
32 (concat "{%b} %[%p of "
|
|
33 mh-path "/draft%] "
|
|
34 "(^X^C to exit) %M"))
|
|
35 (&mh-restore-killbuffer)
|
|
36 (recursive-edit)
|
|
37 (&mh-save-killbuffer)
|
|
38 (setq mode-line-format
|
|
39 (concat "{%b} %[%p of "
|
|
40 mh-path "/draft%] %M"))
|
|
41 (pop-to-buffer (concat "+" mh-folder))
|
|
42 (setq mode-line-format " ")
|
|
43 )
|
|
44 )
|
|
45 (setq actn (get-response "Ready to send. Action? (m, q, e, or ?) " "mMqQeE\"
|
|
46 "m: mail it, q: quit, e: resume editing, ?: this msg."))
|
|
47 (if (= actn 'm')
|
|
48 (progn (message "Sending...") (sit-for 0)
|
|
49 (write-current-file)
|
|
50 (setq buffer-is-modified 0)
|
|
51 (send-to-shell
|
|
52 (concat mh-progs "/send -noverbose "
|
|
53 mh-path "/draft"
|
|
54 ))
|
|
55 (setq exfl 1)
|
|
56 )
|
|
57 (= actn 'q')
|
|
58 (progn
|
|
59 (&mh-restore-killbuffer)
|
|
60 (pop-to-buffer (concat "+" mh-folder))
|
|
61 (delete-other-windows)
|
|
62 (setq mode-line-format sm)
|
|
63 (error-message "Message not sent; its text remains in buffer 'draft'")
|
|
64 )
|
|
65 )
|
|
66 )
|
|
67 )
|
|
68 (&mh-restore-killbuffer)
|
|
69 (pop-to-buffer (concat "+" mh-folder)) (delete-other-windows)
|
|
70 (setq mode-line-format sm)
|
|
71 (pop-to-buffer "draft") (previous-window)
|
|
72 )
|
|
73 )
|