[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org-contacts d1298f4599 083/154: org-contacts.el: Catch
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org-contacts d1298f4599 083/154: org-contacts.el: Catch `nextfile' in `org-contacts-db' |
Date: |
Fri, 9 Sep 2022 15:58:35 -0400 (EDT) |
branch: externals/org-contacts
commit d1298f45991428c71af7be3803fc683db7da1df7
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 bc07fc1dd0..edc09feb8f 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] externals/org-contacts 4170ea25f3 090/154: Deprecate `org-find-if' in favor of `cl-find-if', (continued)
- [elpa] externals/org-contacts 4170ea25f3 090/154: Deprecate `org-find-if' in favor of `cl-find-if', ELPA Syncer, 2022/09/09
- [elpa] externals/org-contacts c1a17bf632 076/154: Merge branch 'maint', ELPA Syncer, 2022/09/09
- [elpa] externals/org-contacts 2de057e423 145/154: Make org-link-set-parameters <- org-add-link-type API compatible., ELPA Syncer, 2022/09/09
- [elpa] externals/org-contacts 21d4ae5367 141/154: Improve the alternative org-contacts headline goto., ELPA Syncer, 2022/09/09
- [elpa] externals/org-contacts c1c4cadf3f 151/154: Fix Warning: Unused lexical argument, ELPA Syncer, 2022/09/09
- [elpa] externals/org-contacts a50ced61ef 093/154: Update tel link definition, ELPA Syncer, 2022/09/09
- [elpa] externals/org-contacts f02da8b4de 088/154: org-contacts: Register "tel" link, ELPA Syncer, 2022/09/09
- [elpa] externals/org-contacts 80ab4708b7 114/154: Change how completion is done, ELPA Syncer, 2022/09/09
- [elpa] externals/org-contacts 1b028de47c 124/154: Fix contacts complete not working problem, ELPA Syncer, 2022/09/09
- [elpa] externals/org-contacts b1032119a3 152/154: Fix package-lint warnings., ELPA Syncer, 2022/09/09
- [elpa] externals/org-contacts d1298f4599 083/154: org-contacts.el: Catch `nextfile' in `org-contacts-db',
ELPA Syncer <=
- [elpa] externals/org-contacts 0a91557ef9 115/154: Tidy up whitespace, ELPA Syncer, 2022/09/09
- [elpa] externals/org-contacts 00560d5f4f 117/154: Try to support different type of AVATAR property., ELPA Syncer, 2022/09/09
- [elpa] externals/org-contacts 81d9ed977d 138/154: Ensure font-lock after org-mode in company-mode doc-buffer, ELPA Syncer, 2022/09/09
- [elpa] externals/org-contacts 8f008e1b70 131/154: Fix company-mode doc-buffer support with reverse query contact element in all contacts list., ELPA Syncer, 2022/09/09
- [elpa] externals/org-contacts c8408cf44e 118/154: replace gnus-rescale-image with create-image property :height, ELPA Syncer, 2022/09/09
- [elpa] externals/org-contacts 5d0ecac118 143/154: Update package description., ELPA Syncer, 2022/09/09
- [elpa] externals/org-contacts 8078958995 082/154: contrib: Fix error messages., ELPA Syncer, 2022/09/09
- [elpa] externals/org-contacts 60339bd55f 087/154: Make `org-make-tags-matcher' lexical binding friendly, ELPA Syncer, 2022/09/09
- [elpa] externals/org-contacts 74019274c0 110/154: Update copyright years, ELPA Syncer, 2022/09/09
- [elpa] externals/org-contacts 0af8ca84b4 107/154: org-contacts.el: Display contacts buffer result., ELPA Syncer, 2022/09/09