From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: [PATCH] org-contacts: Fix org-contacts-gnus-article-from-goto Date: Sat, 4 May 2013 18:49:14 +0200 Message-ID: References: <877gjezvis.fsf@rodney.id.au> Mime-Version: 1.0 (Mac OS X Mail 6.3 \(1503\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([208.118.235.92]:43233) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UYfeA-0004nW-Dt for emacs-orgmode@gnu.org; Sat, 04 May 2013 12:49:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UYfe9-0001lj-8z for emacs-orgmode@gnu.org; Sat, 04 May 2013 12:49:18 -0400 Received: from mail-wi0-x229.google.com ([2a00:1450:400c:c05::229]:40354) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UYfe9-0001le-22 for emacs-orgmode@gnu.org; Sat, 04 May 2013 12:49:17 -0400 Received: by mail-wi0-f169.google.com with SMTP id h11so1598770wiv.2 for ; Sat, 04 May 2013 09:49:16 -0700 (PDT) In-Reply-To: <877gjezvis.fsf@rodney.id.au> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Rodney Lorrimar Cc: emacs-orgmode@gnu.org Applied, thanks. - Carsten On 4.5.2013, at 16:09, Rodney Lorrimar wrote: > * contrib/lisp/org-contacts.el (org-contacts-filter): Add a PROP-MATCH > argument. > (org-contacts-gnus-article-from-get-marker): Search for email as a > property not a tag. >=20 > `org-contacts-gnus-article-from-get-marker' seems to assume that the > contact properties exist within the contact's tags as colon-separated > KEY=3D{VALUE} entries. This isn't the case for me, using org-mode = from > git master. >=20 > This commit adds a PROP-MATCH argument to `org-contacts-filter' so > that `org-contacts-gnus-article-from-get-marker` can filter by the > EMAIL property. > --- > contrib/lisp/org-contacts.el | 19 +++++++++++++++---- > 1 file changed, 15 insertions(+), 4 deletions(-) >=20 > diff --git a/contrib/lisp/org-contacts.el = b/contrib/lisp/org-contacts.el > index c72e6c0..c84f1f2 100644 > --- a/contrib/lisp/org-contacts.el > +++ b/contrib/lisp/org-contacts.el > @@ -233,10 +233,15 @@ A regexp matching strings of whitespace, `,' and = `;'.") > (progress-reporter-done progress-reporter))) > org-contacts-db)) >=20 > -(defun org-contacts-filter (&optional name-match tags-match) > - "Search for a contact matching NAME-MATCH and TAGS-MATCH. > -If both match values are nil, return all contacts." > +(defun org-contacts-filter (&optional name-match tags-match = prop-match) > + "Search for a contact matching any of NAME-MATCH, TAGS-MATCH, = PROP-MATCH. > +If all match values are nil, return all contacts. > + > +The optional PROP-MATCH argument is a single (PROP . VALUE) cons > +cell corresponding to the contact properties. > +" > (if (and (null name-match) > + (null prop-match) > (null tags-match)) > (org-contacts-db) > (loop for contact in (org-contacts-db) > @@ -244,6 +249,11 @@ If both match values are nil, return all = contacts." > (and name-match > (org-string-match-p name-match > (first contact))) > + (and prop-match > + (org-find-if (lambda (prop) > + (and (string=3D (car prop-match) (car = prop)) > + (org-string-match-p (cdr = prop-match) (cdr prop)))) > + (caddr contact))) > (and tags-match > (org-find-if (lambda (tag) > (org-string-match-p tags-match tag)) > @@ -523,7 +533,8 @@ A group FOO is composed of contacts with the tag = FOO." > (email (cadr address))) > (cadar (or (org-contacts-filter > nil > - (concat org-contacts-email-property "=3D{\\b" = (regexp-quote email) "\\b}")) > + nil > + (cons org-contacts-email-property (concat "\\b" = (regexp-quote email) "\\b"))) > (when name > (org-contacts-filter > (concat "^" name "$"))))))) > --=20 > 1.7.10.4 >=20