diff options
author | Kyle Meyer <kyle@kyleam.com> | 2021-02-21 01:15:39 -0500 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2021-02-21 01:18:07 -0500 |
commit | 3a522ad5393d464f088729c0b9ca8711473e401f (patch) | |
tree | 953e2c61ffec4daed484a42ebaba982714cf0c8b | |
parent | 4ab2a4be51f54a788d4744825b1a25418568384b (diff) | |
download | org-mode-3a522ad5393d464f088729c0b9ca8711473e401f.tar.gz |
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
-rw-r--r-- | lisp/org-agenda.el | 12 | ||||
-rw-r--r-- | 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 3f311c7..3e93b80 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 7c1bfb2..e1c64d8 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 |