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 <alan.schmitt@polytechnique.org>
Ref: https://orgmode.org/list/87pn10t83u.fsf@m4x.org
This commit is contained in:
Kyle Meyer 2021-02-21 01:15:39 -05:00
parent 4ab2a4be51
commit 3a522ad539
2 changed files with 18 additions and 6 deletions

View File

@ -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))

View File

@ -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