[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] scratch/org-contacts-rebased 5be58f1 075/118: contrib/lisp/org-co
From: |
Stefan Monnier |
Subject: |
[elpa] scratch/org-contacts-rebased 5be58f1 075/118: contrib/lisp/org-contacts.el: Factorize the construction of the database |
Date: |
Fri, 12 Nov 2021 15:37:07 -0500 (EST) |
branch: scratch/org-contacts-rebased
commit 5be58f146fbf4b5dcbefb611a8f00e3ecd223f33
Author: Grégoire Jadi <gregoire.jadi@gmail.com>
Commit: Grégoire Jadi <gregoire.jadi@gmail.com>
contrib/lisp/org-contacts.el: Factorize the construction of the database
* contrib/lisp/org-contacts.el (org-contacts-at-point): New function
used to return the contact at point.
(org-contacts-db): Factorize the construction of the database using
`org-contacts-at-point' and fix a small typo.
---
org-contacts.el | 27 ++++++++++++++++-----------
1 file changed, 16 insertions(+), 11 deletions(-)
diff --git a/org-contacts.el b/org-contacts.el
index ac43f9d..a7559f7 100644
--- a/org-contacts.el
+++ b/org-contacts.el
@@ -250,7 +250,7 @@ to dead or no buffer."
(let* (todo-only
(contacts-matcher
(cdr (org-make-tags-matcher org-contacts-matcher)))
- markers result)
+ result)
(when (org-contacts-db-need-update-p)
(let ((progress-reporter
(make-progress-reporter "Updating Org Contacts Database..." 0
(length org-contacts-files)))
@@ -259,21 +259,26 @@ to dead or no buffer."
(org-check-agenda-file file)
(with-current-buffer (org-get-agenda-file-buffer file)
(unless (eq major-mode 'org-mode)
- (error "File %s is no in `org-mode'" file))
- (org-scan-tags
- '(add-to-list 'markers (set-marker (make-marker) (point)))
- contacts-matcher
- todo-only))
+ (error "File %s is not in `org-mode'" file))
+ (setf result
+ (append result
+ (org-scan-tags
+ 'org-contacts-at-point
+ contacts-matcher
+ todo-only))))
(progress-reporter-update progress-reporter (setq i (1+ i))))
- (dolist (marker markers result)
- (org-with-point-at marker
- (add-to-list 'result
- (list (org-get-heading t) marker (org-entry-properties
marker 'all)))))
(setf org-contacts-db result
org-contacts-last-update (current-time))
- (progress-reporter-done progress-reporter)))
+ (progress-reporter-done progress-reporter)))
org-contacts-db))
+(defun org-contacts-at-point (&optional pom)
+ "Return the contacts at point-or-marker POM or current position
+if nil."
+ (setq pom (or pom (point)))
+ (org-with-point-at pom
+ (list (org-get-heading t) (set-marker (make-marker) pom)
(org-entry-properties pom 'all))))
+
(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.
- [elpa] scratch/org-contacts-rebased b970428 091/118: Rationalize `org-link-(un)escape', (continued)
- [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, 2021/11/12
- [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 <=
- [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
- [elpa] scratch/org-contacts-rebased 38f7b80 100/118: org-contacts.el: Only use org-id-store-link if org-id is loaded, Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased 3d068b7 104/118: org-contacts.el: Display contacts buffer result., Stefan Monnier, 2021/11/12