Skip to content

Commit 31b3b16

Browse files
mskorzhinskiyyantar92
authored andcommitted
ox-icalendar.el: create alarm at event time
* 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. TINYCHANGE
1 parent 0435fea commit 31b3b16

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

lisp/ox-icalendar.el

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,17 @@ for timed events. If non-zero, alarms are created.
6969
:version "24.1"
7070
:type 'integer)
7171

72+
(defcustom org-icalendar-force-alarm nil
73+
"Non-nil means alarm will be created even if is set to zero.
74+
75+
This overrides default behaviour where zero means no alarm. With
76+
this set to non-nil and alarm set to zero, alarm will be created
77+
and will fire at the event start."
78+
:group 'org-export-icalendar
79+
:type 'boolean
80+
:package-version '(Org . "9.6")
81+
:safe #'booleanp)
82+
7283
(defcustom org-icalendar-combined-name "OrgMode"
7384
"Calendar name for the combined iCalendar representing all agenda files."
7485
:group 'org-export-icalendar
@@ -795,17 +806,22 @@ Return VALARM component as a string, or nil if it isn't allowed."
795806
(let ((alarm-time
796807
(let ((warntime
797808
(org-element-property :APPT_WARNTIME entry)))
798-
(if warntime (string-to-number warntime) 0))))
799-
(and (or (> alarm-time 0) (> org-icalendar-alarm-time 0))
809+
(if warntime (string-to-number warntime) nil))))
810+
(and (or (and alarm-time
811+
(> alarm-time 0))
812+
(> org-icalendar-alarm-time 0)
813+
org-icalendar-force-alarm)
800814
(org-element-property :hour-start timestamp)
801815
(format "BEGIN:VALARM
802816
ACTION:DISPLAY
803817
DESCRIPTION:%s
804818
TRIGGER:-P0DT0H%dM0S
805819
END:VALARM\n"
806820
summary
807-
(if (zerop alarm-time) org-icalendar-alarm-time alarm-time)))))
808-
821+
(cond
822+
((and alarm-time org-icalendar-force-alarm) alarm-time)
823+
((and alarm-time (not (zerop alarm-time))) alarm-time)
824+
(t org-icalendar-alarm-time))))))
809825

810826
;;;; Template
811827

0 commit comments

Comments
 (0)