Re: BBDBv3 will lost record when snarf an exist email to database.
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/
Re: BBDBv3 will lost record when snarf an exist email to database.
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. Thanks, I installed a slightly different patch which also ensures that the new record is always displayed. On a related issue: the rules currently used by bbdb-snarf are somewhat heuristic and not the most reliable. If someone comes up with new / better rules, please post them here. 2014-08-09 Roland Winkler wink...@gnu.org * lisp/bbdb-snarf.el (bbdb-snarf): Always install and display the new record. BBDB is available at http://savannah.nongnu.org/projects/bbdb/ -- ___ bbdb-info@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bbdb-info BBDB Home Page: http://bbdb.sourceforge.net/
Re: BBDBv3 will lost record when snarf an exist email to database.
I add a keybind to `bbdb-snarf`. So when I'm in am email of Org-mode thread. 1. At the line of header To: Org-mode emacs-orgm...@gnu.com 2. press that keybinding (bbdb-snarf). 3. I already have a record in BBDB database, then BBDB popup error: (error BBDB: marker absent). My Emacs version: 24.3.50.1 My Linux: Ubuntu 14.20 And here is my BBDB init file: ```emacs-lisp (require 'bbdb) ;; (bbdb-initialize) (bbdb-initialize 'message 'sendmail 'supercite 'w3 'gnus) (unless (boundp 'my-bbdb-prefix-map) (define-prefix-command 'my-bbdb-prefix-map)) (define-key my-tools-prefix-map (kbd b) 'my-bbdb-prefix-map) (defun my-bbdb-open-or-switch () (interactive) (if (get-buffer *BBDB*) (switch-to-buffer *BBDB*) (bbdb ) (bury-buffer) (switch-to-buffer *BBDB*))) (define-key my-bbdb-prefix-map (kbd b) 'my-bbdb-open-or-switch) (define-key my-bbdb-prefix-map (kbd c) 'bbdb-create) ;; usage: region select name and email part in To: field. then press this keybinding. (define-key my-bbdb-prefix-map (kbd a) 'bbdb-snarf) (define-key my-bbdb-prefix-map (kbd h) 'helm-bbdb) (setq bbdb-file (expand-file-name ~/Org/BBDB/bbdb) bbdb-completion-display-record t bbdb-image 'name ; display records with an image. bbdb-image-path (expand-file-name ~/Org/BBDB/avatars/) ;; bbdb-image-suffixes '(.png .jpg .gif .xpm) ;; bbdb-sound-files bbdb-default-label-list '(personal home work company organization other) bbdb-default-country China bbdb-dial-local-prefix 86 ; +86 TODO: is this right? bbdb-default-area-code 86 bbdb-snarf-rule-alist '((us bbdb-snarf-surrounding-space ;; bbdb-snarf-phone-nanp bbdb-snarf-url bbdb-snarf-mail bbdb-snarf-empty-lines bbdb-snarf-name ;; bbdb-snarf-address-us bbdb-snarf-empty-lines ;; bbdb-snarf-notes bbdb-snarf-name-mail) (mail bbdb-snarf-mail-address)) bbdb-snarf-default-label-alist '((phone . work) (address . work) (company . company)) bbdb-snarf-rule-default 'mail ;; bbdb-snarf-url 'url ;; bbdb-address-format-list bbdb-add-mails 'query ;; bbdb-time-stamp-format %Y-%m-%d %r %Z ;; bbdb-address-label-list bbdb-need-to-sort t ;; bbdb-case-fold-search nil bbdb-completion-list t bbdb-complete-mail t bbdb-completion-display-record t bbdb-new-mails-primary 'query ;; bbdb-ignore-redundant-mails 'query bbdb-ignore-message-alist '((From . no.?reply\\|DAEMON\\|daemon\\|facebookmail\\|twitter) ;; ((To CC) . mailing-list-1\\|mailing-list-2) ) ) ;;; define variant faces for variant xfields ;; TODO: improve it (setq bbdb-name-face-alist '((mail . bbdb-field-mail) (mail-alias . bbdb-field-mail-alias))) (defface bbdb-field-mail '((t (:inherit bbdb-field-name :foreground green yellow))) Face used for BBDB fields. :group 'bbdb-faces) (defface bbdb-field-mail-alias '((t (:inherit bbdb-field-name :foreground yellow))) Face used for BBDB fields. :group 'bbdb-faces) (dolist (hook '(message-setup-hook mu4e-compose-mode-hook )) (add-hook hook 'bbdb-mail-aliases)) ;;; BBDB [M-TAB] conflicts with ispell. ;; name email, name email (defun my-enable-bbdb-complete-key () (define-key message-mode-map (kbd M-TAB) 'bbdb-complete-mail)) (dolist (hook '(message-mode-hook mu4e-compose-mode-hook )) (add-hook hook 'my-enable-bbdb-complete-key)) ``` [stardiviner] Hack this world! GPG key ID: 47C32433 IRC(freeenode): stardiviner Twitter: @numbchild Key fingerprint = 9BAA 92BC CDDD B9EF 3B36 CB99 B8C4 B8E5 47C3 2433 Blog: http://nagatopain-blog.logdown.com/ On Sat, Aug 2, 2014 at 12:23 PM, Roland Winkler wink...@gnu.org wrote: 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. -- Infragistics Professional Build stunning
Re: BBDBv3 will lost record when snarf an exist email to database.
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. -- Want fast and easy access to all the code in your enterprise? Index and search up to 200,000 lines of code with a free copy of Black Duck Code Sight - the same software that powers the world's largest code search on Ohloh, the Black Duck Open Hub! Try it now. http://p.sf.net/sfu/bds ___ bbdb-info@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bbdb-info BBDB Home Page: http://bbdb.sourceforge.net/