deleting bbdb records

Rob Walker <[email protected]> Sun, 25 Mar 2018 20:21:37 -0700
Newsgroups gmane.mail.wanderlust.general
Message-ID <85370nmshq.wl-rob__32519.8854705834$1522034463$gmane$org@ladle.net>
I have BBDBv3 and a minimal config working pretty well now, but I'm
having trouble with using elisp to delete some BBDB records.  I am
using djcb-wl-summary-refile which I found at
https://emacs-fu.blogspot.com/2009/09/wanderlust-tips-and-tricks.html

I call it like this for each of "spam" and "ham".

(define-key wl-summary-mode-map (kbd "b") ;; => spam
  '(lambda()
     (interactive)
     (my/delete-bbdb-record)
      (djcb-wl-summary-refile "%spam_postprocessor:mailserver:993!")))
(define-key wl-summary-mode-map (kbd "g") ;; => ham
  '(lambda()
     (interactive)
     (djcb-wl-summary-refile "%ham_postprocessor:mailserver:993!")))


my/delete-bbdb-record looks like this:

(defun my/delete-bbdb-record ()
  "Delete the current bbdb record."
  (interactive)
  (with-current-buffer (get-buffer bbdb-buffer-name)
    (if (> (length (bbdb-do-records)) 0)
           (bbdb-delete-records (bbdb-do-records) t))
    ))


My problem is that sometimes I get a WL error

Error running timer ‘wl-message-buffer-prefetch-subr’: (error "Invalid base64 data")

I don't have a BBDB record automatically completed, so when I hit "b"
on that email, it doesn't have a record to delete.  I have tried a
number of things, like this:

    ;; (bbdb-delete-field-or-record t)
    ;; (if (bbdb-do-records)
    ;;     (bbdb-delete-records (bbdb-do-records) t)
    ;;   )

but none of them are successful.  I suppose I should figure out how to
not automatically make a BBDB record for the times that things are
known spam (by looking at the spam headers in the emails), but that
doesn't help with the spam that gets through to my INBOX.

Thanks,
Rob