From: Jack Kamm <jackkamm@gmail.com>
To: Ihor Radchenko <yantar92@posteo.net>
Cc: emacs-orgmode@gnu.org
Subject: Re: [PATCH] Fix ox-icalendar export of diary timestamps
Date: Sat, 21 Sep 2024 11:20:51 -0700 [thread overview]
Message-ID: <87v7yorhq4.fsf@gmail.com> (raw)
In-Reply-To: <875xqppeur.fsf@localhost>
[-- Attachment #1: Type: text/plain, Size: 224 bytes --]
Ihor Radchenko <yantar92@posteo.net> writes:
> I agree that it makes sense.
> However, it is technically a breaking change.
> May you please add a news entry as well?
Thanks, I've updated the patch with a news entry now.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ox-icalendar-Fix-export-of-diary-style-timestamps.patch --]
[-- Type: text/x-patch, Size: 4014 bytes --]
From 5c40741664402a5984803dc3de452ea949885887 Mon Sep 17 00:00:00 2001
From: Jack Kamm <jackkamm@gmail.com>
Date: Sat, 14 Sep 2024 22:48:44 -0700
Subject: [PATCH] ox-icalendar: Fix export of diary-style timestamps
* lisp/ox-icalendar.el (org-icalendar-entry): Include timestamps of
type diary when `:with-timestamps' is `active'.
* lisp/ox.el (org-export--skip-p): Include timestamps of type diary
when `:with-timestamps' is `active'.
*
testing/lisp/test-ox-icalendar.el (test-ox-icalendar/diary-timestamp):
Unit test for exporting timestamps of type diary.
---
etc/ORG-NEWS | 14 ++++++++++++++
lisp/ox-icalendar.el | 2 +-
lisp/ox.el | 2 +-
testing/lisp/test-ox-icalendar.el | 15 +++++++++++++++
4 files changed, 31 insertions(+), 2 deletions(-)
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index a9357aa28..d31c62721 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -57,6 +57,20 @@ remote resources in the =#+include:='s. Now, an error is thrown to
avoid seemingly ignored =#+include= statements when publishing via
batch scripts.
+*** Diary-style timestamps are exported together with active timestamps
+
+~org-export-with-timestamps~ and ~org-icalendar-with-timestamps~ now
+treat diary-style timestamps as a type of active timestamp for
+purposes of export.
+
+This mainly affects iCalendar export, where diary timestamps will now
+be included when only active timestamps are exported (the default).
+
+This should have minimal impact on non-iCalendar exporters, since
+~org-export-with-timestamps~ was already ~t~ by default. However,
+users who manually set ~org-export-with-timestamps~ to ~active~ will
+now have diary timestamps included as well.
+
** New features
# We list the most important features, and the features that may
diff --git a/lisp/ox-icalendar.el b/lisp/ox-icalendar.el
index 858d146d6..e7ca6aafb 100644
--- a/lisp/ox-icalendar.el
+++ b/lisp/ox-icalendar.el
@@ -746,7 +746,7 @@ (defun org-icalendar-entry (entry contents info)
(lambda (ts)
(when (let ((type (org-element-property :type ts)))
(cl-case (plist-get info :with-timestamps)
- (active (memq type '(active active-range)))
+ (active (memq type '(active active-range diary)))
(inactive (memq type '(inactive inactive-range)))
((t) t)))
(let ((uid (format "TS%d-%s" (cl-incf counter) uid)))
diff --git a/lisp/ox.el b/lisp/ox.el
index 7a0ab4dc7..79a1f5cfb 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -1857,7 +1857,7 @@ (defun org-export--skip-p (datum options selected excluded)
(cl-case (plist-get options :with-timestamps)
((nil) t)
(active
- (not (memq (org-element-property :type datum) '(active active-range))))
+ (not (memq (org-element-property :type datum) '(active active-range diary))))
(inactive
(not (memq (org-element-property :type datum)
'(inactive inactive-range)))))))))
diff --git a/testing/lisp/test-ox-icalendar.el b/testing/lisp/test-ox-icalendar.el
index e631b2119..c7c74c526 100644
--- a/testing/lisp/test-ox-icalendar.el
+++ b/testing/lisp/test-ox-icalendar.el
@@ -128,5 +128,20 @@ (ert-deftest test-ox-icalendar/warn-unsupported-repeater ()
(when (file-exists-p tmp-ics)
(delete-file tmp-ics))))))))
+(ert-deftest test-ox-icalendar/diary-timestamp ()
+ "Test icalendar export of diary timestamps."
+ (let* ((tmp-ics (org-test-with-temp-text-in-file
+ "* First Sunday of the month
+<%%(diary-float t 0 1)>"
+ (expand-file-name (org-icalendar-export-to-ics)))))
+ (unwind-protect
+ (with-temp-buffer
+ (insert-file-contents tmp-ics)
+ (save-excursion
+ (should (search-forward "SUMMARY:First Sunday of the month")))
+ (save-excursion
+ (should (search-forward "RRULE:FREQ=MONTHLY;BYDAY=1SU"))))
+ (when (file-exists-p tmp-ics) (delete-file tmp-ics)))))
+
(provide 'test-ox-icalendar)
;;; test-ox-icalendar.el ends here
--
2.46.0
next prev parent reply other threads:[~2024-09-21 18:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-15 6:26 [PATCH] Fix ox-icalendar export of diary timestamps Jack Kamm
2024-09-21 8:53 ` Ihor Radchenko
2024-09-21 18:20 ` Jack Kamm [this message]
2024-09-22 10:25 ` Ihor Radchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87v7yorhq4.fsf@gmail.com \
--to=jackkamm@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=yantar92@posteo.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.