emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] ox-icalendar.el: customizable vevent summary prefix
@ 2021-12-25 15:24 Mikhail Skorzhinskii
  2021-12-26 21:26 ` Nicolas Goaziou
  0 siblings, 1 reply; 3+ messages in thread
From: Mikhail Skorzhinskii @ 2021-12-25 15:24 UTC (permalink / raw)
  To: Org Mode


* lisp/ox-icalendar.el (org-icalendar-scheduled-summary-prepend):
configurable prefix for the scheduled headlines
* lisp/ox-icalendar.el (org-icalendar-deadline-summary-prepend):
configurable prefix for the headlines with a deadline
* lisp/ox-icalendar.el (org-icalendar-entry): use a configurable
headline prefixes (see above) instead of hardcoded ones
---
 lisp/ox-icalendar.el | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/lisp/ox-icalendar.el b/lisp/ox-icalendar.el
index 68c5679ea..0a56e08e5 100644
--- a/lisp/ox-icalendar.el
+++ b/lisp/ox-icalendar.el
@@ -84,6 +84,17 @@ keyword."
   :group 'org-export-icalendar
   :type '(repeat (string :tag "Tag")))
 
+(defcustom org-icalendar-scheduled-summary-prepend "S: "
+  "String used for prepending summary in exported scheduled
headlines."
+  :group 'org-export-icalendar
+  :type 'string)
+
+
+(defcustom org-icalendar-deadline-summary-prepend "DL: "
+  "String used for prepending summary in exported deadlines."
+  :group 'org-export-icalendar
+  :type 'string)
+
 (defcustom org-icalendar-use-deadline '(event-if-not-todo todo-due)
   "Contexts where iCalendar export should use a deadline time stamp.
 
@@ -607,7 +618,7 @@ inlinetask within the section."
                   (_ (memq 'event-if-not-todo use-deadline)))
                 (org-icalendar--vevent
                  entry deadline (concat "DL-" uid)
-                 (concat "DL: " summary) loc desc cat tz class)))
+                 (concat org-icalendar-deadline-summary-prepend
summary) loc desc cat tz class)))
          (let ((scheduled (org-element-property :scheduled entry))
                (use-scheduled (plist-get info :icalendar-use-
scheduled)))
            (and scheduled
@@ -618,7 +629,7 @@ inlinetask within the section."
                   (_ (memq 'event-if-not-todo use-scheduled)))
                 (org-icalendar--vevent
                  entry scheduled (concat "SC-" uid)
-                 (concat "S: " summary) loc desc cat tz class)))
+                 (concat org-icalendar-scheduled-summary-prepend
summary) loc desc cat tz class)))
          ;; When collecting plain timestamps from a headline and its
          ;; title, skip inlinetasks since collection will happen once
          ;; ENTRY is one of them.



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

* Re: [PATCH] ox-icalendar.el: customizable vevent summary prefix
  2021-12-25 15:24 [PATCH] ox-icalendar.el: customizable vevent summary prefix Mikhail Skorzhinskii
@ 2021-12-26 21:26 ` Nicolas Goaziou
  2021-12-28 12:10   ` Mikhail Skorzhinskii
  0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Goaziou @ 2021-12-26 21:26 UTC (permalink / raw)
  To: Mikhail Skorzhinskii; +Cc: Org Mode

Hello,

Thanks. Some comments follow.

Mikhail Skorzhinskii <mskorzhinskiy@eml.cc> writes:

> * lisp/ox-icalendar.el (org-icalendar-scheduled-summary-prepend):
> configurable prefix for the scheduled headlines

"New variable" is enough.

> * lisp/ox-icalendar.el (org-icalendar-deadline-summary-prepend):
> configurable prefix for the headlines with a deadline

Ditto.

> +(defcustom org-icalendar-scheduled-summary-prepend "S: "
> +  "String used for prepending summary in exported scheduled
> headlines."
> +  :group 'org-export-icalendar
> +  :type 'string)
> +
> +
> +(defcustom org-icalendar-deadline-summary-prepend "DL: "
> +  "String used for prepending summary in exported deadlines."
> +  :group 'org-export-icalendar
> +  :type 'string)
> +

Could you add missing :safe and :package-version keywords?

Regards,
-- 
Nicolas Goaziou


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

* Re: [PATCH] ox-icalendar.el: customizable vevent summary prefix
  2021-12-26 21:26 ` Nicolas Goaziou
