Re: [PATCHES 1, 2, 3/3] Minor customisation features for ox-icalendar and agenda

2020-09-21 Thread Mikhail Skorzhinskii
Resending the patch. There were missing parenthesis. And I didn't test build 
after modification. Fixed and retested.

Mikhail

On Monday, September 21, 2020 10:23:39 AM CEST Mikhail Skorzhinskii wrote:
> On Wednesday, September 16, 2020 4:15:20 AM CEST Ihor Radchenko wrote:
> > > 1. Show document title instead of file name in org-agenda;
> > > 
> > > This should be useful for any users of org-roam package or anyone who
> > > autogenerate file names and uses document titles instead for navigation.
> > 
> > Interesting idea. This may also be useful as an option to
> > `org-refile-use-outline-path'. Currently, its value may be 'file to
> > prepend file names to the outline paths in refile targets. Using
> > document title (i.e. when the variable is set to 'title) in the refile
> > paths may also be handy.
> 
> This is indeed better way.
> 
> Fixed.
> 
> Thanks,
> Mikhail
> 
> > Best,
> > Ihor
> > 
> > Mikhail Skorzhinskii  writes:
> > > Hello forum,
> > > 
> > > I'd like to introduce three new features and request to merge the with
> > > current master:
> > > 
> > > 1. Show document title instead of file name in org-agenda;
> > > 
> > > This should be useful for any users of org-roam package or anyone who
> > > autogenerate file names and uses document titles instead for navigation.
> > > 
> > > 2. Customise summary lines of exported events in ox-icalendar
> > > 
> > > I personally export deadlines and scheduled items to the separate files
> > > so
> > > I don't need these cookies and they consume precious space of summary
> > > line. So I prefer them be disabled. This should be possible to do now
> > > with only customisation setting.
> > > 
> > > 3. Force creation of an alarm when exporting event in ox-icalendar
> > > 
> > > Sometimes I prefer to create icalendar alarms exactly at the event
> > > start,
> > > but it's not possible since alarm set to zero means that alarm will be
> > > disabled. Forcing alarm creation will now create alarm no matter the
> > > setting.
> > > 
> > > I've updated news files and attempted to replicate the style of
> > > submissions, but I admit that I didn't read much beyond CONTRIBUTE file.
> > > Please point me to the right direction in case of any issues I can fix.
> > > 
> > > Kind regards,
> > > Mikhail Skorzhinskii
> > > 
> > > From 111e6886564abbf3becb2a94e66f235f502b79d9 Mon Sep 17 00:00:00 2001
> > > From: Mikhail Skorzhinskii 
> > > Date: Sat, 12 Sep 2020 18:52:39 +0200
> > > Subject: [PATCH 3/3] ox-icalendar.el: introduce setting to force alarms
> > > 
> > > This is a new setting for icalendar exports to allow users set alarms
> > > exactly at the event start. With this setting set to non-nil and alarm
> > > set to zero (by global setting or APPT_WARNTIME property) it will create
> > > an alarm at the event start.
> > > 
> > > Note, that zero alarm set as APPT_WARNTIME property will override
> > > default warning time.
> > > ---
> > > 
> > >  etc/ORG-NEWS | 10 ++
> > >  lisp/ox-icalendar.el | 24 +---
> > >  2 files changed, 31 insertions(+), 3 deletions(-)
> > > 
> > > diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
> > > index b912e807d..eb950d934 100644
> > > --- a/etc/ORG-NEWS
> > > +++ b/etc/ORG-NEWS
> > > @@ -23,6 +23,16 @@ path.
> > > 
> > >  Through these new options for icalendar export, one can customise the
> > >  looks of summary lines in exported events.
> > > 
> > > +*** New option ~org-icalendar-force-alarm~
> > > +
> > > +This is a new setting for icalendar exports to allow users set alarms
> > > +exactly at the event start. With this setting set to non-nil and alarm
> > > +set to zero (by global setting or APPT_WARNTIME property) it will
> > > +create an alarm at the event start.
> > > +
> > > +Note, that zero alarm set as =APPT_WARNTIME= property will override
> > > +default warning time.
> > > +
> > > 
> > >  * Version 9.4
> > >  ** Incompatible changes
> > >  *** Possibly broken internal file links: please check and fix
> > > 
> > > diff --git a/lisp/ox-icalendar.el b/lisp/ox-icalendar.el
> > > index f110a4b2b..baed925e8 100644
> > > --- a/lisp/ox-icalendar.el
> > > +++ b/lisp/ox-icalendar.el
> > > @@ -64,6 +64,15 @@ for timed events.  If non-zero, alarms are created.
> > > 
> > >:version "24.1"
> > >:type 'integer)
> > > 
> > > +(defcustom org-icalendar-force-alarm nil
> > > +  "Non-nil means alarm will be created even if is set to zero.
> > > +
> > > +This overrides default behaviour where zero means no alarm. With
> > > +this set to non-nil and alarm set to zero, alarm will be created
> > > +and will fire at the event start."
> > > +  :group 'org-export-icalendar
> > > +  :type 'bool)
> > > +
> > > 
> > >  (defcustom org-icalendar-combined-name "OrgMode"
> > >  
> > >"Calendar name for the combined iCalendar representing all agenda
> > >files."
> > >
> > >:group 'org-export-icalendar
> > > 
> > > @@ -797,8 +806,11 @@ Return VALARM component as a string, or nil if it
> > > isn't allowed.">
> > 

Re: [PATCHES 1, 2, 3/3] Minor customisation features for ox-icalendar and agenda

2020-09-21 Thread Mikhail Skorzhinskii
On Wednesday, September 16, 2020 4:15:20 AM CEST Ihor Radchenko wrote:
> > 1. Show document title instead of file name in org-agenda;
> > 
> > This should be useful for any users of org-roam package or anyone who
> > autogenerate file names and uses document titles instead for navigation.
> 
> Interesting idea. This may also be useful as an option to
> `org-refile-use-outline-path'. Currently, its value may be 'file to
> prepend file names to the outline paths in refile targets. Using
> document title (i.e. when the variable is set to 'title) in the refile
> paths may also be handy.

This is indeed better way.

Fixed.

Thanks,
Mikhail

> Best,
> Ihor
> 
> Mikhail Skorzhinskii  writes:
> > Hello forum,
> > 
> > I'd like to introduce three new features and request to merge the with
> > current master:
> > 
> > 1. Show document title instead of file name in org-agenda;
> > 
> > This should be useful for any users of org-roam package or anyone who
> > autogenerate file names and uses document titles instead for navigation.
> > 
> > 2. Customise summary lines of exported events in ox-icalendar
> > 
> > I personally export deadlines and scheduled items to the separate files so
> > I don't need these cookies and they consume precious space of summary
> > line. So I prefer them be disabled. This should be possible to do now
> > with only customisation setting.
> > 
> > 3. Force creation of an alarm when exporting event in ox-icalendar
> > 
> > Sometimes I prefer to create icalendar alarms exactly at the event start,
> > but it's not possible since alarm set to zero means that alarm will be
> > disabled. Forcing alarm creation will now create alarm no matter the
> > setting.
> > 
> > I've updated news files and attempted to replicate the style of
> > submissions, but I admit that I didn't read much beyond CONTRIBUTE file.
> > Please point me to the right direction in case of any issues I can fix.
> > 
> > Kind regards,
> > Mikhail Skorzhinskii
> > 
> > From 111e6886564abbf3becb2a94e66f235f502b79d9 Mon Sep 17 00:00:00 2001
> > From: Mikhail Skorzhinskii 
> > Date: Sat, 12 Sep 2020 18:52:39 +0200
> > Subject: [PATCH 3/3] ox-icalendar.el: introduce setting to force alarms
> > 
> > This is a new setting for icalendar exports to allow users set alarms
> > exactly at the event start. With this setting set to non-nil and alarm
> > set to zero (by global setting or APPT_WARNTIME property) it will create
> > an alarm at the event start.
> > 
> > Note, that zero alarm set as APPT_WARNTIME property will override
> > default warning time.
> > ---
> > 
> >  etc/ORG-NEWS | 10 ++
> >  lisp/ox-icalendar.el | 24 +---
> >  2 files changed, 31 insertions(+), 3 deletions(-)
> > 
> > diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
> > index b912e807d..eb950d934 100644
> > --- a/etc/ORG-NEWS
> > +++ b/etc/ORG-NEWS
> > @@ -23,6 +23,16 @@ path.
> > 
> >  Through these new options for icalendar export, one can customise the
> >  looks of summary lines in exported events.
> > 
> > +*** New option ~org-icalendar-force-alarm~
> > +
> > +This is a new setting for icalendar exports to allow users set alarms
> > +exactly at the event start. With this setting set to non-nil and alarm
> > +set to zero (by global setting or APPT_WARNTIME property) it will
> > +create an alarm at the event start.
> > +
> > +Note, that zero alarm set as =APPT_WARNTIME= property will override
> > +default warning time.
> > +
> > 
> >  * Version 9.4
> >  ** Incompatible changes
> >  *** Possibly broken internal file links: please check and fix
> > 
> > diff --git a/lisp/ox-icalendar.el b/lisp/ox-icalendar.el
> > index f110a4b2b..baed925e8 100644
> > --- a/lisp/ox-icalendar.el
> > +++ b/lisp/ox-icalendar.el
> > @@ -64,6 +64,15 @@ for timed events.  If non-zero, alarms are created.
> > 
> >:version "24.1"
> >:type 'integer)
> > 
> > +(defcustom org-icalendar-force-alarm nil
> > +  "Non-nil means alarm will be created even if is set to zero.
> > +
> > +This overrides default behaviour where zero means no alarm. With
> > +this set to non-nil and alarm set to zero, alarm will be created
> > +and will fire at the event start."
> > +  :group 'org-export-icalendar
> > +  :type 'bool)
> > +
> > 
> >  (defcustom org-icalendar-combined-name "OrgMode"
> >  
> >"Calendar name for the combined iCalendar representing all agenda
> >files."
> >
> >:group 'org-export-icalendar
> > 
> > @@ -797,8 +806,11 @@ Return VALARM component as a string, or nil if it
> > isn't allowed."> 
> >(let ((alarm-time
> >
> >  (let ((warntime
> >  
> > (org-element-property :APPT_WARNTIME entry)))
> > 
> > -  (if warntime (string-to-number warntime) 0
> > -(and (or (> alarm-time 0) (> org-icalendar-alarm-time 0))
> > +  (if warntime (string-to-number warntime) nil
> > +(and (or (and alarm-time
> > + (> alarm-time 0))
> > +(> org-icalendar-alarm-time 0)
> > +

Re: [PATCHES 1, 2, 3/3] Minor customisation features for ox-icalendar and agenda

2020-09-15 Thread Ihor Radchenko
> 1. Show document title instead of file name in org-agenda;
>
> This should be useful for any users of org-roam package or anyone who 
> autogenerate file names and uses document titles instead for navigation.

Interesting idea. This may also be useful as an option to
`org-refile-use-outline-path'. Currently, its value may be 'file to
prepend file names to the outline paths in refile targets. Using
document title (i.e. when the variable is set to 'title) in the refile
paths may also be handy.

Best,
Ihor

Mikhail Skorzhinskii  writes:

> Hello forum,
>
> I'd like to introduce three new features and request to merge the with 
> current 
> master:
>
> 1. Show document title instead of file name in org-agenda;
>
> This should be useful for any users of org-roam package or anyone who 
> autogenerate file names and uses document titles instead for navigation.
>
> 2. Customise summary lines of exported events in ox-icalendar
>
> I personally export deadlines and scheduled items to the separate files so I 
> don't need these cookies and they consume precious space of summary line. So 
> I 
> prefer them be disabled. This should be possible to do now with only 
> customisation setting.
>
> 3. Force creation of an alarm when exporting event in ox-icalendar
>
> Sometimes I prefer to create icalendar alarms exactly at the event start, but 
> it's not possible since alarm set to zero means that alarm will be disabled. 
> Forcing alarm creation will now create alarm no matter the setting.
>
> I've updated news files and attempted to replicate the style of submissions, 
> but I admit that I didn't read much beyond CONTRIBUTE file. Please point me 
> to 
> the right direction in case of any issues I can fix.
>
> Kind regards,
> Mikhail Skorzhinskii
>
> From 111e6886564abbf3becb2a94e66f235f502b79d9 Mon Sep 17 00:00:00 2001
> From: Mikhail Skorzhinskii 
> Date: Sat, 12 Sep 2020 18:52:39 +0200
> Subject: [PATCH 3/3] ox-icalendar.el: introduce setting to force alarms
>
> This is a new setting for icalendar exports to allow users set alarms
> exactly at the event start. With this setting set to non-nil and alarm
> set to zero (by global setting or APPT_WARNTIME property) it will create
> an alarm at the event start.
>
> Note, that zero alarm set as APPT_WARNTIME property will override
> default warning time.
> ---
>  etc/ORG-NEWS | 10 ++
>  lisp/ox-icalendar.el | 24 +---
>  2 files changed, 31 insertions(+), 3 deletions(-)
>
> diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
> index b912e807d..eb950d934 100644
> --- a/etc/ORG-NEWS
> +++ b/etc/ORG-NEWS
> @@ -23,6 +23,16 @@ path.
>  Through these new options for icalendar export, one can customise the
>  looks of summary lines in exported events.
>  
> +*** New option ~org-icalendar-force-alarm~
> +
> +This is a new setting for icalendar exports to allow users set alarms
> +exactly at the event start. With this setting set to non-nil and alarm
> +set to zero (by global setting or APPT_WARNTIME property) it will
> +create an alarm at the event start.
> +
> +Note, that zero alarm set as =APPT_WARNTIME= property will override
> +default warning time.
> +
>  * Version 9.4
>  ** Incompatible changes
>  *** Possibly broken internal file links: please check and fix
> diff --git a/lisp/ox-icalendar.el b/lisp/ox-icalendar.el
> index f110a4b2b..baed925e8 100644
> --- a/lisp/ox-icalendar.el
> +++ b/lisp/ox-icalendar.el
> @@ -64,6 +64,15 @@ for timed events.  If non-zero, alarms are created.
>:version "24.1"
>:type 'integer)
>  
> +(defcustom org-icalendar-force-alarm nil
> +  "Non-nil means alarm will be created even if is set to zero.
> +
> +This overrides default behaviour where zero means no alarm. With
> +this set to non-nil and alarm set to zero, alarm will be created
> +and will fire at the event start."
> +  :group 'org-export-icalendar
> +  :type 'bool)
> +
>  (defcustom org-icalendar-combined-name "OrgMode"
>"Calendar name for the combined iCalendar representing all agenda files."
>:group 'org-export-icalendar
> @@ -797,8 +806,11 @@ Return VALARM component as a string, or nil if it isn't 
> allowed."
>(let ((alarm-time
>(let ((warntime
>   (org-element-property :APPT_WARNTIME entry)))
> -(if warntime (string-to-number warntime) 0
> -(and (or (> alarm-time 0) (> org-icalendar-alarm-time 0))
> +(if warntime (string-to-number warntime) nil
> +(and (or (and alarm-time
> +   (> alarm-time 0))
> +  (> org-icalendar-alarm-time 0)
> +  org-icalendar-force-alarm)
>(org-element-property :hour-start timestamp)
>(format "BEGIN:VALARM
>  ACTION:DISPLAY
> @@ -806,7 +818,13 @@ DESCRIPTION:%s
>  TRIGGER:-P0DT0H%dM0S
>  END:VALARM\n"
>summary
> -  (if (zerop alarm-time) org-icalendar-alarm-time alarm-time)
> +  (if org-icalendar-force-alarm
> +  (if alarm-time
> +  

[PATCHES 1, 2, 3/3] Minor customisation features for ox-icalendar and agenda

2020-09-15 Thread Mikhail Skorzhinskii
Hello forum,

I'd like to introduce three new features and request to merge the with current 
master:

1. Show document title instead of file name in org-agenda;

This should be useful for any users of org-roam package or anyone who 
autogenerate file names and uses document titles instead for navigation.

2. Customise summary lines of exported events in ox-icalendar

I personally export deadlines and scheduled items to the separate files so I 
don't need these cookies and they consume precious space of summary line. So I 
prefer them be disabled. This should be possible to do now with only 
customisation setting.

3. Force creation of an alarm when exporting event in ox-icalendar

Sometimes I prefer to create icalendar alarms exactly at the event start, but 
it's not possible since alarm set to zero means that alarm will be disabled. 
Forcing alarm creation will now create alarm no matter the setting.

I've updated news files and attempted to replicate the style of submissions, 
but I admit that I didn't read much beyond CONTRIBUTE file. Please point me to 
the right direction in case of any issues I can fix.

Kind regards,
Mikhail Skorzhinskii

>From 111e6886564abbf3becb2a94e66f235f502b79d9 Mon Sep 17 00:00:00 2001
From: Mikhail Skorzhinskii 
Date: Sat, 12 Sep 2020 18:52:39 +0200
Subject: [PATCH 3/3] ox-icalendar.el: introduce setting to force alarms

This is a new setting for icalendar exports to allow users set alarms
exactly at the event start. With this setting set to non-nil and alarm
set to zero (by global setting or APPT_WARNTIME property) it will create
an alarm at the event start.

Note, that zero alarm set as APPT_WARNTIME property will override
default warning time.
---
 etc/ORG-NEWS | 10 ++
 lisp/ox-icalendar.el | 24 +---
 2 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index b912e807d..eb950d934 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -23,6 +23,16 @@ path.
 Through these new options for icalendar export, one can customise the
 looks of summary lines in exported events.
 
+*** New option ~org-icalendar-force-alarm~
+
+This is a new setting for icalendar exports to allow users set alarms
+exactly at the event start. With this setting set to non-nil and alarm
+set to zero (by global setting or APPT_WARNTIME property) it will
+create an alarm at the event start.
+
+Note, that zero alarm set as =APPT_WARNTIME= property will override
+default warning time.
+
 * Version 9.4
 ** Incompatible changes
 *** Possibly broken internal file links: please check and fix
diff --git a/lisp/ox-icalendar.el b/lisp/ox-icalendar.el
index f110a4b2b..baed925e8 100644
--- a/lisp/ox-icalendar.el
+++ b/lisp/ox-icalendar.el
@@ -64,6 +64,15 @@ for timed events.  If non-zero, alarms are created.
   :version "24.1"
   :type 'integer)
 
+(defcustom org-icalendar-force-alarm nil
+  "Non-nil means alarm will be created even if is set to zero.
+
+This overrides default behaviour where zero means no alarm. With
+this set to non-nil and alarm set to zero, alarm will be created
+and will fire at the event start."
+  :group 'org-export-icalendar
+  :type 'bool)
+
 (defcustom org-icalendar-combined-name "OrgMode"
   "Calendar name for the combined iCalendar representing all agenda files."
   :group 'org-export-icalendar
@@ -797,8 +806,11 @@ Return VALARM component as a string, or nil if it isn't allowed."
   (let ((alarm-time
 	 (let ((warntime
 		(org-element-property :APPT_WARNTIME entry)))
-	   (if warntime (string-to-number warntime) 0
-(and (or (> alarm-time 0) (> org-icalendar-alarm-time 0))
+	   (if warntime (string-to-number warntime) nil
+(and (or (and alarm-time
+		  (> alarm-time 0))
+	 (> org-icalendar-alarm-time 0)
+	 org-icalendar-force-alarm)
 	 (org-element-property :hour-start timestamp)
 	 (format "BEGIN:VALARM
 ACTION:DISPLAY
@@ -806,7 +818,13 @@ DESCRIPTION:%s
 TRIGGER:-P0DT0H%dM0S
 END:VALARM\n"
 		 summary
-		 (if (zerop alarm-time) org-icalendar-alarm-time alarm-time)
+		 (if org-icalendar-force-alarm
+		 (if alarm-time
+			 alarm-time
+		   org-icalendar-alarm-time)
+		   (if (zerop alarm-time)
+		   org-icalendar-alarm-time
+		 alarm-time))
 
 
  Template
-- 
2.28.0

>From 1c30be14e2e7a6774d499388ec207b1950963746 Mon Sep 17 00:00:00 2001
From: Mikhail Skorzhinskii 
Date: Sat, 12 Sep 2020 18:27:23 +0200
Subject: [PATCH 2/3] ox-icalendar.el: allow to customise deadline and
 scheduled items summary

In some of export schemes these cookies at the start of each event can
be a distraction rather then storage of useful information.
---
 etc/ORG-NEWS |  5 +
 lisp/ox-icalendar.el | 10 --
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 32f64d84e..b912e807d 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -18,6 +18,11 @@ When set to 'title, will show document title in outline path in echo
 area instead of file