emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* help with gnus-icalendar.el and orgmode agenda
@ 2024-02-07 20:41 Stephen J. Eglen
  2024-02-07 22:55 ` Ihor Radchenko
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen J. Eglen @ 2024-02-07 20:41 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org; +Cc: Jan Tatarik

hi,

I have the following snippet set up so that mu4e will parse icalendar
attachments and add them to an org file ... this seems to be the
standard prescription:

(when (fboundp 'gnus-icalendar-org-setup)
  (setq gnus-icalendar-org-capture-file "~/todo.org")
  (setq gnus-icalendar-org-capture-headline '("Calendar"))
  (gnus-icalendar-org-setup))

gnus-icalendar.el is part of Emacs, authored by Jan Tatarik (cc'ed).

When I use this package on icalendar attachments, it creates entries
that look like this:

** [#B] subject of email
:PROPERTIES:
:ICAL_EVENT: t
...
:END:

   <2024-02-22 18:30-20:00>

Note that the timestamp DOES NOT include a day of the week.  With the
default settings of org-time-stamp-formats, i.e. 

("%Y-%m-%d %a" . "%Y-%m-%d %a %H:%M")

this means that the agenda does not show this entry -- which defeats the
purpose of me saving the icalendar entry!  If I manually add the dayname
then the agenda item appears.

Looking inside gnus-icalendar.el, the relevant defun seems to be
gnus-icalendar-event--org-timestamp that creates the timestamp.
e.g. it includes this text to generate the timestamp:

   (format "<%s %s-%s%s>" start-date start-time end-time repeat)

which does not include the dayname.

What is the best way to improve this code?

Best wishes,

Stephen


 


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

* Re: help with gnus-icalendar.el and orgmode agenda
  2024-02-07 20:41 help with gnus-icalendar.el and orgmode agenda Stephen J. Eglen
@ 2024-02-07 22:55 ` Ihor Radchenko
  2024-02-07 23:20   ` Stephen J. Eglen
  2024-02-08 15:03   ` Ihor Radchenko
  0 siblings, 2 replies; 4+ messages in thread
From: Ihor Radchenko @ 2024-02-07 22:55 UTC (permalink / raw)
  To: Stephen J. Eglen; +Cc: emacs-orgmode@gnu.org, Jan Tatarik

"Stephen J. Eglen" <sje30@cam.ac.uk> writes:

> When I use this package on icalendar attachments, it creates entries
> that look like this:
>
> ...
>    <2024-02-22 18:30-20:00>
>
> Note that the timestamp DOES NOT include a day of the week.  With the
> default settings of org-time-stamp-formats, i.e. 
>
> ("%Y-%m-%d %a" . "%Y-%m-%d %a %H:%M")
>
> this means that the agenda does not show this entry -- which defeats the
> purpose of me saving the icalendar entry!  If I manually add the dayname
> then the agenda item appears.

<2024-02-22 18:30-20:00> is a valid timestamp. Agenda not handling it is
an oversight that should be fixed.

That said...

>    (format "<%s %s-%s%s>" start-date start-time end-time repeat)
>
> which does not include the dayname.

could certainly be improved. Having a day name increases readability.
Also, we may change the format in future, adding time zones as well.
I recommend using `org-time-stamp-format' when creating Org mode
timestamps or even `org-element-timestamp-interpreter'.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


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

* Re: help with gnus-icalendar.el and orgmode agenda
  2024-02-07 22:55 ` Ihor Radchenko
@ 2024-02-07 23:20   ` Stephen J. Eglen
  2024-02-08 15:03   ` Ihor Radchenko
  1 sibling, 0 replies; 4+ messages in thread
From: Stephen J. Eglen @ 2024-02-07 23:20 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Stephen J. Eglen, emacs-orgmode@gnu.org, Jan Tatarik

> <2024-02-22 18:30-20:00> is a valid timestamp. Agenda not handling it is
> an oversight that should be fixed.

Thanks for checking this.  If the agenda could parse these, great.
However, with a workaround (C-c C-c on the timestamp), I can handle this 
for now.

Incidentally, org-lint says the following:

  4422 low   Potentially malformed timestamp <2024-02-22 18:30-20:00>.
  Parsed as: <2024-02-22 Thu 18:30-20:00>

which helped me catch a few other timestamps.

Best wishes,

Stephen


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

* Re: help with gnus-icalendar.el and orgmode agenda
  2024-02-07 22:55 ` Ihor Radchenko
  2024-02-07 23:20   ` Stephen J. Eglen
@ 2024-02-08 15:03   ` Ihor Radchenko
  1 sibling, 0 replies; 4+ messages in thread
From: Ihor Radchenko @ 2024-02-08 15:03 UTC (permalink / raw)
  To: Stephen J. Eglen; +Cc: emacs-orgmode@gnu.org, Jan Tatarik

Ihor Radchenko <yantar92@posteo.net> writes:

> <2024-02-22 18:30-20:00> is a valid timestamp. Agenda not handling it is
> an oversight that should be fixed.

Fixed, on main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=62956196d

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


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

end of thread, other threads:[~2024-02-08 15:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-07 20:41 help with gnus-icalendar.el and orgmode agenda Stephen J. Eglen
2024-02-07 22:55 ` Ihor Radchenko
2024-02-07 23:20   ` Stephen J. Eglen
2024-02-08 15:03   ` Ihor Radchenko

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).