Skip to content

Commit 2c830dc

Browse files
committed
Fix checkdoc issues
1 parent 4794a53 commit 2c830dc

1 file changed

Lines changed: 29 additions & 20 deletions

File tree

org-wild-notifier.el

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
(require 'cl-lib)
5353

5454
(defgroup org-wild-notifier nil
55-
"org-wild-notifier customization options"
55+
"Customization options for org-wild-notifier."
5656
:group 'org)
5757

5858
(defcustom org-wild-notifier-alert-time '(10)
@@ -143,16 +143,15 @@ Value should be space-separated timestamp types, e.g., \"DEADLINE SCHEDULED\"."
143143
(defcustom org-wild-notifier-predicate-whitelist nil
144144
"Receive notifications for events matching these predicates only.
145145
Each function should take an event POM and return non-nil iff that event should
146-
trigger a notification. Leave this variable blank if you do not want to filter
146+
trigger a notification. Leave this variable blank if you do not want to filter
147147
anything."
148148
:package-version '(org-wild-notifier . "0.5.0")
149149
:group 'org-wild-notifier
150150
:type '(function))
151151

152152
(defcustom org-wild-notifier-additional-environment-regexes nil
153-
"Additional regular expressions that should be provided to
154-
`async-inject-environment' before running the async command to
155-
check notifications."
153+
"Additional regular expressions for `async-inject-environment'.
154+
These are passed to the async command when checking notifications."
156155
:package-version '(org-wild-notifier . "0.5.0")
157156
:group 'org-wild-notifier
158157
:type '(string))
@@ -242,6 +241,7 @@ DEPRECATED: Use `org-wild-notifier--get-current-notifications' instead."
242241
(org-wild-notifier--get-current-notifications event))
243242

244243
(defun org-wild-notifier--has-timestamp (s)
244+
"Check whether S has a time component in its timestamp."
245245
(string-match org-ts-regexp0 s)
246246
(match-beginning 7))
247247

@@ -274,18 +274,22 @@ TIMES is a list of time plists with :timestamp-string."
274274
(org-wild-notifier--time-left (* 60 (cdr str-interval)))))
275275

276276
(defun org-wild-notifier-get-minutes-into-day (time)
277+
"Return the number of minutes from midnight for TIME string."
277278
(org-duration-to-minutes (org-get-time-of-day time t)))
278279

279280
(defun org-wild-notifier-get-hours-minutes-from-time (time-string)
281+
"Parse TIME-STRING and return a list of (hours minutes)."
280282
(let ((total-minutes (truncate (org-wild-notifier-get-minutes-into-day time-string))))
281283
(list (/ total-minutes 60)
282284
(mod total-minutes 60))))
283285

284286
(defun org-wild-notifier-set-hours-minutes-for-time (time hours minutes)
287+
"Return TIME with HOURS and MINUTES set, preserving the date."
285288
(cl-destructuring-bind (_s _m _h day month year dow dst utcoff) (decode-time time)
286289
(encode-time 0 minutes hours day month year dow dst utcoff)))
287290

288291
(defun org-wild-notifier-current-time-matches-time-of-day-string (time-of-day-string)
292+
"Return non-nil if current time matches TIME-OF-DAY-STRING."
289293
(let ((now (current-time)))
290294
(org-wild-notifier--time=
291295
now
@@ -294,6 +298,7 @@ TIMES is a list of time plists with :timestamp-string."
294298
(org-wild-notifier-get-hours-minutes-from-time time-of-day-string)))))
295299

296300
(defun org-wild-notifier-current-time-is-day-wide-time ()
301+
"Return non-nil if current time matches any day-wide alert time."
297302
(--any (org-wild-notifier-current-time-matches-time-of-day-string it)
298303
org-wild-notifier-day-wide-alert-times))
299304

@@ -306,17 +311,17 @@ TIMES is a list of time plists with :timestamp-string."
306311
org-wild-notifier-day-wide-alert-times)))
307312

308313
(defun org-wild-notifier-day-wide-notifications (events)
314+
"Return unique day-wide notification texts for EVENTS."
309315
(->> events
310316
(-filter 'org-wild-notifier-display-as-day-wide-event)
311317
(-map 'org-wild-notifier--day-wide-notification-text)
312318
(-uniq)))
313319

314320
(defun org-wild-notifier-display-as-day-wide-event (event)
315-
;; `org-wild-notifier-event-has-any-passed-time' event is a requirement,
316-
;; regardless of whether
317-
;; `org-wild-notifier-show-any-overdue-with-day-wide-alerts' is set because
318-
;; the events list can include events scheduled tomorrow. We only want to
319-
;; alert for things scheduled today.
321+
"Return non-nil if EVENT should display as a day-wide event.
322+
`org-wild-notifier-event-has-any-passed-time' is required regardless of
323+
`org-wild-notifier-show-any-overdue-with-day-wide-alerts' because the events
324+
list can include events scheduled tomorrow. We only alert for today."
320325
(and (org-wild-notifier-event-has-any-passed-time event)
321326
(or org-wild-notifier-show-any-overdue-with-day-wide-alerts
322327
(org-wild-notifier-event-has-any-day-wide-timestamp event))))
@@ -370,6 +375,7 @@ Returns a list of notification messages."
370375
(org-split-string ":")))
371376

372377
(defun org-wild-notifier--whitelist-predicates ()
378+
"Return a list of predicate functions for whitelist filtering."
373379
(->> `([,org-wild-notifier-keyword-whitelist
374380
(lambda (it)
375381
(-contains-p org-wild-notifier-keyword-whitelist
@@ -387,6 +393,7 @@ Returns a list of notification messages."
387393
(--map (aref it 1))))
388394

389395
(defun org-wild-notifier--blacklist-predicates ()
396+
"Return a list of predicate functions for blacklist filtering."
390397
(->> `([,org-wild-notifier-keyword-blacklist
391398
(lambda (it)
392399
(-contains-p org-wild-notifier-keyword-blacklist
@@ -446,6 +453,7 @@ Returns a list of notification messages."
446453

447454

448455
(defun org-wild-notifier-environment-regex ()
456+
"Return a regex matching all environment variables to inject."
449457
(macroexpand
450458
`(rx (or
451459
,@(mapcar (lambda (regexp) (list 'regexp regexp))
@@ -602,7 +610,7 @@ MARKER acts like event's identifier."
602610
(notify-at . ,(org-wild-notifier--extract-notify-at-times marker))))
603611

604612
(defun org-wild-notifier--stop ()
605-
"Stops the notification timer and cancel any in-progress checks."
613+
"Stop the notification timer and cancel any in-progress check."
606614
(-some-> org-wild-notifier--timer (cancel-timer))
607615
(when org-wild-notifier--process
608616
(interrupt-process org-wild-notifier--process)
@@ -620,6 +628,7 @@ smoother experience this function also runs a check without timer."
620628
(setf org-wild-notifier--timer it)))
621629

622630
(defun org-wild-notifier--check-events (events)
631+
"Process EVENTS and send notifications for those due now."
623632
(setq org-wild-notifier--process nil)
624633
(-each
625634
(->> events
@@ -698,10 +707,10 @@ TIME is a string in HH:MM format or any format accepted by `org-read-date'."
698707
"Get all notifications for EVENT.
699708
Returns a list of notification plists, each containing:
700709
:notify-at - Emacs time when notification should fire
701-
:event-time - Emacs time of the event (nil for absolute/day-wide notifications)
710+
:event-time - Emacs time of the event (nil for absolute/day-wide)
702711
:event-time-string - Original timestamp string (nil for absolute/day-wide)
703-
:timestamp-type - Symbol: deadline, scheduled, or timestamp (nil for absolute/day-wide)
704-
:minutes-before - Minutes before event (nil for absolute/day-wide notifications)
712+
:timestamp-type - deadline, scheduled, or timestamp (nil for abs/day-wide)
713+
:minutes-before - Minutes before event (nil for absolute/day-wide)
705714
:type - Symbol: relative, absolute, or day-wide
706715
:title - Event title string
707716
:marker - Org marker for navigation/queries
@@ -783,10 +792,10 @@ Returns a list of event alists suitable for notification processing."
783792
"Get all notifications for the org entry at MARKER.
784793
Returns a list of notification plists, each containing:
785794
:notify-at - Emacs time when notification should fire
786-
:event-time - Emacs time of the event (nil for absolute/day-wide notifications)
795+
:event-time - Emacs time of the event (nil for absolute/day-wide)
787796
:event-time-string - Original timestamp string (nil for absolute/day-wide)
788-
:timestamp-type - Symbol: deadline, scheduled, or timestamp (nil for absolute/day-wide)
789-
:minutes-before - Minutes before event (nil for absolute/day-wide notifications)
797+
:timestamp-type - deadline, scheduled, or timestamp (nil for abs/day-wide)
798+
:minutes-before - Minutes before event (nil for absolute/day-wide)
790799
:type - Symbol: relative, absolute, or day-wide
791800
:title - Event title string
792801
:marker - Org marker for navigation/queries
@@ -799,10 +808,10 @@ Returns a list of notification plists, each containing:
799808
"Get all notifications for upcoming events.
800809
Returns a list of notification plists, each containing:
801810
:notify-at - Emacs time when notification should fire
802-
:event-time - Emacs time of the event (nil for absolute/day-wide notifications)
811+
:event-time - Emacs time of the event (nil for absolute/day-wide)
803812
:event-time-string - Original timestamp string (nil for absolute/day-wide)
804-
:timestamp-type - Symbol: deadline, scheduled, or timestamp (nil for absolute/day-wide)
805-
:minutes-before - Minutes before event (nil for absolute/day-wide notifications)
813+
:timestamp-type - deadline, scheduled, or timestamp (nil for abs/day-wide)
814+
:minutes-before - Minutes before event (nil for absolute/day-wide)
806815
:type - Symbol: relative, absolute, or day-wide
807816
:title - Event title string
808817
:marker - Org marker for navigation/queries

0 commit comments

Comments
 (0)