[alt.sources] mh-folder-list.el -- Hierarchical folders in MH comp.mail.mh

mdb@ESD.3Com.COM (Mark D. Baushke) (12/12/89)

Archive-name: mh-folder-list.el
Original-posting-by: mdb@ESD.3Com.COM (Mark D. Baushke)
Original-subject:  Hierarchical folders in MH
Reposted-by: emv@math.lsa.umich.edu (Edward Vielmetti)

[This is an experimental alt.sources re-posting from the newsgroup(s)
comp.mail.mh. Comments on this service to emv@math.lsa.umich.edu 
(Edward Vielmetti).]


On 10 Dec 89 22:28:55 GMT, jw@sics.se (Johan Widen) said:

Johan> One thing that keeps bothering me, but which I have never got
Johan> around to fix (8-(), is that completion in the emacs mh-rmail
Johan> package does not work on subfolders. When I try to open a
Johan> subfolder for the first time, name completion does not work.
Johan> When I do it a second time however, emacs will now about the
Johan> subfolder, but not about any other as yet unopened subfolders.

Johan> Johan Widen
Johan> SICS, PO Box 1263, S-164 28 KISTA, SWEDEN	Internet: jw@sics.se
Johan> Tel: +46 8 752 15 32	Ttx: 812 61 54 SICS S	Fax: +46 8 751 72 30

The following may be of interest to you. I hacked it up for my own
use.

I would suggest that you save the value of the mh-folder-list as it
may take some time generate. Only do the my-mh-make-big-folder-list
when you need the list updated.

(defun my-mh-make-big-folder-list ()
  "Return a list of the user's folders.
Result is in a form suitable for completing read."
  (interactive)
  (message "Collecting folder names...")
  (save-window-excursion
    (mh-exec-cmd-quiet " *mh-temp*" "folders" "-fast" "-recurse")
    (goto-char (point-min))
    (let ((list nil))
      (while (not (eobp))
	(let ((start (point))
	      (count 0))
	  (search-forward "\n" nil t)
	  (let ((folder (buffer-substring start (- (point) 1))))
	    (mh-push (list (format "+%s" folder)) list))))
      (message "Collecting folder names...done")
      list)))

(setq mh-folder-list (my-mh-make-big-folder-list))

Enjoy!
-- 
Mark D. Baushke
Internet:   mdb@ESD.3Com.COM
UUCP:	    {3comvax,auspex,sun}!bridge2!mdb