@ 2021-12-28 12:10   ` Mikhail Skorzhinskii
  0 siblings, 0 replies; 3+ messages in thread
From: Mikhail Skorzhinskii @ 2021-12-28 12:10 UTC (permalink / raw)
  To: Org Mode

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

Hi Nicolas,

Thank you for the reviewing my suggestions. I've fixed issues you've
listed. I've attached new patch to this email.

Let me know what you think.

Thanks,
Mikhail

On Sun, 2021-12-26 at 22:26 +0100, Nicolas Goaziou wrote:
> Hello,
> 
> Thanks. Some comments follow.
> 
> Mikhail Skorzhinskii <mskorzhinskiy@eml.cc> writes:
> 
> > * lisp/ox-icalendar.el (org-icalendar-scheduled-summary-prepend):
> > configurable prefix for the scheduled headlines
> 
> "New variable" is enough.
> 
> > * lisp/ox-icalendar.el (org-icalendar-deadline-summary-prepend):
> > configurable prefix for the headlines with a deadline
> 
> Ditto.
> 
> > +(defcustom org-icalendar-scheduled-summary-prepend "S: "
> > +  "String used for prepending summary in exported scheduled
> > headlines."
> > +  :group 'org-export-icalendar
> > +  :type 'string)
> > +
> > +
> > +(defcustom org-icalendar-deadline-summary-prepend "DL: "
> > +  "String used for prepending summary in exported deadlines."
> > +  :group 'org-export-icalendar
> > +  :type 'string)
> > +
> 
> Could you add missing :safe and :package-version keywords?
> 
> Regards,

[-- Attachment #2: 0003-ox-icalendar.el-customizable-vevent-summary-prefix.patch --]
[-- Type: text/x-patch, Size: 2401 bytes --]

From 6849f0dde1cc8fefbfea0271039e5066a3cb2746 Mon Sep 17 00:00:00 2001
From: Mikhail Skorzhinskii <mskorzhinskiy@eml.cc>
Date: Sat, 12 Sep 2020 18:27:23 +0200
Subject: [PATCH 3/5] ox-icalendar.el: customizable vevent summary prefix

* lisp/ox-icalendar.el (org-icalendar-scheduled-summary-prepend): new
variable
* lisp/ox-icalendar.el (org-icalendar-deadline-summary-prepend): new
variable
* lisp/ox-icalendar.el (org-icalendar-entry): use a configurable
headline prefixes (see above) instead of hardcoded ones
---
 lisp/ox-icalendar.el | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/lisp/ox-icalendar.el b/lisp/ox-icalendar.el
index 68c5679ea..189e35946 100644
--- a/lisp/ox-icalendar.el
+++ b/lisp/ox-icalendar.el
@@ -84,6 +84,21 @@ keyword."
   :group 'org-export-icalendar
   :type '(repeat (string :tag "Tag")))
 
+(defcustom org-icalendar-scheduled-summary-prepend "S: "
+  "String used for prepending summary in exported scheduled headlines."
+  :group 'org-export-icalendar
+  :type 'string
+  :package-version '(Org . "9.6")
+  :safe #'stringp)
+
+
+(defcustom org-icalendar-deadline-summary-prepend "DL: "
+  "String used for prepending summary in exported deadlines."
+  :group 'org-export-icalendar
+  :type 'string
+  :package-version '(Org . "9.6")
+  :safe #'stringp)
+
 (defcustom org-icalendar-use-deadline '(event-if-not-todo todo-due)
   "Contexts where iCalendar export should use a deadline time stamp.
 
@@ -607,7 +622,7 @@ inlinetask within the section."
 		   (_ (memq 'event-if-not-todo use-deadline)))
 		 (org-icalendar--vevent
 		  entry deadline (concat "DL-" uid)
-		  (concat "DL: " summary) loc desc cat tz class)))
+		  (concat org-icalendar-deadline-summary-prepend summary) loc desc cat tz class)))
 	  (let ((scheduled (org-element-property :scheduled entry))
 		(use-scheduled (plist-get info :icalendar-use-scheduled)))
 	    (and scheduled
@@ -618,7 +633,7 @@ inlinetask within the section."
 		   (_ (memq 'event-if-not-todo use-scheduled)))
 		 (org-icalendar--vevent
 		  entry scheduled (concat "SC-" uid)
-		  (concat "S: " summary) loc desc cat tz class)))
+		  (concat org-icalendar-scheduled-summary-prepend summary) loc desc cat tz class)))
 	  ;; When collecting plain timestamps from a headline and its
 	  ;; title, skip inlinetasks since collection will happen once
 	  ;; ENTRY is one of them.
-- 
2.32.0


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

end of thread, other threads:[~2021-12-28 12:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-25 15:24 [PATCH] ox-icalendar.el: customizable vevent summary prefix Mikhail Skorzhinskii
2021-12-26 21:26 ` Nicolas Goaziou
2021-12-28 12:10   ` Mikhail Skorzhinskii

Code repositories for project(s) associated with this 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).