unofficial mirror of emacs-orgmode@gnu.org
 help / color / mirror / Atom feed
* org-agenda for a day different than today
@ 2021-02-16 14:12 Alan Schmitt
  2021-02-17  4:01 ` Kyle Meyer
  0 siblings, 1 reply; 7+ messages in thread
From: Alan Schmitt @ 2021-02-16 14:12 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 515 bytes --]

Hello,

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?

Thanks,

Alan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 528 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: org-agenda for a day different than today
  2021-02-16 14:12 org-agenda for a day different than today Alan Schmitt
@ 2021-02-17  4:01 ` Kyle Meyer
  2021-02-17  8:38   ` Alan Schmitt
  0 siblings, 1 reply; 7+ messages in thread
From: Kyle Meyer @ 2021-02-17  4:01 UTC (permalink / raw)
  To: Alan Schmitt; +Cc: emacs-orgmode

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: org-agenda for a day different than today
  2021-02-17  4:01 ` Kyle Meyer
@ 2021-02-17  8:38   ` Alan Schmitt
  2021-02-18  5:32     ` Kyle Meyer
  0 siblings, 1 reply; 7+ messages in thread
From: Alan Schmitt @ 2021-02-17  8:38 UTC (permalink / raw)
  To: Kyle Meyer; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1439 bytes --]

Hello Kyle,

On 2021-02-16 23:01, Kyle Meyer <kyle@kyleam.com> writes:

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

I’ve tried this change here and it works great, thanks a lot.

Looking at the code, I don’t see how it could cause trouble elsewhere
(but understanding agenda code is always tricky…)

Should I file a bug regarding this?

Best,

Alan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 528 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: org-agenda for a day different than today
  2021-02-17  8:38   ` Alan Schmitt
@ 2021-02-18  5:32     ` Kyle Meyer
  2021-02-18 16:41       ` Alan Schmitt
  0 siblings, 1 reply; 7+ messages in thread
From: Kyle Meyer @ 2021-02-18  5:32 UTC (permalink / raw)
  To: Alan Schmitt; +Cc: emacs-orgmode

Alan Schmitt writes:

> On 2021-02-16 23:01, Kyle Meyer <kyle@kyleam.com> writes:
>
[...]
>> 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.
>
> I’ve tried this change here and it works great, thanks a lot.

Thanks for testing.

> Looking at the code, I don’t see how it could cause trouble elsewhere
> (but understanding agenda code is always tricky…)

Yeah, I too think it's safe.  If you have the time, I'd appreciate if
you could skim through the above threads and see if there are any
minimal examples or test cases.  If so, it be good to verify that they
still work with the patch.

> Should I file a bug regarding this?

Just this thread is fine.  I should find time to put together a proper
patch in the next couple of days.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: org-agenda for a day different than today
  2021-02-18  5:32     ` Kyle Meyer
@ 2021-02-18 16:41       ` Alan Schmitt
  2021-02-21  6:23         ` Kyle Meyer
  0 siblings, 1 reply; 7+ messages in thread
From: Alan Schmitt @ 2021-02-18 16:41 UTC (permalink / raw)
  To: Kyle Meyer; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 641 bytes --]

Hello,

On 2021-02-18 00:32, Kyle Meyer <kyle@kyleam.com> writes:

>> Looking at the code, I don’t see how it could cause trouble elsewhere
>> (but understanding agenda code is always tricky…)
>
> Yeah, I too think it's safe.  If you have the time, I'd appreciate if
> you could skim through the above threads and see if there are any
> minimal examples or test cases.  If so, it be good to verify that they
> still work with the patch.

I tested the first thread (where two agendas are displayed) and it still
works.

The second thread was about the beginning of the week wrongly set in a
custom file.

Best,

Alan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 528 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: org-agenda for a day different than today
  2021-02-18 16:41       ` Alan Schmitt
@ 2021-02-21  6:23         ` Kyle Meyer
  2021-02-21 15:42           ` Alan Schmitt
  0 siblings, 1 reply; 7+ messages in thread
From: Kyle Meyer @ 2021-02-21  6:23 UTC (permalink / raw)
  To: Alan Schmitt; +Cc: emacs-orgmode

Alan Schmitt writes:

> On 2021-02-18 00:32, Kyle Meyer <kyle@kyleam.com> writes:
[...]
>> Yeah, I too think it's safe.  If you have the time, I'd appreciate if
>> you could skim through the above threads and see if there are any
>> minimal examples or test cases.  If so, it be good to verify that they
>> still work with the patch.
>
> I tested the first thread (where two agendas are displayed) and it still
> works.
>
> The second thread was about the beginning of the week wrongly set in a
> custom file.

Okay, thanks for checking.  Added a basic test and applied (3a522ad53).


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: org-agenda for a day different than today
  2021-02-21  6:23         ` Kyle Meyer
@ 2021-02-21 15:42           ` Alan Schmitt
  0 siblings, 0 replies; 7+ messages in thread
From: Alan Schmitt @ 2021-02-21 15:42 UTC (permalink / raw)
  To: Kyle Meyer; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 168 bytes --]

On 2021-02-21 01:23, Kyle Meyer <kyle@kyleam.com> writes:

> Okay, thanks for checking.  Added a basic test and applied (3a522ad53).

Great, thanks a lot!

Best,

Alan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 528 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-02-21 15:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-16 14:12 org-agenda for a day different than today Alan Schmitt
2021-02-17  4:01 ` Kyle Meyer
2021-02-17  8:38   ` Alan Schmitt
2021-02-18  5:32     ` Kyle Meyer
2021-02-18 16:41       ` Alan Schmitt
2021-02-21  6:23         ` Kyle Meyer
2021-02-21 15:42           ` Alan Schmitt

unofficial mirror of emacs-orgmode@gnu.org

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://yhetil.org/orgmode/0 orgmode/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 orgmode orgmode/ https://yhetil.org/orgmode \
		emacs-orgmode@gnu.org
	public-inbox-index orgmode

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.emacs.orgmode
	nntp://news.gmane.io/gmane.emacs.orgmode


AGPL code for this site: git clone http://ou63pmih66umazou.onion/public-inbox.git