Added all of the MH sources, including RCS files, in
[mmh] / docs / historical / mh-6.8.5 / miscellany / mhe / mh-unmark.ml
1 ; This function implements the "u" command of mhe.
2 ; It removes a delete or move mark that has been placed on a
3 ; message. To do this, we must remove the "D" or "^" flag in the header
4 ; line, and also remove the message number from the requisite "rmm"
5 ; or "file" command in the command buffer.
6 (defun 
7     (&mh-unmark
8         (pop-to-buffer (concat "+" mh-folder))
9         (if (! mh-writeable)
10             (error-message "Sorry;  this folder is read-only."))
11         (beginning-of-line)
12         (goto-character (+ (dot) 3))
13         (if (= (following-char) 'D')
14             (progn
15                   (save-excursion 
16                       (temp-use-buffer "cmd-buffer")
17                       (beginning-of-file)
18                       (if (error-occured 
19                               (re-search-forward
20                                   (concat "^rmm +" mh-folder
21                                           " .*\\b" (&mh-get-msgnum) "\\b"))
22                           )
23                           (message "Can't find msg num!!!")
24                           (progn (delete-previous-word)
25                                  (delete-previous-character)
26                                  (end-of-line)
27                                  (backward-word) (backward-word)
28                                  (if (looking-at
29                                          (concat "^rmm +" mh-folder))
30                                      (progn 
31                                             (kill-to-end-of-line)
32                                             (kill-to-end-of-line))
33                                  )
34                           )
35                       )
36                       (setq buffer-is-modified 0)
37                   )
38             )
39             (= (following-char) '^')
40             (progn
41                   (save-excursion 
42                       (temp-use-buffer "cmd-buffer")
43                       (beginning-of-file)
44                       (if (error-occured 
45                               (re-search-forward
46                                   (concat 
47                                           "^filem -src +" mh-folder
48                                           " +.*\\b" (&mh-get-msgnum) "\\b"
49                                   )
50                               )
51                           )
52                           (message "Can't find msg num!!!")
53                           (progn (delete-previous-word)
54                                  (delete-previous-character)
55                                  (end-of-line)
56                                  (backward-word)
57                                  (backward-character)
58                                  (if (looking-at "+")
59                                      (progn 
60                                             (beginning-of-line)
61                                             (kill-to-end-of-line)
62                                             (kill-to-end-of-line)
63                                      )
64                                  )
65                           )
66                       )
67                       (setq buffer-is-modified 0)
68                   )
69             )
70         )
71         (if (! (eobp))
72             (progn 
73                    (delete-next-character)
74                    (insert-string " ")
75             )
76         )
77         (setq buffer-is-modified 0)
78         (another-line)
79     )
80 )
81