From e15b085a553f2b7799cb3a9d82e2977a64577b40 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Mon, 23 Feb 2026 19:41:30 -0600 Subject: Improve org-agenda-files validation to distinguish files from directories --- chime.el | 17 ++++++++++------- tests/test-chime-validate-configuration.el | 8 ++++---- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/chime.el b/chime.el index 6ff3f95..7007fe0 100644 --- a/chime.el +++ b/chime.el @@ -1624,16 +1624,19 @@ When called programmatically, returns structured validation results." (push '(:error "org-agenda-files is not set or empty.\nChime cannot check for events without org files to monitor.\n\nSet org-agenda-files in your config:\n (setq org-agenda-files '(\"~/org/inbox.org\" \"~/org/work.org\"))") issues)) - ;; Warning: Check if files actually exist + ;; Warning: Check if files/directories actually exist (when (and (boundp 'org-agenda-files) org-agenda-files (listp org-agenda-files)) - (let ((missing-files - (cl-remove-if #'file-exists-p org-agenda-files))) - (when missing-files - (push `(:warning ,(format "%d org-agenda-files don't exist:\n %s\n\nChime will skip these files during event checks." - (length missing-files) - (mapconcat #'identity missing-files "\n "))) + (let ((missing (cl-remove-if #'file-exists-p org-agenda-files))) + (when missing + (push `(:warning ,(format "%d org-agenda-files entries don't exist:\n %s\n\nChime will skip these during event checks." + (length missing) + (mapconcat (lambda (path) + (format "%s (%s)" path + (if (string-suffix-p "/" path) + "directory" "file"))) + missing "\n "))) issues)))) ;; Check org-agenda is loadable diff --git a/tests/test-chime-validate-configuration.el b/tests/test-chime-validate-configuration.el index 763d845..896ac0f 100644 --- a/tests/test-chime-validate-configuration.el +++ b/tests/test-chime-validate-configuration.el @@ -124,9 +124,9 @@ (let ((issues (chime-validate-configuration))) (should (= 1 (length issues))) (should (eq :warning (caar issues))) - (should (string-match-p "2 org-agenda-files don't exist" (cadar issues))) - (should (string-match-p "/missing.org" (cadar issues))) - (should (string-match-p "/also-missing.org" (cadar issues)))))) + (should (string-match-p "2 org-agenda-files entries don't exist" (cadar issues))) + (should (string-match-p "/missing.org (file)" (cadar issues))) + (should (string-match-p "/also-missing.org (file)" (cadar issues)))))) (test-chime-validate-configuration-teardown)) (ert-deftest test-chime-validate-configuration-boundary-all-files-missing-returns-warning () @@ -141,7 +141,7 @@ (let ((issues (chime-validate-configuration))) (should (= 1 (length issues))) (should (eq :warning (caar issues))) - (should (string-match-p "2 org-agenda-files don't exist" (cadar issues)))))) + (should (string-match-p "2 org-agenda-files entries don't exist" (cadar issues)))))) (test-chime-validate-configuration-teardown)) ;;; Error Cases - Invalid Configurations -- cgit v1.2.3