"Roland Winkler" <wink...@gnu.org> writes: > On Sat Aug 2 2014 stardiviner wrote: >> When I use =bbdb-snarf= to add email to a new record. >> report error: >> When I try to re-add this email, after lost the record, it report error: >> =(error "BBDB: marker absent")= >> >> I think BBDB show check the database before really do write action. >> If database has exist the email, then raise exist record, or raise error. >> >> BTW, BBDB will raise error when move to next record which is already at last >> record. >> I think BBDB should not raise this error, just a message in minibuffer is >> fine. > > I am sorry, can you provide a more accurate recipe for how to > reproduce the bug you observe? See the emacs manual for reporting > bugs.
This thread reminded me of the existence of bbdb-snarf (it's still fairly useful for simple name/email combinations), and I started using it, and I hit the same bug. bbdb-snarf checks if the snarfed record already exists, and merges the old and new, if so. The new record needs to be fully created (with `bbdb-change-record', with the NEW argument true) before that happens. Otherwise, when it's passed to `bbdb-merge-record', it eventually gets created with a call to `bbdb-change-record' where the NEW argument is false. That makes a sort of Frankenstein record with no cache, and that causes problems. Anyhow, I think the solution is as simple as the attached patch, which always calls (bbdb-change-record record t t) whether or not the new record is going to be merged. E
>From 610a4f8e2e8ae403aeb443a0602534d44e40dbe5 Mon Sep 17 00:00:00 2001 From: Eric Abrahamsen <e...@ericabrahamsen.net> Date: Sat, 9 Aug 2014 16:40:11 +0800 Subject: [PATCH] Fully create snarfed records before merging them * lisp/bbdb-snarf.el (bbdb-snarf): When snarfing a record that may already exist, `bbdb-snarf' uses `bbdb-merge-records' to merge them. Merging won't work unless the new record is fully created (ie cached). --- lisp/bbdb-snarf.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/bbdb-snarf.el b/lisp/bbdb-snarf.el index aa3f00a..9c39f6c 100644 --- a/lisp/bbdb-snarf.el +++ b/lisp/bbdb-snarf.el @@ -318,10 +318,10 @@ See `bbdb-snarf-rule-alist' for details." (bbdb-record-firstname record) (bbdb-record-lastname record)) (car (bbdb-record-mail record)))))) + ;; create new record + (bbdb-change-record record t t) (if old-record (bbdb-merge-records old-record record) - ;; create new record - (bbdb-change-record record t t) (bbdb-display-records (list record)) record)))) -- 2.0.4
------------------------------------------------------------------------------
_______________________________________________ bbdb-info@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bbdb-info BBDB Home Page: http://bbdb.sourceforge.net/