Daniel Bergey <bergey at alum.mit.edu> writes: > From a show buffer, bbdb/notmuch-snarf-from imports the sender into > bbdb. bbdb/notmuch-snarf-to attempts to import all recipients. BBDB > displays a buffer with each contact; C-g displays the next contact, or > returns to the notmuch-show buffer. > > This is my first notmuch patch. Comments very welcome.
Hi! > emacs/notmuch-show.el | 28 ++++++++++++++++++++++++++++ I don't think this belongs in notmuch-show. My first inclination is that this should go into a new file contrib/notmuch-bbdb.el (assuming there's no other notmuch-bbdb integration stuff floating around). > 1 file changed, 28 insertions(+) > > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el > index 6335d45..3bc1da0 100644 > --- a/emacs/notmuch-show.el > +++ b/emacs/notmuch-show.el > @@ -1895,6 +1895,34 @@ the user (see > `notmuch-show-stash-mlarchive-link-alist')." > (button-get button :notmuch-filename) > (button-get button :notmuch-content-type))))))) > > +;; bbdb interaction functions, awaiting user keybindings > + > +(defun bbdb/snarf-between-commas () > + ; What about names written "Surname, First M" <user at server.tld>? Most comments in emacslisp start with two semicolons. I do think more sophisticated parsing is necessary. If you're lucky, somebody else already has a library to parse email addresses in this form. > + (goto-char (point-min)) I'm not crazy about this. It's probably fine for something limited to bbdb users (especially since bbdb-snarf uses a very similar technique), but I think the better approach here is to just take a region and go from region-beginning and region-end. > + (let ((comma (point))) > + (while (search-forward "," nil "end") The third argument of search-forward is NOERROR. I don't understand what the value "end" means. The help says "Optional third argument, if t..." > + (bbdb-snarf-region comma (point)) > + (setq comma (point))) > + (bbdb-snarf-region comma (point)) ; last entry > + )) Doesn't this cause snarf the comma into any of those entries? It seems like point starts before the first entry but then goes before each comma. Obviously this wouldn't be here if it didn't work. I thought bbdb-snarf handled this kind of thing, but it doesn't. Could you explain this? Ethan