Re: [PATCH] emacs: functions to import sender or recipient into BBDB
authorEthan Glasser-Camp <ethan.glasser.camp@gmail.com>
Fri, 19 Oct 2012 22:52:21 +0000 (18:52 +2000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:49:53 +0000 (09:49 -0800)
f1/e8f48d89e35b5ab01bb85f2d19b46b78302c11 [new file with mode: 0644]

diff --git a/f1/e8f48d89e35b5ab01bb85f2d19b46b78302c11 b/f1/e8f48d89e35b5ab01bb85f2d19b46b78302c11
new file mode 100644 (file)
index 0000000..e75ef11
--- /dev/null
@@ -0,0 +1,129 @@
+Return-Path: <ethan.glasser.camp@gmail.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 1B7E0431FB6\r
+       for <notmuch@notmuchmail.org>; Fri, 19 Oct 2012 15:52:36 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.799\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id 7AenKUxZHGnI for <notmuch@notmuchmail.org>;\r
+       Fri, 19 Oct 2012 15:52:35 -0700 (PDT)\r
+Received: from mail-vb0-f53.google.com (mail-vb0-f53.google.com\r
+       [209.85.212.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 943D9431FAE\r
+       for <notmuch@notmuchmail.org>; Fri, 19 Oct 2012 15:52:35 -0700 (PDT)\r
+Received: by mail-vb0-f53.google.com with SMTP id fc21so1116425vbb.26\r
+       for <notmuch@notmuchmail.org>; Fri, 19 Oct 2012 15:52:35 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+       h=from:to:subject:in-reply-to:references:user-agent:date:message-id\r
+       :mime-version:content-type;\r
+       bh=slL/GRs+fqTXvkRcmrMM8m2y0WmGzdsiRnMddRYUf6I=;\r
+       b=wp0y09KDSxzEPBeZhvZ++oP8U/b2XiASueuTkSRNMY3eLBI+Gyl9LKeZs+yXqMe/bl\r
+       4LNNuvPoqcXfSbEF+kSbdr2yIck4/N+MHBuc1Iom5wUZlJaB2pdKyQE9auA6NKEBsrpR\r
+       Un3L2ezg3fNXJufeJkLOW/4UpzomNkqYCF23QvOszzsRnP1ELSt/zuVd/cnz9awUQi8L\r
+       orSw3Vvd0QK2duWGY8AYuHTG3KRW/nqP7emm1pC7OWCEOmkIgmhF3FllTiVrMX5brrgs\r
+       48cVDrGVdonMrd+VmSKq6h1j6f/5zCQkmTMS0mHBczch4MmZpZu960icVmkQzoHu94qD\r
+       ZDUw==\r
+Received: by 10.220.226.7 with SMTP id iu7mr3563568vcb.64.1350687154986;\r
+       Fri, 19 Oct 2012 15:52:34 -0700 (PDT)\r
+Received: from smtp.gmail.com (p70-80.acedsl.com. [66.114.70.80])\r
+       by mx.google.com with ESMTPS id o13sm2731358vde.21.2012.10.19.15.52.32\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Fri, 19 Oct 2012 15:52:33 -0700 (PDT)\r
+From: Ethan Glasser-Camp <ethan.glasser.camp@gmail.com>\r
+To: Daniel Bergey <bergey@alum.mit.edu>,\r
+       Notmuch Mail List <notmuch@notmuchmail.org>\r
+Subject: Re: [PATCH] emacs: functions to import sender or recipient into BBDB\r
+In-Reply-To: <87lii62sk2.fsf@wonderlust.lan>\r
+References: <87lii62sk2.fsf@wonderlust.lan>\r
+User-Agent: Notmuch/0.14+45~g6ea9330 (http://notmuchmail.org) Emacs/23.3.1\r
+       (x86_64-pc-linux-gnu)\r
+Date: Fri, 19 Oct 2012 18:52:21 -0400\r
+Message-ID: <87ipa66pne.fsf@betacantrips.com>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Fri, 19 Oct 2012 22:52:36 -0000\r
+\r
+Daniel Bergey <bergey@alum.mit.edu> writes:\r
+\r
+> From a show buffer, bbdb/notmuch-snarf-from imports the sender into\r
+> bbdb.  bbdb/notmuch-snarf-to attempts to import all recipients.  BBDB\r
+> displays a buffer with each contact; C-g displays the next contact, or\r
+> returns to the notmuch-show buffer.\r
+>\r
+> This is my first notmuch patch.  Comments very welcome.\r
+\r
+Hi!\r
+\r
+>  emacs/notmuch-show.el |   28 ++++++++++++++++++++++++++++\r
+\r
+I don't think this belongs in notmuch-show. My first inclination is that\r
+this should go into a new file contrib/notmuch-bbdb.el (assuming there's\r
+no other notmuch-bbdb integration stuff floating around).\r
+\r
+>  1 file changed, 28 insertions(+)\r
+>\r
+> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+> index 6335d45..3bc1da0 100644\r
+> --- a/emacs/notmuch-show.el\r
+> +++ b/emacs/notmuch-show.el\r
+> @@ -1895,6 +1895,34 @@ the user (see `notmuch-show-stash-mlarchive-link-alist')."\r
+>                      (button-get button :notmuch-filename)\r
+>                      (button-get button :notmuch-content-type)))))))\r
+>\r
+> +;; bbdb interaction functions, awaiting user keybindings\r
+> +\r
+> +(defun bbdb/snarf-between-commas ()\r
+> +  ; What about names written "Surname, First M" <user@server.tld>?\r
+\r
+Most comments in emacslisp start with two semicolons.\r
+\r
+I do think more sophisticated parsing is necessary. If you're lucky,\r
+somebody else already has a library to parse email addresses in this\r
+form.\r
+\r
+> +  (goto-char (point-min))\r
+\r
+I'm not crazy about this. It's probably fine for something limited to\r
+bbdb users (especially since bbdb-snarf uses a very similar technique),\r
+but I think the better approach here is to just take a region and go\r
+from region-beginning and region-end.\r
+\r
+> +  (let ((comma (point)))\r
+> +    (while (search-forward "," nil "end")\r
+\r
+The third argument of search-forward is NOERROR. I don't understand what\r
+the value "end" means. The help says "Optional third argument, if t..."\r
+\r
+> +      (bbdb-snarf-region comma (point))\r
+> +      (setq comma (point)))\r
+> +    (bbdb-snarf-region comma (point)) ; last entry\r
+> +   ))\r
+\r
+Doesn't this cause snarf the comma into any of those entries? It seems\r
+like point starts before the first entry but then goes before each\r
+comma. Obviously this wouldn't be here if it didn't work. I thought\r
+bbdb-snarf handled this kind of thing, but it doesn't. Could you explain\r
+this?\r
+\r
+Ethan\r