emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: org-agenda for a day different than today


From: Kyle Meyer
Subject: Re: org-agenda for a day different than today
Date: Tue, 16 Feb 2021 23:01:03 -0500

Alan Schmitt writes:

> I’ve been reading the documentation around org-agenda, and I cannot find
> a way to call it to get an agenda for a day different than today. I’ve
> found org-agenda-goto-date, but I don’t know how to call it from
> emacs-lisp with the target date.
>
> By the way, I’m surprised by the code of this function, as it is defined
> as:
>
> (defun org-agenda-goto-date (span)
>   "Jump to DATE in agenda."
>
> )
>
> and "span" is never mentioned in the function. Am I missing something?

That does look wrong.  Among other changes, 93fcfe4d3 (org-agenda.el:
Fix org-agenda-goto-date' again, 2012-08-30) switched the DATE argument
to SPAN, moving the org-read-date call out of the interactive form.
>From that commit alone, I don't have a good guess at why and am
wondering if the above change was an unfinished thought that came along
with the other changes.

Here are two threads from around that time that may be related, though I
haven't reviewed either of them:

 https://orgmode.org/list/BLU0-SMTP912FC379760EE431D3D68EBBBC0@phx.gbl/T/#u
 https://orgmode.org/list/BLU0-SMTP950E9387B34FA390C4FD9CBBBD0@phx.gbl/T/#u

Moving org-read-date back to the interactive form would allow lisp
callers to pass in the date, though perhaps it'd bring back some
misbehavior discussed in the above threads.

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 9b2009fdb..aef642037 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -8238,13 +8238,13 @@ (defun org-agenda-manipulate-query (char)
 (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))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]