Added all of the MH sources, including RCS files, in
[mmh] / docs / historical / mh-6.8.5 / miscellany / mhe / mh-move.ml
1 ;  This autoloaded file defines the "^" command in mhe. It marks a message
2 ; to be moved into another folder. This mark is represented in two ways:
3 ; a "^" character is placed in column 4 of the header line, and the number
4 ; of the message is placed in the text of an appropriate "file" command 
5 ; in the command buffer. When it is autoloaded, it redefines the function
6 ; &mh-re-move (defined as a no-op in the base file) so that it will repeat
7 ; the last move command with the same destination but a new source.
8
9 (defun 
10     (&mh-move
11         (progn
12               (pop-to-buffer (concat "+" mh-folder))
13               (beginning-of-line)
14               (goto-character (+ (dot) 3))
15               (if (| (= (following-char) ' ') (= (following-char) '+'))
16                   (progn
17                         (setq mh-last-destination
18                               (get-folder-name "Destination" "" 1))
19                         (&mh-xfer mh-last-destination)
20                   )
21               )
22               (another-line)
23         )
24     )
25     
26     (&mh-re-move
27         (pop-to-buffer (concat "+" mh-folder))
28         (beginning-of-line)
29         (goto-character (+ (dot) 3))
30         (if (| (= (following-char) ' ') (= (following-char) '+'))
31             (progn
32                   (&mh-xfer mh-last-destination)
33             )
34         )
35         (another-line)
36     )
37     
38     (&mh-xfer destn
39         (progn 
40                (setq destn (arg 1))
41                (delete-next-character)
42                (insert-string "^")
43                (setq buffer-is-modified 0)
44                (temp-use-buffer "cmd-buffer")
45                (beginning-of-file)
46                (set "stack-trace-on-error" 0)
47                (if (error-occured 
48                        (re-search-forward 
49                            (concat "^filem -src +" mh-folder " +" destn))
50                    )
51                    (progn 
52                           (end-of-file)
53                           (insert-string
54                               (concat "filem -src +" mh-folder " +" destn "\n"))
55                           (backward-character)
56                    )
57                )
58                (set "stack-trace-on-error" mhe-debug)
59                (end-of-line)
60                (insert-string (concat " " (&mh-get-msgnum)))
61                (setq buffer-is-modified 0)
62                (pop-to-buffer (concat "+" mh-folder))
63         )
64     )
65 )