Added -clobber switch to mhstore(1) [Bug #11160].
[mmh] / docs / historical / mh-6.8.5 / miscellany / mhe / mh-forw.ml
1 ;  This autoloaded file implements the "f" command of mhe
2 (defun 
3     (&mh-forw actn exfl sm annotate fn
4         (save-window-excursion 
5             (progn
6                   (message  "Forwarding message " (&mh-get-msgnum) "...")
7                   (sit-for 0)
8                   (&mh-save-killbuffer)
9                   (pop-to-buffer (concat "+" mh-folder))
10                   (setq sm mode-line-format)
11                   (delete-other-windows)
12                   (setq annotate mh-annotate)
13                   (setq fn (&mh-get-fname))
14                   (pop-to-buffer "draft")
15                   (erase-buffer)
16                   (insert-string "One moment, please...")
17                   (unlink-file (concat mh-path "/draft"))
18                   (send-to-shell 
19                       (concat mh-progs "/forw -build +" mh-folder " "
20                               (&mh-get-msgnum))
21                   )
22                   (show-shell-errors)
23                   (read-file (concat mh-path "/draft"))
24                   (local-bind-to-key "exit-emacs" "\\18\\ 3")
25                   (mail-mode) (header-line-position)
26                   (sit-for 0) (setq exfl 0)
27                   (while (= exfl 0)
28                          (error-occured
29                              (save-window-excursion
30                                  (pop-to-buffer (concat "+" mh-folder))
31                                  (setq mode-line-format
32                                        "{%b}    ^X^C exits to top level")
33                                  (pop-to-buffer "draft")
34                                  (setq mode-line-format
35                                        (concat "{%b}    %[%p of "
36                                                mh-path "/draft%]        "
37                                                "^X^C exits to top level"))
38                                  (&mh-restore-killbuffer)
39                                  (recursive-edit)
40                                  (setq mode-line-format
41                                        (concat "{%b}    %[%p of "
42                                                mh-path "/draft%]"))
43                                  (pop-to-buffer (concat "+" mh-folder))
44                                  (setq mode-line-format " ")
45                              )
46                          )
47                          (setq actn (get-response "Ready to send. Action? (m, q, e, or ?) " "mMqQeE\\ 3
48                                         "m: mail it, q: quit, e: resume editing, ?: this msg."))
49                          (if (= actn 'm')
50                              (progn (message "Sending...") (sit-for 0)
51                                     (write-current-file)
52                                     (send-to-shell 
53                                         (concat mh-progs "/send -noverbose "
54                                                 mh-path "/draft"
55                                         ))
56                                     (if annotate
57                                         (progn
58                                               (temp-use-buffer "message")
59                                               (read-file fn)
60                                               (annotate "Replied" "Forwarded")
61                                         )
62                                     )
63                                     (setq exfl 1))
64                              (= actn 'q')
65                              (progn
66                                    (&mh-restore-killbuffer)
67                                    (pop-to-buffer (concat "+" mh-folder))
68                                    (delete-other-windows)
69                                    (setq mode-line-format sm)
70                                    (error-message "Message not sent; its text remains in buffer 'draft'")
71                              )
72                          )
73                   )
74             )
75         )
76         (pop-to-buffer (concat "+" mh-folder)) (delete-other-windows)
77         (setq mode-line-format sm)
78         (pop-to-buffer "draft") (previous-window)
79     )
80 )