Sigh, where to begin.
bbdb-1.50
Using someone's suggested code:
;; logic to use bbdb mail-folder property to set the default for
;; saving message.
(defadvice vm-auto-select-folder (around bbdb-auto-select activate compile)
"If the message sender's BBDB entry has a `mail-folder' property, use that."
(require 'bbdb-com)
(let* ((record (bbdb/vm-update-record t))
(folder (and record (bbdb-record-getprop record 'mail-folder))))
(if folder
(setq ad-return-value folder)
;; ad-do-it is the original body of vm-auto-select-folder.
ad-do-it)))
so I can vm-auto-archive-messages (and have a default for interactive
vm-save-message) using the mail-folder property extracted from the
bbdb record for each message.
This appears to work fine until I visit a virtual folder replies
that consists of:
("replies" (("INBOX" "netcom" "bccs") (and (not (filed)) (or (and (header
"^X-Gec-Originated") (author "beldar\\|gec")) (replied)))))
This gets messages from my two main inboxes, as well as the inbox
associated with a procmail'ed mbox that filters out my bcc'ed
messages.
If I do a vm-auto-archive-messages, messages to/from different people
who are in the bbdb and have differing mail-folder properties get
autofiled to the same folder, apparently the one associated with the
first message in the folder.
If I move through the virtual folder hitting 's' and noting the
proffered response, it's doing the right thing.
Is the interface to vm-auto-select-folder public? Can I rely on
getting at the message pointer argument in my advice (which would
allow me to replace the bbdb/vm-update-record call above with
something far simpler and less reliant on the inner workings of vm)?
I think what's going wrong is:
(defun bbdb/vm-update-record (&optional offer-to-create)
"returns the record corresponding to the current VM message, creating or
modifying it as necessary. A record will be created if
bbdb/mail-auto-create-p is non-nil, or if OFFER-TO-CREATE is true and
the user confirms the creation."
(save-excursion
(and vm-mail-buffer (set-buffer vm-mail-buffer))
(if bbdb-use-pop-up
(bbdb/vm-pop-up-bbdb-buffer offer-to-create)
(let ((msg (car vm-message-pointer))
(inhibit-local-variables nil) ; vm binds this to t...
(enable-local-variables t) ; ...or vm bind this to nil.
(inhibit-quit nil)) ; vm damn well better not bind this to t!
;; this doesn't optimize the case of moving thru a folder where
;; few messages have associated records.
(or (bbdb-message-cache-lookup msg nil) ; nil = current-buffer
where the bbdb-message-cache-lookup is expecting everything to be in
the buffer of the message.
Emacs : GNU Emacs 19.22.11 of Mon Feb 14 1994 on mom (irix)
Package: VM 5.67 (beta)
current state:
==============
(setq
vm-arrived-message-hook nil
vm-auto-center-summary 1
vm-auto-folder-case-fold-search nil
vm-auto-get-new-mail t
vm-auto-next-message t
vm-berkeley-mail-compatibility nil
vm-check-folder-types t
vm-circular-folders 0
vm-confirm-new-folders nil
vm-confirm-quit 0
vm-convert-folder-types nil
vm-crash-box "~/Vmail/INBOX.CRASH"
vm-default-folder-type 'From_
vm-delete-after-archiving t
vm-delete-after-bursting nil
vm-delete-after-saving nil
vm-delete-empty-folders nil
vm-digest-burst-type "rfc934"
vm-digest-identifier-header-format "X-Digest: %s\n"
vm-digest-center-preamble t
vm-digest-preamble-format "\"%s\" (%F)"
vm-digest-send-type "rfc1153"
vm-edit-message-hook nil
vm-edit-message-mode 'text-mode
vm-flush-interval 30
vm-folder-directory "~/Vmail/"
vm-folder-read-only nil
vm-follow-summary-cursor t
vm-forward-message-hook nil
vm-forwarded-headers '("From:" "Sender:" "To:" "Cc:" "Subject:" "Date:"
"Message-ID:" "Keywords:" "Newsgroups:")
vm-forwarding-digest-type "rfc1153"
vm-forwarding-subject-format "forwarded message from %F"
vm-highlighted-header-regexp nil
vm-honor-page-delimiters nil
vm-in-reply-to-format "%i"
vm-included-text-attribution-format "%F wrote:\n"
vm-included-text-discard-header-regexp nil
vm-included-text-headers nil
vm-included-text-prefix ""
vm-inhibit-startup-message nil
vm-init-file "~/.vm"
vm-invisible-header-regexp nil
vm-jump-to-new-messages t
vm-jump-to-unread-messages t
vm-keep-crash-boxes "/usr/tmp/gec-crashes"
vm-keep-sent-messages t
vm-mail-header-from "[EMAIL PROTECTED] (Gardner Cohen)"
vm-mail-hook nil
vm-mail-mode-hook nil
vm-mode-hook nil
vm-mode-hooks '(gec-vm-mode-hook)
vm-move-after-deleting 0
vm-move-after-undeleting nil
vm-move-messages-physically nil
vm-movemail-program "mymovemail"
vm-mutable-frames nil
vm-mutable-windows t
vm-pop-md5-program "md5"
vm-preview-lines t
vm-preview-read-messages nil
vm-primary-inbox "~/Vmail/INBOX"
vm-quit-hook '((lambda nil (bbdb-save-db)) (lambda nil (bbdb-save-db)))
vm-recognize-pop-maildrops "^[^:]+:[^:]+:[^:]+:[^:]+:[^:]+"
vm-reply-hook nil
vm-reply-ignored-addresses '("gec.*sgi\\.com" "gec.*mti" "^beldar$"
"beldar@netcom\\.com")
vm-reply-ignored-reply-tos nil
vm-reply-subject-prefix nil
vm-resend-bounced-discard-header-regexp nil
vm-resend-bounced-headers '("Resent-" "From:" "Sender:" "To:" "Cc:" "Subject:"
"Newsgroups:" "In-Reply-To:" "References:" "Keywords:" "X-")
vm-resend-bounced-message-hook nil
vm-resend-discard-header-regexp "\\(\\(X400-\\)?Received:\\|Resent-\\)"
vm-resend-headers nil
vm-resend-message-hook nil
vm-retrieved-spooled-mail-hook nil
vm-rfc1153-digest-discard-header-regexp "\\(X400-\\)?Received:"
vm-rfc1153-digest-headers '("Resent-" "Date:" "From:" "Sender:" "To:" "Cc:"
"Subject:" "Message-ID:" "Keywords:")
vm-rfc934-digest-discard-header-regexp nil
vm-rfc934-digest-headers '("Resent-" "From:" "Sender:" "To:" "Cc:" "Subject:"
"Date:" "Message-ID:" "Keywords:")
vm-search-using-regexps nil
vm-select-message-hook '(bbdb/vm-update-record hilit-rehighlight-buffer-quietly)
vm-select-new-message-hook nil
vm-select-unread-message-hook nil
vm-send-digest-hook nil
vm-skip-deleted-messages t
vm-skip-read-messages nil
vm-startup-with-summary t
vm-strip-reply-headers nil
vm-summary-format "%n %*%a %-17.17F %-3.3m %2d %4l/%-5c %I\"%s\"\n"
vm-summary-highlight-face nil
vm-summary-mode-hook nil
vm-summary-mode-hooks nil
vm-summary-redo-hook '(hilit-rehighlight-buffer-quietly)
vm-summary-show-threads t
vm-summary-subject-no-newlines t
vm-summary-thread-indent-level 2
vm-summary-uninteresting-senders
"gec.*sgi\\.com\\|beldar@.*netcom\\|^beldar$\\|gec.*[Mm]ti"
vm-summary-uninteresting-senders-arrow "To: "
vm-tale-is-an-idiot nil
vm-unforwarded-header-regexp nil
vm-virtual-folder-alist '(("replies" (("INBOX" "netcom" "bccs") (and (not
(filed)) (or (and (header "^X-Gec-Originated") (author "beldar\\|gec")) (replied)))))
("spores" (("mdove" "peter" "bwc") (any))) ("tools" (("ruthw" "ekoh" "peebles" "flc"
"anoosh" "roginski") (any))) ("bccs" (("netcom") (and (not (filed)) (header
"^X-Gec-Originated") (author "beldar\\|gec")))))
vm-virtual-mirror t
vm-visible-headers '("From:" "Sender:" "To:" "Apparently-To:" "Cc:" "Subject:"
"Date:" "Newsgroups")
vm-visit-folder-hook nil
vm-visit-when-saving 0
vm-window-configuration-file "~/.vm.windows"
vm-window-configurations '((vm-visit-folder ((((visibility . t) (window-id .
"79699084") (top . 229) (left . 578) (unsplittable) (minibuffer . t) (modeline . t)
(width . 90) (height . 50) (name . "VM: stella") (menu-bar-lines . 1) (cursor-type .
box) (auto-lower) (auto-raise) (icon-type . t) (border-color . "black") (cursor-color
. "black") (mouse-color . "black") (background-color . "#c1c1c1") (foreground-color .
"Black") (vertical-scroll-bars . t) (internal-border-width . 2) (border-width . 2)
(font . "-misc-fixed-medium-r-normal--13-120-75-75-c-70-iso8859-1")) ((visibility . t)
(window-id . "79698556") (top . 154) (left . 143) (unsplittable) (minibuffer)
(modeline . t) (width . 80) (height . 14) (name . "COMPILATION") (menu-bar-lines . 0)
(cursor-type . box) (auto-lower) (auto-raise) (icon-type . t) (border-color . "black")
(cursor-color . "black") (mouse-color . "black") (background-color . "#c1c1c1")
(foreground-color . "Black") (vertical-scroll-bars . t) (internal!
-border-width . 2) (border-width .
2) (font . "-misc-fixed-medium-r-normal--13-120-75-75-c-70-iso8859-1")) ((visibility
. t) (window-id . "79697558") (top . 217) (left . 58) (unsplittable) (minibuffer . t)
(modeline . t) (width . 80) (height . 40) (name . ".vmaliases.el") (menu-bar-lines .
1) (cursor-type . box) (auto-lower) (auto-raise) (icon-type . t) (border-color .
"black") (cursor-color . "black") (mouse-color . "black") (background-color .
"#c1c1c1") (foreground-color . "Black") (vertical-scroll-bars . t)
(internal-border-width . 2) (border-width . 2) (font .
"-misc-fixed-medium-r-normal--13-120-75-75-c-70-iso8859-1")) ((visibility . t)
(window-id . "79696582") (top . 151) (left . 57) (unsplittable) (minibuffer . t)
(modeline . t) (width . 80) (height . 40) (name . "vm-window.el") (menu-bar-lines . 1)
(cursor-type . box) (auto-lower) (auto-raise) (icon-type . t) (border-color . "black")
(cursor-color . "black") (mouse-color . "black") (background-color . "#c1c1c1")
(foreground-color . "Black") (vertica!
l-scroll-bars . t) (internal-borde
r-width . 2) (border-width . 2) (font .
"-misc-fixed-medium-r-normal--13-120-75-75-c-70-iso8859-1")) ((visibility . t)
(window-id . "79695560") (top . 197) (left . 637) (unsplittable) (minibuffer . t)
(modeline . t) (width . 80) (height . 40) (name . "ice_cop0.c") (menu-bar-lines . 1)
(cursor-type . box) (auto-lower) (auto-raise) (icon-type . t) (border-color . "black")
(cursor-color . "black") (mouse-color . "black") (background-color . "#c1c1c1")
(foreground-color . "Black") (vertical-scroll-bars . t) (internal-border-width . 2)
(border-width . 2) (font .
"-misc-fixed-medium-r-normal--13-120-75-75-c-70-iso8859-1")) ((visibility . t)
(window-id . "79692897") (top . 163) (left . 321) (unsplittable) (minibuffer . t)
(modeline . t) (width . 90) (height . 50) (name . "VM: netcom") (menu-bar-lines . 1)
(cursor-type . box) (auto-lower) (auto-raise) (icon-type . t) (border-color . "black")
(cursor-color . "black") (mouse-color . "black") (background-color . "#c1c1c1")
(foreground-!
color . "Black") (vertical-scroll-
bars . t) (internal-border-width . 2) (border-width . 2) (font .
"-misc-fixed-medium-r-normal--13-120-75-75-c-70-iso8859-1")) ((visibility . t)
(window-id . "79692776") (top . 258) (left . 570) (unsplittable) (minibuffer . t)
(modeline . t) (width . 80) (height . 40) (name . "EXT.Mkinc") (menu-bar-lines . 1)
(cursor-type . box) (auto-lower) (auto-raise) (icon-type . t) (border-color . "black")
(cursor-color . "black") (mouse-color . "black") (background-color . "#c1c1c1")
(foreground-color . "Black") (vertical-scroll-bars . t) (internal-border-width . 2)
(border-width . 2) (font .
"-misc-fixed-medium-r-normal--13-120-75-75-c-70-iso8859-1")) ((visibility . icon)
(window-id . "79691809") (top . 32) (left . 182) (unsplittable) (minibuffer . t)
(modeline . t) (width . 90) (height . 50) (name . "VM") (menu-bar-lines . 1)
(cursor-type . box) (auto-lower) (auto-raise) (icon-type . t) (border-color . "black")
(cursor-color . "black") (mouse-color . "black") (background-color . "#c1c!
1c1") (foreground-color . "Black")
(vertical-scroll-bars . t) (internal-border-width . 2) (border-width . 2) (font .
"-misc-fixed-medium-r-normal--13-120-75-75-c-70-iso8859-1")) ((visibility . t)
(window-id . "79691783") (top . 261) (left . 510) (unsplittable) (minibuffer . t)
(modeline . t) (width . 80) (height . 40) (name . "t5.settings") (menu-bar-lines . 1)
(cursor-type . box) (auto-lower) (auto-raise) (icon-type . t) (border-color . "black")
(cursor-color . "black") (mouse-color . "black") (background-color . "#c1c1c1")
(foreground-color . "Black") (vertical-scroll-bars . t) (internal-border-width . 2)
(border-width . 2) (font .
"-misc-fixed-medium-r-normal--13-120-75-75-c-70-iso8859-1"))) (((0 1 90 49) ((nil
summary)) ((nil nil nil t)))))) (vm-mail ((((visibility . t) (top . 131) (left . 111)
(unsplittable) (minibuffer . t) (modeline . t) (width . 85) (height . 40)
(menu-bar-lines . 1) (cursor-type . box) (auto-lower) (auto-raise) (icon-type)
(vertical-scroll-bars . t) (internal-border-width . 2) (bord!
er-width . 2)) ((visibility . t) (
top . 111) (left . 91) (unsplittable) (minibuffer . t) (modeline . t) (width . 85)
(height . 40) (menu-bar-lines . 1) (cursor-type . box) (auto-lower) (auto-raise)
(icon-type) (vertical-scroll-bars . t) (internal-border-width . 2) (border-width . 2))
((visibility . t) (top . 163) (left . 257) (unsplittable) (minibuffer . t) (modeline .
t) (width . 85) (height . 40) (menu-bar-lines . 1) (cursor-type . box) (auto-lower)
(auto-raise) (icon-type) (vertical-scroll-bars . t) (internal-border-width . 2)
(border-width . 2)) ((visibility . t) (top . 111) (left . 91) (unsplittable)
(minibuffer . t) (modeline . t) (width . 85) (height . 40) (menu-bar-lines . 1)
(cursor-type . box) (auto-lower) (auto-raise) (icon-type) (vertical-scroll-bars . t)
(internal-border-width . 2) (border-width . 2)) ((visibility . t) (top . 317) (left .
667) (unsplittable) (minibuffer . t) (modeline . t) (width . 80) (height . 40)
(menu-bar-lines . 1) (cursor-type . box) (auto-lower) (auto-raise) (icon-type) (!
vertical-scroll-bars . t) (interna
l-border-width . 2) (border-width . 2))) (((- (0 1 85 9) (0 9 85 33) (0 33 85 39))
((nil message) (nil composition) (nil "*BBDB*")) ((nil nil nil nil) (nil nil nil t)
(nil nil nil nil)))))) (vm-reply-include-text ((((visibility . t) (top . 131) (left .
111) (unsplittable) (minibuffer . t) (modeline . t) (width . 85) (height . 40)
(menu-bar-lines . 1) (cursor-type . box) (auto-lower) (auto-raise) (icon-type)
(vertical-scroll-bars . t) (internal-border-width . 2) (border-width . 2))
((visibility . t) (top . 111) (left . 91) (unsplittable) (minibuffer . t) (modeline .
t) (width . 85) (height . 40) (menu-bar-lines . 1) (cursor-type . box) (auto-lower)
(auto-raise) (icon-type) (vertical-scroll-bars . t) (internal-border-width . 2)
(border-width . 2)) ((visibility . t) (top . 163) (left . 257) (unsplittable)
(minibuffer . t) (modeline . t) (width . 85) (height . 40) (menu-bar-lines . 1)
(cursor-type . box) (auto-lower) (auto-raise) (icon-type) (vertical-scroll-bars . t)
(internal-!
border-width . 2) (border-width .
2)) ((visibility . t) (top . 111) (left . 91) (unsplittable) (minibuffer . t)
(modeline . t) (width . 85) (height . 40) (menu-bar-lines . 1) (cursor-type . box)
(auto-lower) (auto-raise) (icon-type) (vertical-scroll-bars . t)
(internal-border-width . 2) (border-width . 2)) ((visibility . t) (top . 317) (left .
667) (unsplittable) (minibuffer . t) (modeline . t) (width . 80) (height . 40)
(menu-bar-lines . 1) (cursor-type . box) (auto-lower) (auto-raise) (icon-type)
(vertical-scroll-bars . t) (internal-border-width . 2) (border-width . 2))) (((- (0 1
85 9) (0 9 85 34) (0 34 85 39)) ((nil message) (nil composition) (nil "*BBDB*")) ((nil
nil nil nil) (nil nil nil t) (nil nil nil nil)))))) (editing-message ((((visibility .
t) (top . 52) (left . 172) (unsplittable) (minibuffer . t) (modeline . t) (width . 80)
(height . 40) (menu-bar-lines . 1) (cursor-type . box) (auto-lower) (auto-raise)
(icon-type) (vertical-scroll-bars . t) (internal-border-width . 2) (border-width .
2))) (((-!
(0 1 80 31) (0 31 80 39)) ((nil e
dit) (nil summary)) ((nil nil nil t) (nil nil nil nil)))))) (startup ((((visibility .
t) (top . 140) (left . 140) (unsplittable) (minibuffer . t) (modeline . t) (width .
80) (height . 40) (menu-bar-lines . 1) (cursor-type . box) (auto-lower) (auto-raise)
(icon-type) (vertical-scroll-bars . t) (internal-border-width . 2) (border-width .
2))) (((0 1 80 39) ((nil summary)) ((nil nil nil t)))))) (reading-message
((((menu-bar-lines . 0) (unsplittable) (minibuffer . t) (modeline . t) (width . 90)
(height . 38) (name . "terminal"))) (((- (0 0 90 26) (0 26 90 29) (0 29 90 37)) ((nil
message) (nil "*BBDB*") (nil summary)) ((nil nil nil nil) (nil nil nil nil) (nil nil
nil t)))))) (composing-message ((((visibility . t) (top . 131) (left . 111)
(unsplittable) (minibuffer . t) (modeline . t) (width . 85) (height . 40)
(menu-bar-lines . 1) (cursor-type . box) (auto-lower) (auto-raise) (icon-type)
(vertical-scroll-bars . t) (internal-border-width . 2) (border-width . 2))
((visibility . t) !
(top . 111) (left . 91) (unsplitta
ble) (minibuffer . t) (modeline . t) (width . 85) (height . 40) (menu-bar-lines . 1)
(cursor-type . box) (auto-lower) (auto-raise) (icon-type) (vertical-scroll-bars . t)
(internal-border-width . 2) (border-width . 2)) ((visibility . t) (top . 163) (left .
257) (unsplittable) (minibuffer . t) (modeline . t) (width . 85) (height . 40)
(menu-bar-lines . 1) (cursor-type . box) (auto-lower) (auto-raise) (icon-type)
(vertical-scroll-bars . t) (internal-border-width . 2) (border-width . 2))
((visibility . t) (top . 111) (left . 91) (unsplittable) (minibuffer . t) (modeline .
t) (width . 85) (height . 40) (menu-bar-lines . 1) (cursor-type . box) (auto-lower)
(auto-raise) (icon-type) (vertical-scroll-bars . t) (internal-border-width . 2)
(border-width . 2)) ((visibility . t) (top . 317) (left . 667) (unsplittable)
(minibuffer . t) (modeline . t) (width . 80) (height . 40) (menu-bar-lines . 1)
(cursor-type . box) (auto-lower) (auto-raise) (icon-type) (vertical-scroll-bars . t)
(intern!
al-border-width . 2) (border-width
. 2))) (((- (0 1 85 9) (0 9 85 33) (0 33 85 39)) ((nil message) (nil composition)
(nil "*BBDB*")) ((nil nil nil nil) (nil nil nil t) (nil nil nil nil))))))
(vm-summarize ((((menu-bar-lines . 0) (unsplittable) (minibuffer . t) (modeline . t)
(width . 80) (height . 41) (name . "terminal"))) (((0 0 80 40) ((nil summary)) ((nil
nil nil t)))))))
pop-up-windows t
pop-up-frames nil
next-screen-context-lines 2
features '(etags compile cc-mode dired ange-ftp comint-hilit comint ring rfc822
env man assoc tabify mailabbrev mailalias mail-extr mail-utils itimer bbdb-com bbdb-vm
bbdb t byte-optimize byte-compile backquote win-vm sendmail timezone reporter tapestry
vm ptools show-temp-buffer compile-frame paren stig-paren hl319 hilit19 func-menu
mini-cl cl cl-19 delsel mldrag gnuserv filecomp backslash csh-mode fa-extras filladapt
ispell auto-save hyperbole hook-advice advice advice-preload menu-bar faces vc-hooks
lisp-float-type lisp-mode page select scroll-bar mouse frame)
)