>>>>> On Wed, 1 Dec 93 22:44:29 -0500, [EMAIL PROTECTED] (Roland McGrath) said:

  Roland> I've been needing these forever and I can't believe it's taken me so long
  Roland> to spend the 20 minutes to write them.

This is GREAT!! I have been wanting to do the same
for a long time myself. However, I am not good enough
in elisp to have been able to do it in 20 minutes.

  Roland> If you don't have insert-hooks, my hook-advice.el is at the end and

I couldn't find your hook-advice.el at the end.
May be you forgot to include it?? 

I have advice.el
        ;; Version: advice.el,v 2.1 1993/05/26 00:07:58 hans Exp
loaded. But can't find insert-hooks.

Please send it to me as soon as you can.
I am very anxious to try this.

While I am at it let me be greedy. You know what else 
would be great? A few lines of elisp that walks though
my existing .bbdb and adds auto-fcc property to all
entries that have a network address.

Right now I am using:

      (load "mail-save")   ;;; Choose the appropriate folder for outgoing mail
      (setq mail-archive-alist
            '(("info-\\([-a-zA-Z]+\\)" . (downcase (mail-archive-match 1)))
              (".*[<]\\([a-zA-Z][a-zA-Z]*\\)[>].*" . (downcase (mail-archive-match 1)))
              ("\\([a-zA-Z][-a-zA-Z]*\\)@" . (downcase (mail-archive-match 1)))
              ("\\([.a-zA-Z]+!\\)+\\([-a-zA-Z]+\\)" . (downcase (mail-archive-match 
2)))
              ("\\([a-zA-Z]+\\)[ \\t]+(.*)$" . (downcase (mail-archive-match 1)))
              ("[ \\t]*\\([a-zA-Z]+\\)[ \\t]*$" . (downcase (mail-archive-match 1)))))
      ))

So the same regexp policy can be applied to the first entry
of the "network" property for producing default "auto-fcc" property.
Then over time I can go and use a different auto-fcc to over write
the default outgoing folder policy.

To make it all complete, an afterhook to bbdb-create can
see if there is a "network" but no "auto-fcc" in which case
it can create a default one using something like the above
policy.

Again, I am not good enough in elisp to do this in 20 minutes myself.
So, I thought I'll pass along the idea.

  Roland> implements in with defadvice.  So give somebody an `auto-fcc' property, and
  Roland> when you send them mail it will automatically be fcc'd to that folder.
  Roland> This works in general with sendmail, but it is a little vm-centric (uses
  Roland> vm-folder-directory).

Thanks in advance for helping me with insert-hooks.

...Mohsen.



----

  Roland> (insert-hooks 'bbdb-mail-abbrev-expand-hook nil
  Roland>             'after-bbdb-mail-abbrev-expand-hook)
  Roland> (add-hook 'after-bbdb-mail-abbrev-expand-hook 'bbdb-auto-fcc)
  Roland> (defun bbdb-auto-fcc ()
  Roland>   (mapcar (lambda (net)
  Roland>           (let ((folder (bbdb-record-getprop (bbdb-search-simple nil net)
  Roland>                                              'auto-fcc)))
  Roland>             (if folder
  Roland>                 (mail-fcc (expand-file-name folder vm-folder-directory)))))
  Roland>         records))

  Roland> This little piece of advice makes VM look at the `mail-folder' property of
  Roland> a msg's sender for the default folder for the msg, before 
vm-auto-folder-alist.

  Roland> (defadvice vm-auto-select-folder (around bbdb-auto-select activate compile)
  Roland>   "If the message sender's BBDB entry has a `mail-folder' property, use 
that."
  Roland>   (let* ((record (bbdb/vm-update-record t))
  Roland>        (folder (and record (bbdb-record-getprop record 'mail-folder))))
  Roland>     (if folder
  Roland>       (setq ad-return-value (expand-file-name folder vm-folder-directory))
  Roland>       ;; ad-do-it is the original body of vm-auto-select-folder.
  Roland>       ad-do-it)))

Reply via email to