瀏覽代碼

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
Kyle Meyer 4 年之前
父節點
當前提交
3a522ad539
共有 2 個文件被更改,包括 18 次插入6 次删除
  1. 6 6
      lisp/org-agenda.el
  2. 12 0
      testing/lisp/test-org-agenda.el

+ 6 - 6
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))

+ 12 - 0
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