[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] scratch/org-contacts-rebased dc57e62 058/118: org-contacts: Fix o
From: |
Stefan Monnier |
Subject: |
[elpa] scratch/org-contacts-rebased dc57e62 058/118: org-contacts: Fix org-contacts-gnus-article-from-goto |
Date: |
Fri, 12 Nov 2021 15:37:03 -0500 (EST) |
branch: scratch/org-contacts-rebased
commit dc57e626d974519e60f342c801084b3759faf042
Author: Rodney Lorrimar <rodney@rodney.id.au>
Commit: Carsten Dominik <carsten.dominik@gmail.com>
org-contacts: Fix org-contacts-gnus-article-from-goto
* 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.
`org-contacts-gnus-article-from-get-marker' seems to assume that the
contact properties exist within the contact's tags as colon-separated
KEY={VALUE} entries. This isn't the case for me, using org-mode from
git master.
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.
---
org-contacts.el | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/org-contacts.el b/org-contacts.el
index c72e6c0..c84f1f2 100644
--- a/org-contacts.el
+++ b/org-contacts.el
@@ -233,10 +233,15 @@ A regexp matching strings of whitespace, `,' and `;'.")
(progress-reporter-done progress-reporter)))
org-contacts-db))
-(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= (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 "={\\b" (regexp-quote
email) "\\b}"))
+ nil
+ (cons org-contacts-email-property (concat "\\b" (regexp-quote
email) "\\b")))
(when name
(org-contacts-filter
(concat "^" name "$")))))))
- [elpa] scratch/org-contacts-rebased f62bfeb 066/118: org-contacts: use `org-' prefixed variants of cl functions, (continued)
- [elpa] scratch/org-contacts-rebased f62bfeb 066/118: org-contacts: use `org-' prefixed variants of cl functions, Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased 13d35c9 072/118: Update copyright years again., Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased b970428 091/118: Rationalize `org-link-(un)escape', Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased 5a2519c 048/118: org-contacts.el, add note property, Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased 9dec69a 056/118: contrib/lisp/org-contacts: Introduce the constant `org-contacts-property-values-separators', Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased 5e67fd8 068/118: Update copyright years., Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased 666da7a 061/118: contrib/lisp/org-contacts.el: Add a feature, which can ignore emails or phones with property, Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased 7d47f48 062/118: contrib/lisp/org-contacts.el: Various formatting improvements and bug fixes, Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased a452869 067/118: un-hexify TEL links in vCard export, Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased e6e9fd8 071/118: Merge branch 'maint', Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased dc57e62 058/118: org-contacts: Fix org-contacts-gnus-article-from-goto,
Stefan Monnier <=
- [elpa] scratch/org-contacts-rebased 19baaca 073/118: Merge branch 'maint', Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased 5be58f1 075/118: contrib/lisp/org-contacts.el: Factorize the construction of the database, Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased 5e05b4d 077/118: contrib/lisp/org-contacts.el: Fix a bug when contacts don't have an email address, Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased 9c27250 078/118: contrib/lisp/org-contacts.el: Allow the user to customize interactively the vcard export, Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased 3b371ff 080/118: org-contacts.el: Catch `nextfile' in `org-contacts-db', Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased cfa1db0 081/118: Remove some home-grown copies of cl-lib functions., Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased ee973b2 087/118: Deprecate `org-find-if' in favor of `cl-find-if', Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased 204548b 092/118: Fix function declarations, Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased 79d7a88 096/118: org-contacts.el: Add support for org-id generated link., Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased a603ab3 099/118: org-contacts.el: replace obsolete alias `loop' with `cl-loop', Stefan Monnier, 2021/11/12