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 CF413431FB6 for ; Mon, 8 Apr 2013 23:32:09 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] 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 KigqdARTbsVT for ; Mon, 8 Apr 2013 23:32:05 -0700 (PDT) Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) by olra.theworths.org (Postfix) with ESMTP id 6036B431FAE for ; Mon, 8 Apr 2013 23:32:05 -0700 (PDT) Received: from guru.guru-group.fi (localhost [IPv6:::1]) by guru.guru-group.fi (Postfix) with ESMTP id F1F60100093; Tue, 9 Apr 2013 09:32:02 +0300 (EEST) From: Tomi Ollila To: Jed Brown , David Bremner , Jani Nikula , Karl Fogel , Daniel Bergey Subject: Re: [PATCH] emacs: add missing paren to fix defun in notmuch-address.el. In-Reply-To: <87ip3wbj7g.fsf@mcs.anl.gov> References: <87wqsfik5l.fsf@floss.red-bean.com> <87mwtah2hd.fsf@zancas.localnet> <877gkeau42.fsf@floss.red-bean.com> <8738v1jtzc.fsf@nikula.org> <87k3odgutd.fsf@zancas.localnet> <87ip3wbj7g.fsf@mcs.anl.gov> User-Agent: Notmuch/0.15.2+75~gd7fa7c4 (http://notmuchmail.org) Emacs/24.3.1 (x86_64-unknown-linux-gnu) X-Face: HhBM'cA~ MIME-Version: 1.0 Content-Type: text/plain Cc: notmuch@notmuchmail.org 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: Tue, 09 Apr 2013 06:32:11 -0000 On Tue, Apr 09 2013, Jed Brown wrote: > David Bremner writes: > >> Squashed sounds good to me too. Sorry I'm too lazy/busy at the moment to >> do it myself. > > I tested the attached and it's working as expected. Sent as an > attachment to preserve author information. LGTM (this time tested, too). Also compared diffs by hand, change as announced. comments in id:m26207wgyt.fsf@guru.guru-group.fi (amend!) apply. Tomi >>From 5404ac5bf13f8b5349d5b94f9f2000e9d1832b83 Mon Sep 17 00:00:00 2001 > From: Daniel Bergey > Date: Mon, 8 Apr 2013 19:55:04 -0500 > Subject: [PATCH] emacs: functions to import sender or recipient into BBDB [v2] > >>From a show buffer, notmuch-bbdb/snarf-from imports the sender into > bbdb. notmuch-bbdb/snarf-to imports all recipients. Newly imported > contacts are reported in the minibuffer / Messages buffer. > > Both functions use the BBDB parser to recognize email address formats. > > [v2] Fixes missing close parenthesis in original. > Spotted by Karl Fogel . > --- > emacs/notmuch-address.el | 41 +++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 41 insertions(+) > > diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el > index 2bf762b..4eda098 100644 > --- a/emacs/notmuch-address.el > +++ b/emacs/notmuch-address.el > @@ -96,6 +96,47 @@ line." > (when (notmuch-address-locate-command notmuch-address-command) > (notmuch-address-message-insinuate)) > > +;; functions to add sender / recipients to BBDB > + > +(defun notmuch-bbdb/snarf-headers (headers) > + ;; Helper function to avoid code duplication in the two below > + ;; headers should have the same format as bbdb-get-addresses-headers > + > + ;; bbdb-get-addresses reads these > + ;; Ugh, pass-by-global > + (let ((addrs (bbdb-get-addresses nil nil 'notmuch-bbdb/get-header-content)) > + (bbdb-get-addresses-headers headers) ; headers to read > + (bbdb-gag-messages t)) ; suppress m/n processed message) > + (bbdb-update-records addrs t t))) > + > +(defun notmuch-bbdb/snarf-from () > + "Import the sender of the current message into BBDB" > + (interactive) > + (notmuch-bbdb/snarf-headers > + (list (assoc 'authors bbdb-get-addresses-headers)))) > + > +(defun notmuch-bbdb/snarf-to () > + "Import all recipients of the current message into BBDB" > + (interactive) > + (notmuch-bbdb/snarf-headers > + (list (assoc 'recipients bbdb-get-addresses-headers)))) > + > +(defvar notmuch-bbdb/header-by-name > + ;; both are case sensitive > + '( ("From" . :From) > + ("To" . :To) > + ("CC" . :Cc) > + ("BCC" . :Bcc) > + ("Resent-From" . nil) > + ("Reply-To" . nil) > + ("Resent-To" . nil) > + ("Resent-CC" . nil)) > + "Alist for dispatching header symbols as used by notmuch-show-get-header > +from strings as used by bbdb-get-addresses") > + > +(defun notmuch-bbdb/get-header-content (name) > + (notmuch-show-get-header (cdr (assoc name notmuch-bbdb/header-by-name)))) > + > ;; > > (provide 'notmuch-address) > -- > 1.8.2.1 > > _______________________________________________ > notmuch mailing list > notmuch@notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch