Subject: Re: Emacs VM folders and procmail file locking

From: [email-masked] (Jonathan Doughty)
Date: Wed, 31 Aug 1994 12:20:27 +0500

>>>>> "JDS" == J Daniel Smith <[email-masked]> writes:

JDS> Also, I'd rather not switch to some other scheme to manage folders
JDS> with procmail and VM; if I'm not mistaken, this would require me to
JDS> modify two files (~/.procmailrc and ~/.vm) whenever I want to sort
JDS> mail into a new folder.

Well, it would mean changing the way you manage folders, but my scheme
makes VM automatically aware of procmail delivered mail.

My procmail recipies all deliver to the UPPERCASE version of my lower case
vm folders.  In my .vm, I have:
  (setq 
   vm-spool-files 
   (append
    (list 
     (list vm-primary-inbox
           "/var/spool/mail/jond"
           "/var/spool/mail/jond.crash"))
    ;; Mailing list inboxes
    ;; I arrange that all my procmail maildrops are in ~/Mail/[A-Z]*
    (mapcar '(lambda (s)
               "make the appropriate entry for vm-spool-files"
               (list
                (concat vm-folder-directory s)
                (concat vm-folder-directory (upcase s))
                (concat vm-folder-directory s ".crash")))
            ;; So I create a vm-spool-files entry for each of those mail drops
            (mapcar 'downcase 
                    (directory-files vm-folder-directory nil "^[A-Z].+"))))
   )

So that, whenever vm is re-initiliazed, it becomes aware of potential vm
folders and their respective spool files.  Thus I never change my .vm
file, just .procmailrc when I make a new maildrop.  I never worry about
lock file problems (though I suppose there may be some race conditions in
which procmail is delivering mail to the spool file at the same time that
vm is reading moving it to the folder).

As an added bonus, I have a csh alias that lets me see which folders I
ought to read:
    alias lm 'ls -l ~/Mail/[A-Z]* | egrep -v -e " 0 " | sort -n +3'

-----------------------------------------------------------------------
Jonathan Doughty          The MITRE Corporation          [email-masked]

---

From: "J. Daniel Smith" <[email-masked]>
Date: Wed, 31 Aug 94 11:39:08 -0400

This seems to be mostly a problem with Emacs and VM and not procmail
per se, but it seems like there are several people on this list that
use procmail and VM...

I frequently run into the following situation: I use procmail for
sorting my incoming mail into several folders.  For the folders that
get a lot of mail or that I read a lot, I've set up procmail to use
Emacs' lockfiles as follows:
----
# various directories Emacs lockname format
E_LOCK=/usr/local/lib/emacs/lock
# E_HOME=`echo $HOME | sed 's./.!.g'`
E_MAILDIR=`echo $MAILDIR | sed 's./.!.g'`
E_TOREAD=${E_LOCK}/${E_MAILDIR}!toread

# increase the LOCK parameters, since if an Emacs lock file is used,
# we may be awhile.
LOCKSLEEP=60
# default is over 10 minutes, should be good enough
# LOCKTIMEOUT=1024

:0:${E_TOREAD}!folder
* [email-masked]
toread/folder
-----

I then visit a VM folder, and start composing a reply to a message.
While I'm doing that, new mail arrives and VM writes it to the folder,
since it is not locked.  Once I finish sending the message, Emacs gets
all upset because the file has now been modified.

The reason this happens is that VM doesn't lock a folder when visiting
it; in fact, several places in vm-folder.el appear to explicitly
disable Emacs' file locking.  This creates problems when used with
procmail, since after replying to a message, VM wants to update the
status of that message, but the folder has been changed in the
meantime.

Is there a way I can lock a VM folder more-or-less most of the time?
About the only time it shouldn't be locked in my situation if right
after I've done "s".

Also, I'd rather not switch to some other scheme to manage folders
with procmail and VM; if I'm not mistaken, this would require me to
modify two files (~/.procmailrc and ~/.vm) whenever I want to sort
mail into a new folder.

Thanks,
   Dan
====================== message is author's opinion only ======================
J. Daniel Smith         Bristol Technology Inc., Ridgefield, Connecticut (USA)
[email-masked]         (203) 438-6969, 438-5013 (FAX)            
                        FTP: ftp.bristol.com     WWW: http://www.bristol.com
                                --------
 Gott ist mit uns am Abend und am Morgen, und ganz gewiss an jedem neuen Tag.
	- Dietrich Bonhoeffer