branch: externals-release/org commit b1a570b3b466783fbe7276c1d97c99055f23155e Author: Ihor Radchenko <yanta...@gmail.com> Commit: Ihor Radchenko <yanta...@gmail.com>
org-agenda: Fix regression when diary sexp timestamps are ignored * lisp/org.el (org-at-timestamp-p): Return non-nil on sexp timestamps when called with 'agenda argument. * testing/examples/agenda-file.org (test sexp timestamp inside properties): * testing/lisp/test-org-agenda.el (test-org-agenda/property-timestamp): Add new test checking sexp timestamp inside properties drawer. --- lisp/org.el | 9 +++++++-- testing/examples/agenda-file.org | 4 ++++ testing/lisp/test-org-agenda.el | 6 ++++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index d656a51591..54350faeef 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -15020,7 +15020,11 @@ When matching, the match groups are the following: group 4: day name group 5: hours, if any group 6: minutes, if any" - (let* ((regexp (if extended org-ts-regexp3 org-ts-regexp2)) + (let* ((regexp (if extended + (if (eq extended 'agenda) + org-element--timestamp-regexp + org-ts-regexp3) + org-ts-regexp2)) (pos (point)) (match? (let ((boundaries (org-in-regexp regexp))) @@ -15051,7 +15055,8 @@ When matching, the match groups are the following: ((org-pos-in-match-range pos 8) 'minute) ((or (org-pos-in-match-range pos 4) (org-pos-in-match-range pos 5)) 'day) - ((and (> pos (or (match-end 8) (match-end 5))) + ((and (or (match-end 8) (match-end 5)) + (> pos (or (match-end 8) (match-end 5))) (< pos (match-end 0))) (- pos (or (match-end 8) (match-end 5)))) (t 'day)))) diff --git a/testing/examples/agenda-file.org b/testing/examples/agenda-file.org index 5e5bb86e9f..fe912a12b3 100644 --- a/testing/examples/agenda-file.org +++ b/testing/examples/agenda-file.org @@ -20,3 +20,7 @@ SCHEDULED: <2022-01-03 Mon> :PROPERTIES: :CREATED: <2022-03-22 Tue> :END: +* test sexp timestamp inside properties +:PROPERTIES: +:CREATED: <%%(diary-date 03 25 2022)> +:END: diff --git a/testing/lisp/test-org-agenda.el b/testing/lisp/test-org-agenda.el index 3bd774baf2..5a2c8933d9 100644 --- a/testing/lisp/test-org-agenda.el +++ b/testing/lisp/test-org-agenda.el @@ -130,6 +130,12 @@ See https://list.orgmode.org/06d301d83d9e$f8b44340$ea1cc9c0$@tomdavey.com" (org-agenda-list nil "<2022-03-22 Tue>") (set-buffer org-agenda-buffer-name) (should (= 3 (count-lines (point-min) (point-max)))) + ;; NOTE: Be aware that `org-agenda-list' may or may not display + ;; past scheduled items depending whether the date is today + ;; `org-today' or not. + (org-agenda-list nil "<2022-03-25 Fri>") + (set-buffer org-agenda-buffer-name) + (should (= 3 (count-lines (point-min) (point-max))))) (org-test-agenda--kill-all-agendas)) (ert-deftest test-org-agenda/set-priority ()