From c01dd4a6930c651cd26117ba2e0ef7bcdaf1d494 Mon Sep 17 00:00:00 2001 From: Ethan Glasser-Camp Date: Sat, 20 Oct 2012 18:52:21 +2000 Subject: [PATCH] Re: [PATCH] emacs: functions to import sender or recipient into BBDB --- f1/e8f48d89e35b5ab01bb85f2d19b46b78302c11 | 129 ++++++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 f1/e8f48d89e35b5ab01bb85f2d19b46b78302c11 diff --git a/f1/e8f48d89e35b5ab01bb85f2d19b46b78302c11 b/f1/e8f48d89e35b5ab01bb85f2d19b46b78302c11 new file mode 100644 index 000000000..e75ef118f --- /dev/null +++ b/f1/e8f48d89e35b5ab01bb85f2d19b46b78302c11 @@ -0,0 +1,129 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 1B7E0431FB6 + for ; Fri, 19 Oct 2012 15:52:36 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.799 +X-Spam-Level: +X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5 + tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, + FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id 7AenKUxZHGnI for ; + Fri, 19 Oct 2012 15:52:35 -0700 (PDT) +Received: from mail-vb0-f53.google.com (mail-vb0-f53.google.com + [209.85.212.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 943D9431FAE + for ; Fri, 19 Oct 2012 15:52:35 -0700 (PDT) +Received: by mail-vb0-f53.google.com with SMTP id fc21so1116425vbb.26 + for ; Fri, 19 Oct 2012 15:52:35 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; + h=from:to:subject:in-reply-to:references:user-agent:date:message-id + :mime-version:content-type; + bh=slL/GRs+fqTXvkRcmrMM8m2y0WmGzdsiRnMddRYUf6I=; + b=wp0y09KDSxzEPBeZhvZ++oP8U/b2XiASueuTkSRNMY3eLBI+Gyl9LKeZs+yXqMe/bl + 4LNNuvPoqcXfSbEF+kSbdr2yIck4/N+MHBuc1Iom5wUZlJaB2pdKyQE9auA6NKEBsrpR + Un3L2ezg3fNXJufeJkLOW/4UpzomNkqYCF23QvOszzsRnP1ELSt/zuVd/cnz9awUQi8L + orSw3Vvd0QK2duWGY8AYuHTG3KRW/nqP7emm1pC7OWCEOmkIgmhF3FllTiVrMX5brrgs + 48cVDrGVdonMrd+VmSKq6h1j6f/5zCQkmTMS0mHBczch4MmZpZu960icVmkQzoHu94qD + ZDUw== +Received: by 10.220.226.7 with SMTP id iu7mr3563568vcb.64.1350687154986; + Fri, 19 Oct 2012 15:52:34 -0700 (PDT) +Received: from smtp.gmail.com (p70-80.acedsl.com. [66.114.70.80]) + by mx.google.com with ESMTPS id o13sm2731358vde.21.2012.10.19.15.52.32 + (version=TLSv1/SSLv3 cipher=OTHER); + Fri, 19 Oct 2012 15:52:33 -0700 (PDT) +From: Ethan Glasser-Camp +To: Daniel Bergey , + Notmuch Mail List +Subject: Re: [PATCH] emacs: functions to import sender or recipient into BBDB +In-Reply-To: <87lii62sk2.fsf@wonderlust.lan> +References: <87lii62sk2.fsf@wonderlust.lan> +User-Agent: Notmuch/0.14+45~g6ea9330 (http://notmuchmail.org) Emacs/23.3.1 + (x86_64-pc-linux-gnu) +Date: Fri, 19 Oct 2012 18:52:21 -0400 +Message-ID: <87ipa66pne.fsf@betacantrips.com> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Fri, 19 Oct 2012 22:52:36 -0000 + +Daniel Bergey 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" ? + +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 -- 2.26.2