[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] scratch/org-contacts-rebased dbe6325 065/118: org-contacts: Ensur
From: |
Stefan Monnier |
Subject: |
[elpa] scratch/org-contacts-rebased dbe6325 065/118: org-contacts: Ensure contacts cache is updated if it contains markers with no buffer |
Date: |
Fri, 12 Nov 2021 15:37:05 -0500 (EST) |
branch: scratch/org-contacts-rebased
commit dbe63250fd265210545849a8928d65cb26af838d
Author: Øyvind Stegard <oyvind.stegard@ifi.uio.no>
Commit: Grégoire Jadi <gregoire.jadi@gmail.com>
org-contacts: Ensure contacts cache is updated if it contains markers with
no buffer
* contrib/lisp/org-contacts.el (org-contacts-db-need-update-p):
Check if org-contacts-db cache contains markers with no buffer as well, when
determining if cache should be updated from files.
The function `org-contacts-db-need-update-p' does two checks to determine
if the
contacts cache should be updated:
1. If the variable `org-contacts-last-update' is nil.
2. If modification time of any file containing contacts is more recent than
timestamp recorded in `org-contacts-last-update'.
There is another case where an update is required: when marker objects
contained
in the contact cache `org-contacts-db' suddenly point to no buffer. If a
buffer
containing contacts is killed, but underlying file is not modified,
org-contacts
will not detect this, and cached markers that pointed to the now killed
buffer
will become "dead" (e.g. have no buffer associated with them). This seems
to cause
problems for instance in `org-contacts-anniversaries', which if used as
diary
sexp in agenda file, will cause "Bad sexp" errors.
---
org-contacts.el | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/org-contacts.el b/org-contacts.el
index 71f7bf4..a220993 100644
--- a/org-contacts.el
+++ b/org-contacts.el
@@ -224,7 +224,20 @@ A regexp matching strings of whitespace, `,' and `;'.")
(org-find-if (lambda (file)
(or (time-less-p org-contacts-last-update
(elt (file-attributes file) 5))))
- (org-contacts-files))))
+ (org-contacts-files))
+ (org-contacts-db-has-dead-markers-p org-contacts-db)))
+
+(defun org-contacts-db-has-dead-markers-p (org-contacts-db)
+ "Returns t if at least one dead marker is found in
+ORG-CONTACTS-DB. A dead marker in this case is a marker pointing
+to dead or no buffer."
+ ;; Scan contacts list looking for dead markers, and return t at first
found.
+ (catch 'dead-marker-found
+ (while org-contacts-db
+ (unless (marker-buffer (nth 1 (car org-contacts-db)))
+ (throw 'dead-marker-found t))
+ (setq org-contacts-db (cdr org-contacts-db)))
+ nil))
(defun org-contacts-db ()
"Return the latest Org Contacts Database."
- [elpa] scratch/org-contacts-rebased 5526110 018/118: Merge branch 'origin-maint', (continued)
- [elpa] scratch/org-contacts-rebased 5526110 018/118: Merge branch 'origin-maint', Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased 68918fc 034/118: org-contacts: Fix Agenda format., Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased 85b506b 031/118: contrib/lisp/org-contacts.el: Delete trailing whitespaces, Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased 30a76d5 038/118: org-contacts.el: Rename a function to follow emacs-lisp coding conventions, Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased 57a9545 041/118: contrib/lisp/org-contacts.el: Fix compiler warnings., Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased f4f5ff3 050/118: org-contacts.el (org-contacts-export-as-vcard): Don't use non-existent function `org-install-letbind', Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased f07f259 049/118: org-contacts.el, add tel property, Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased 7f9ad6a 059/118: contrib/lisp/org-contacts.el: Permit to unload properly `org-contacts', Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased c71bbd2 060/118: contrib/lisp/org-contacts.el (org-contacts-vcard-format): Silence byte-compiler, Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased f259246 063/118: contrib/lisp/org-contacts.el: Add a complex org-contacts template to the file header, Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased dbe6325 065/118: org-contacts: Ensure contacts cache is updated if it contains markers with no buffer,
Stefan Monnier <=
- [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