emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] scratch/org-contacts-rebased 927e7c7 035/118: org-contacts.el: Ch


From: Stefan Monnier
Subject: [elpa] scratch/org-contacts-rebased 927e7c7 035/118: org-contacts.el: Check if the database need a refresh in a dedicated function
Date: Fri, 12 Nov 2021 15:36:59 -0500 (EST)

branch: scratch/org-contacts-rebased
commit 927e7c7c1882c70ee70a086bcd3d7217d6a616c2
Author: Grégoire Jadi <gregoire.jadi@gmail.com>
Commit: Grégoire Jadi <gregoire.jadi@gmail.com>

    org-contacts.el: Check if the database need a refresh in a dedicated 
function
    
    * contrib/lisp/org-contacts.el (org-contacts-db-need-update?): New
      function to determine whether we need to refresh `org-contacts-db'.
    
    (org-contacts-db): Use `org-contacts-db-need-updated?'.
---
 org-contacts.el | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/org-contacts.el b/org-contacts.el
index 3ad581d..786650b 100644
--- a/org-contacts.el
+++ b/org-contacts.el
@@ -149,19 +149,21 @@ This overrides `org-email-link-description-format' if 
set."
   "Return list of Org files to use for contact management."
   (or org-contacts-files (org-agenda-files t 'ifmode)))
 
+(defun org-contacts-db-need-update? ()
+  "Determine whether `org-contacts-db' needs to be refreshed."
+  (or (null org-contacts-last-update)
+      (some (lambda (file)
+             (or (time-less-p org-contacts-last-update
+                              (elt (file-attributes file) 5))))
+           (org-contacts-files))))
+
 (defun org-contacts-db ()
   "Return the latest Org Contacts Database"
   (let* (todo-only
         (contacts-matcher
          (cdr (org-make-tags-matcher org-contacts-matcher)))
-        (need-update?
-         (or (null org-contacts-last-update)
-             (some (lambda (file)
-                     (time-less-p org-contacts-last-update
-                                  (elt (file-attributes file) 5)))
-                   (org-contacts-files))))
         markers result)
-    (when need-update?
+    (when (org-contacts-db-need-update?)
       (message "Update Org Contacts Database")
       (dolist (file (org-contacts-files))
        (org-check-agenda-file file)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]