From 3a522ad5393d464f088729c0b9ca8711473e401f Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Sun, 21 Feb 2021 01:15:39 -0500 Subject: [PATCH] agenda: Restore org-agenda-goto-date's date argument * lisp/org-agenda.el (org-agenda-goto-date): Restore DATE argument (removed in 7.9.3e), replacing unused SPAN argument. * testing/lisp/test-org-agenda.el (test-org-agenda/goto-date): Add test. Among other changes, 93fcfe4d3 (2012-08-30) switched org-agenda-goto-date's DATE argument to SPAN, moving the org-read-date call out of the interactive form. The new argument is unused, and it's not clear that this part of the change was needed for the fix. It prevents lisp callers from specifying a date, so move the org-read-date call back to the interactive form. Reported-by: Alan Schmitt Ref: https://orgmode.org/list/87pn10t83u.fsf@m4x.org --- lisp/org-agenda.el | 12 ++++++------ testing/lisp/test-org-agenda.el | 12 ++++++++++++ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index 3f311c724..3e93b80d0 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -8221,13 +8221,13 @@ Negative selection means regexp must not match for selection of an entry." (defun org-add-to-string (var string) (set var (concat (symbol-value var) string))) -(defun org-agenda-goto-date (span) +(defun org-agenda-goto-date (date) "Jump to DATE in agenda." - (interactive "P") - (let* ((org-read-date-prefer-future - (eval org-agenda-jump-prefer-future)) - (date (org-read-date)) - (day (time-to-days (org-time-string-to-time date))) + (interactive + (list + (let ((org-read-date-prefer-future org-agenda-jump-prefer-future)) + (org-read-date)))) + (let* ((day (time-to-days (org-time-string-to-time date))) (org-agenda-sticky-orig org-agenda-sticky) (org-agenda-buffer-tmp-name (buffer-name)) (args (get-text-property (min (1- (point-max)) (point)) 'org-last-args)) diff --git a/testing/lisp/test-org-agenda.el b/testing/lisp/test-org-agenda.el index 7c1bfb2be..e1c64d8eb 100644 --- a/testing/lisp/test-org-agenda.el +++ b/testing/lisp/test-org-agenda.el @@ -141,6 +141,18 @@ (org-toggle-sticky-agenda) (org-test-agenda--kill-all-agendas)) +(ert-deftest test-org-agenda/goto-date () + "Test `org-agenda-goto-date'." + (unwind-protect + (should + (equal + (time-to-days (org-time-string-to-time "2019-12-30")) + (let ((org-agenda-files nil)) + (org-agenda-list nil nil 'day) + (org-agenda-goto-date "2019-12-30") + (get-text-property (point) 'day)))) + (org-test-agenda--kill-all-agendas))) + ;; agenda redo