From d0dc9035b2d7c77dc65102ab27ecacf3664599fa Mon Sep 17 00:00:00 2001 From: Jay Kamat Date: Mon, 9 Apr 2018 21:47:58 -0400 Subject: [PATCH] org-notify.el: Fix an error in `org-notify-process' when unconfigured * contrib/lisp/org-notify.el (org-notify-todo-list): Return nil if `org-agenda-files' is nil --- contrib/lisp/org-notify.el | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/contrib/lisp/org-notify.el b/contrib/lisp/org-notify.el index 8e800eec7..56cf85d9d 100644 --- a/contrib/lisp/org-notify.el +++ b/contrib/lisp/org-notify.el @@ -137,15 +137,16 @@ simple timestamp string." "Create the todo-list for one org-agenda file." (let* ((files (org-agenda-files 'unrestricted)) (max (1- (length files)))) - (setq org-notify-parse-file - (if (or (not org-notify-parse-file) (>= org-notify-parse-file max)) - 0 - (1+ org-notify-parse-file))) - (save-excursion - (with-current-buffer (find-file-noselect - (nth org-notify-parse-file files)) - (org-element-map (org-element-parse-buffer 'headline) - 'headline 'org-notify-make-todo))))) + (when files + (setq org-notify-parse-file + (if (or (not org-notify-parse-file) (>= org-notify-parse-file max)) + 0 + (1+ org-notify-parse-file))) + (save-excursion + (with-current-buffer (find-file-noselect + (nth org-notify-parse-file files)) + (org-element-map (org-element-parse-buffer 'headline) + 'headline 'org-notify-make-todo)))))) (defun org-notify-maybe-too-late (diff period heading) "Print warning message, when notified significantly later than defined by -- 2.14.2