emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] ox-icalendar.el: create alarm at event time


From: Mikhail Skorzhinskii
Subject: Re: [PATCH] ox-icalendar.el: create alarm at event time
Date: Tue, 28 Dec 2021 13:08:40 +0100
User-agent: Evolution 3.40.4-1

Hi Nicolas,

Thank you for the review, appreciate your comments. I've applied your
suggestions. Please find the fixed file in the attachment to this
letter.

There is one important note that about this patch. There is one corner
case: when we've set org-icalendar-force-alarm variable to nil, org-
icalendar-alarm-time variable to non-nil and the APPT_WARNTIME property
is set to 0, then, with my code, the value of the org-icalendar-alarm-
time would be used.

Basically if user is not forcing the 'zero alarms', and has some non-
zero default value for alarms, the APPT_WARNTIME property will use
default alarm. Which is something, I would say, unexpected. I would
expect that alarm will be shut-off.

However I am just keeping the previous behaviour. I think its worth
fixing, but I'd say we do this in a separate patch.

Let me know what you think.

Thanks,
Mikhail

On Sun, 2021-12-26 at 22:22 +0100, Nicolas Goaziou wrote:
> Hello,
> 
> Mikhail Skorzhinskii <mskorzhinskiy@eml.cc> writes:
> 
> > * lisp/ox-icalendar.el (org-icalendar-force-alarm): option to set
> > alarm
> > even if alarm time is set to zero.
> > * lisp/ox-icalendar.el (org-icalendar--valarm): create VALARM at
> > the
> > event start if the alarm time is set to zero and
> > `org-icalendar-force-alarm' is set to true.
> 
> Thanks. Some comments follow.
> 
> > +(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
>                                                              ^^^
> You need two spaces after full stop.
> 
> > +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)
> 
> `boolean' is the valid type.
> 
> You also need to add :package-version '(Org . "9.6") and :safe
> #'booleanp.
> > +                (if org-icalendar-force-alarm
> > +                    (if alarm-time
> > +                        alarm-time
> > +                      org-icalendar-alarm-time)
> > +                  (if (zerop alarm-time)
> > +                      org-icalendar-alarm-time
> > +                    alarm-time))))))
> 
> I suggest to refactor the above into something like:
> 
> (cond
>  ((> alarm-time 0) alarm-time)
>  ((and (= 0 alarm-time) org-icalendar-force-alarm) alarm-time)
>  (t org-icalendar-alarm-time))
> 
> Could you send an updated patch?
> 
> Regards,
> -- 
> Nicolas Goaziou

Attachment: 0004-ox-icalendar.el-create-alarm-at-event-time.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]