Added -clobber switch to mhstore(1) [Bug #11160].
[mmh] / docs / historical / mh-6.8.5 / miscellany / mhe / mh-util.ml
1 ; These utility functions return message number, file name, or path
2 ; information. They are explicitly loaded from the root.
3 (defun     
4     (&mh-get-msgnum
5         (save-excursion
6             (temp-use-buffer (concat "+" mh-folder))
7             (beginning-of-line)
8             (while (= (following-char) ' ') (forward-character))
9             (set-mark)
10             (beginning-of-line)
11             (goto-character (+ (dot) 3))
12             (region-to-string)
13         )
14     )
15     
16     (&mh-get-fname
17         (save-excursion 
18             (temp-use-buffer (concat "+" mh-folder))
19             (concat mh-buffer-filename "/" (&mh-get-msgnum))
20         )
21     )
22
23     (find-path                  ; Look in ~/.mh_profile to find inbox path
24         (save-window-excursion 
25             (temp-use-buffer "mhprofile")
26             (setq backup-before-writing 0)
27             (erase-buffer)
28             (if (= 0 (file-exists (concat (getenv "HOME") "/.mh_profile")))
29                 (progn
30                       (pop-to-buffer "sorry") (delete-other-windows)
31                       (insert-string "\n\nI can't find your .mh_profile file.\n"
32                                  "That means I can't continue. Sorry.\n"
33                                  "If you don't know what this means, then"
34                                  " you should run the program\n"
35                                  "'install-mh' now, to build that file.\n")
36                       (sit-for 0)
37                       (setq stack-trace-on-error 0)
38                       (exit-emacs)
39                 ))
40             (read-file (concat (getenv "HOME") "/.mh_profile"))
41             (setq mh-path "Mail")
42             (error-occured 
43                 (search-forward "Path:")
44                 (while (looking-at "[\t ]") (forward-character))
45                 (set-mark) (end-of-line)
46                 (setq mh-path (region-to-string))
47             )
48             (if (!= (string-to-char (substr mh-path 1 1)) '/')
49                 (setq mh-path (concat (getenv "HOME") "/" mh-path)))
50             
51             (beginning-of-file)
52             (error-occured 
53                 (search-forward "current-folder:")
54                 (while (looking-at "[\t ]") (forward-character))
55                 (set-mark) (end-of-line)
56                 (setq mh-folder (region-to-string))
57             )
58             (if (error-occured (search-forward "\nmhe:"))
59                 (progn
60                       (end-of-file)
61                       (insert-string "mhe: audit\n"); UCI
62 ;UCI                  (insert-string "mhe: audit")
63                       (write-current-file)
64                 )
65             )
66             (delete-buffer "mhprofile")
67         )
68     )
69 )