From acf4f0881a2435f44ceaf15568d15e39490a1287 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Sat, 6 Jul 2019 10:24:11 +0200 Subject: [PATCH] org-agenda: Fix "Args out of range" error in `org-agenda-list' * lisp/org-agenda.el (org-agenda-list): Do not add text properties on empty headers. --- lisp/org-agenda.el | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index 67a0f33bc..c05d0a792 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -4189,9 +4189,12 @@ items if they have an hour specification like [h]h:mm." ((= w1 w2) (format " (W%02d)" w1)) (t (format " (W%02d-W%02d)" w1 w2))) ":\n"))) - (add-text-properties s (1- (point)) (list 'face 'org-agenda-structure - 'org-date-line t)) - (org-agenda-mark-header-line s)) + ;; Add properties if we actually inserted a header. + (when (> (point) s) + (add-text-properties s (1- (point)) + (list 'face 'org-agenda-structure + 'org-date-line t)) + (org-agenda-mark-header-line s))) (while (setq d (pop day-numbers)) (setq date (calendar-gregorian-from-absolute d) s (point))