From: Ihor Radchenko <yantar92@posteo.net>
To: Ihor Radchenko <yantar92@gmail.com>, Jack Kamm <jackkamm@gmail.com>
Cc: Hanno Perrey <hanno@hoowl.se>, emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: Inconsistent handling of multi-line properties
Date: Mon, 22 Jan 2024 11:17:08 +0000 [thread overview]
Message-ID: <87ede9vcqz.fsf@localhost> (raw)
In-Reply-To: <87o821dv7o.fsf@localhost>
[-- Attachment #1: Type: text/plain, Size: 657 bytes --]
Ihor Radchenko <yantar92@gmail.com> writes:
>> I have noticed that properties that stretch over multiple lines using
>> the :value+: syntax are ignored by org-element-property and therefore
>> also by e.g. org-export-get-node-property when exporting to ics via
>> ox-icalendar.el (see example below). I was wondering now whether this is
>> intentional and to be expected or a bug?
> 3. Change ox-icalendar to consider :LOCATION+ properties and merge them
> during export.
I went with this approach.
See the attached tentative patch.
CCing Jack - you expressed interest in ox-icalendar in the past.
P.S. We need a maintainer for ox-icalendar ;)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ox-icalendar-Add-support-for-multi-line-SUMMARY-LOCA.patch --]
[-- Type: text/x-patch, Size: 3730 bytes --]
From 84fb56dcbccc2c99be4fed172184c25cfe2a3395 Mon Sep 17 00:00:00 2001
Message-ID: <84fb56dcbccc2c99be4fed172184c25cfe2a3395.1705922024.git.yantar92@posteo.net>
From: Ihor Radchenko <yantar92@posteo.net>
Date: Mon, 22 Jan 2024 12:12:16 +0100
Subject: [PATCH] ox-icalendar: Add support for multi-line SUMMARY, LOCATION,
and DESCRIPTION
* lisp/ox-icalendar.el (org-icalendar-entry): Use `org-entry-get' to
account for both PROP and PROP+ in SUMMARY, LOCATION, and DESCRIPTION
properties. Use newline as accumulated value separator.
* etc/ORG-NEWS (iCalendar export now supports multiline =SUMMARY=,
=LOCATION=, and =DESCRIPTION= properties): Announce the breaking
change.
Reported-by: Hanno Perrey <hanno@hoowl.se>
Link: https://orgmode.org/list/87o821dv7o.fsf@localhost
---
etc/ORG-NEWS | 26 ++++++++++++++++++++++++++
lisp/ox-icalendar.el | 19 +++++++++++--------
2 files changed, 37 insertions(+), 8 deletions(-)
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 847ddf614..dc6886318 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -13,6 +13,32 @@ Please send Org bug reports to mailto:emacs-orgmode@gnu.org.
* Version 9.7 (not released yet)
** Important announcements and breaking changes
+*** iCalendar export now supports multiline =SUMMARY=, =LOCATION=, and =DESCRIPTION= properties
+
+Previously, it was not possible to specify multi-line location,
+summary, or description when exporting to iCalendar.
+
+In the following example, =LOCATION= was exported as "Someplace",
+ignoring the other lines.
+
+#+begin_src org
+,* heading with multi-line property
+:PROPERTIES:
+:LOCATION: Someplace
+:LOCATION+: Some Street 5
+:LOCATION+: 12345 Small Town
+:END:
+#+end_src
+
+Now, =SUMMARY+=, =LOCATION+=, and =DESCRIPTION+= properties can be
+used to create multi-line values.
+
+In the above example, =LOCATION= is now exported as
+
+: Someplace
+: Some Street 5
+: 12345 Small Town
+
*** ~org-agenda-search-headline-for-time~ now ignores all the timestamp in headings
Previously, ~org-agenda-search-headline-for-time~ made Org agenda
diff --git a/lisp/ox-icalendar.el b/lisp/ox-icalendar.el
index 3dd2c88d8..f6513563d 100644
--- a/lisp/ox-icalendar.el
+++ b/lisp/ox-icalendar.el
@@ -643,13 +643,15 @@ (defun org-icalendar-entry (entry contents info)
(let ((todo-type (org-element-property :todo-type entry))
(uid (or (org-element-property :ID entry) (org-id-new)))
(summary (org-icalendar-cleanup-string
- (or (org-element-property :SUMMARY entry)
- (org-export-data
- (org-element-property :title entry) info))))
- (loc (org-icalendar-cleanup-string
- (org-export-get-node-property
- :LOCATION entry
- (org-property-inherit-p "LOCATION"))))
+ (or
+ (let ((org-property-separators '(("SUMMARY" . "\n"))))
+ (org-entry-get entry "SUMMARY"))
+ (org-export-data
+ (org-element-property :title entry) info))))
+ (loc
+ (let ((org-property-separators '(("LOCATION" . "\n"))))
+ (org-icalendar-cleanup-string
+ (org-entry-get entry "LOCATION" 'selective))))
(class (org-icalendar-cleanup-string
(org-export-get-node-property
:CLASS entry
@@ -658,7 +660,8 @@ (defun org-icalendar-entry (entry contents info)
;; (headline) or contents (inlinetask).
(desc
(org-icalendar-cleanup-string
- (or (org-element-property :DESCRIPTION entry)
+ (or (let ((org-property-separators '(("DESCRIPTION" . "\n"))))
+ (org-entry-get entry "DESCRIPTION"))
(let ((contents (org-export-data inside info)))
(cond
((not (org-string-nw-p contents)) nil)
--
2.43.0
[-- Attachment #3: Type: text/plain, Size: 224 bytes --]
--
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>
next prev parent reply other threads:[~2024-01-22 11:14 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-02 15:01 Inconsistent handling of multi-line properties Hanno Perrey
2021-10-02 15:19 ` Ihor Radchenko
2022-02-28 20:09 ` Greg Sullivan
2022-03-20 5:47 ` Ihor Radchenko
2022-02-28 20:34 ` Kaushal Modi
2022-02-28 20:45 ` Kaushal Modi
2022-02-28 22:18 ` Greg Sullivan
2022-03-20 5:55 ` Ihor Radchenko
2024-01-22 11:17 ` Ihor Radchenko [this message]
2024-01-23 6:48 ` Jack Kamm
2024-01-25 13:35 ` Ihor Radchenko
2024-01-26 5:04 ` Jack Kamm
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
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ede9vcqz.fsf@localhost \
--to=yantar92@posteo.net \
--cc=emacs-orgmode@gnu.org \
--cc=hanno@hoowl.se \
--cc=jackkamm@gmail.com \
--cc=yantar92@gmail.com \
/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 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).