[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] scratch/org-contacts-rebased 3b371ff 080/118: org-contacts.el: Ca
From: |
Stefan Monnier |
Subject: |
[elpa] scratch/org-contacts-rebased 3b371ff 080/118: org-contacts.el: Catch `nextfile' in `org-contacts-db' |
Date: |
Fri, 12 Nov 2021 15:37:08 -0500 (EST) |
branch: scratch/org-contacts-rebased
commit 3b371ff15b53e90426262085b2a74014a7f31e7c
Author: Philippe Crama <phcrama.ebiz@gmx.com>
Commit: Nicolas Goaziou <mail@nicolasgoaziou.fr>
org-contacts.el: Catch `nextfile' in `org-contacts-db'
* org-contacts.el (org-contacts-db): Catch `nextfile'.
When a file in the list returned by the `org-contacts-files' function
doesn't exist and the user selects the option to attempt to remove it
from the `org-agenda-files' list, 'nextfile is thrown. Catch it and
skip processing that file instead of failing.
TINYCHANGE
---
org-contacts.el | 41 +++++++++++++++++++++++++++++++----------
1 file changed, 31 insertions(+), 10 deletions(-)
diff --git a/org-contacts.el b/org-contacts.el
index bc07fc1..edc09fe 100644
--- a/org-contacts.el
+++ b/org-contacts.el
@@ -261,16 +261,37 @@ to dead or no buffer."
(make-progress-reporter "Updating Org Contacts Database..." 0
(length org-contacts-files)))
(i 0))
(dolist (file (org-contacts-files))
- (org-check-agenda-file file)
- (with-current-buffer (org-get-agenda-file-buffer file)
- (unless (eq major-mode 'org-mode)
- (error "File %s is not in `org-mode'" file))
- (setf result
- (append result
- (org-scan-tags
- 'org-contacts-at-point
- contacts-matcher
- todo-only))))
+ (if (catch 'nextfile
+ ;; if file doesn't exist and the user agrees to removing it
+ ;; from org-agendas-list, 'nextfile is thrown. Catch it here
+ ;; and skip processing the file.
+ ;;
+ ;; TODO: suppose that the user has set an org-contacts-files
+ ;; list that contains an element that doesn't exist in the
+ ;; file system: in that case, the org-agenda-files list could
+ ;; be updated (and saved to the customizations of the user) if
+ ;; it contained the same file even though the org-agenda-files
+ ;; list wasn't actually used. I don't think it is normal that
+ ;; org-contacts updates org-agenda-files in this case, but
+ ;; short of duplicating org-check-agenda-files and
+ ;; org-remove-files, I don't know how to avoid it.
+ ;;
+ ;; A side effect of the TODO is that the faulty
+ ;; org-contacts-files list never gets updated and thus the
+ ;; user is always queried about the missing files when
+ ;; org-contacts-db-need-update-p returns true.
+ (org-check-agenda-file file))
+ (message "Skipped %s removed from org-agenda-files list."
+ (abbreviate-file-name file))
+ (with-current-buffer (org-get-agenda-file-buffer file)
+ (unless (eq major-mode 'org-mode)
+ (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))))
(setf org-contacts-db result
org-contacts-last-update (current-time))
- [elpa] scratch/org-contacts-rebased 5e67fd8 068/118: Update copyright years., (continued)
- [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, 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 <=
- [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
- [elpa] scratch/org-contacts-rebased fd660ce 111/118: Tidy up whitespace, Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased 7b87e73 106/118: Prefer HTTPS to HTTP in most links, Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased 03dc64d 110/118: Change how completion is done, Stefan Monnier, 2021/11/12