aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-02-19 16:15:13 -0600
committerCraig Jennings <c@cjennings.net>2026-02-19 16:15:13 -0600
commit79653bf1f70e6fd601c363e93ca8ae5226d88ff9 (patch)
treeb8030065a6428b4c42ad49ce573c0c29ec2effa9
parentd8131801bbc5a05ab2fa237b4b5b3fe52454cc36 (diff)
downloadchime-79653bf1f70e6fd601c363e93ca8ae5226d88ff9.tar.gz
chime-79653bf1f70e6fd601c363e93ca8ae5226d88ff9.zip
Add section headers to chime.el for imenu/outline navigation
14 ;;;; headers added for code navigation: Dependencies, Customization Variables, Internal State, Time/Date Utilities, All-Day Event Handling, Event Checking & Navigation, Modeline & Tooltip Display, Whitelist/Blacklist Filtering, Async Event Retrieval, Notification Dispatch, Timestamp Parsing, Event Info Extraction, Configuration Validation, Core Lifecycle. Comments only — zero runtime impact.
-rw-r--r--chime.el28
1 files changed, 28 insertions, 0 deletions
diff --git a/chime.el b/chime.el
index 96f7078..06669e1 100644
--- a/chime.el
+++ b/chime.el
@@ -56,6 +56,8 @@
;;; Code:
+;;;; Dependencies
+
(require 'dash)
(require 'alert)
(require 'async)
@@ -66,6 +68,8 @@
;; Declare functions from chime-debug.el (loaded conditionally)
(declare-function chime-debug-monitor-event-loading "chime-debug")
+;;;; Customization Variables
+
(defgroup chime nil
"Chime customization options."
:group 'org)
@@ -554,6 +558,8 @@ Set to t to enable debug functions:
(file-name-directory (or load-file-name buffer-file-name)))
t)))
+;;;; Internal State
+
(defvar chime--timer nil
"Timer value.")
@@ -601,6 +607,8 @@ for org-agenda-files to be populated)."
;;;###autoload(put 'chime-modeline-string 'risky-local-variable t)
(put 'chime-modeline-string 'risky-local-variable t)
+;;;; Time/Date Utilities
+
(defun chime--time= (&rest list)
"Compare timestamps.
Comparison is performed by converted each element of LIST onto string
@@ -728,6 +736,8 @@ Returns a list of (HOURS MINUTES)."
(--any (chime-current-time-matches-time-of-day-string it)
chime-day-wide-alert-times))
+;;;; All-Day Event Handling
+
(defun chime-day-wide-notifications (events)
"Generate notification texts for day-wide EVENTS.
Returns a list of (MESSAGE . SEVERITY) cons cells with \\='medium severity."
@@ -891,6 +901,8 @@ Handles both same-day events and advance notices."
(t
(format "%s is due or scheduled today" title)))))
+;;;; Event Checking & Navigation
+
(defun chime--check-event (event)
"Get notifications for given EVENT.
Returns a list of (MESSAGE . SEVERITY) cons cells."
@@ -932,6 +944,8 @@ Reconstructs marker from serialized file path and position."
(event (car first-event)))
(chime--jump-to-event event)))
+;;;; Modeline & Tooltip Display
+
(defun chime--format-event-for-tooltip (event-time-str minutes-until title)
"Format a single event line for tooltip display.
EVENT-TIME-STR is the time string, MINUTES-UNTIL is minutes until event,
@@ -1205,6 +1219,8 @@ Tooltip shows events within `chime-tooltip-lookahead-hours' hours."
;; Force update ALL windows/modelines
(force-mode-line-update t))))
+;;;; Whitelist/Blacklist Filtering
+
(defun chime--get-tags (marker)
"Retrieve tags of MARKER."
(-> (org-entry-get marker "TAGS")
@@ -1270,6 +1286,8 @@ Combines keyword, tag, and custom predicate blacklists."
(-remove markers))
markers))
+;;;; Async Event Retrieval
+
(defconst chime-default-environment-regex
(macroexpand
`(rx string-start
@@ -1335,6 +1353,8 @@ Combines keyword, tag, and custom predicate blacklists."
(chime--apply-blacklist)
(-map 'chime--gather-info))))
+;;;; Notification Dispatch
+
(defun chime--notify (msg-severity)
"Notify about an event using `alert' library.
MSG-SEVERITY is a cons cell (MESSAGE . SEVERITY) where MESSAGE is the
@@ -1358,6 +1378,8 @@ notification text and SEVERITY is one of high, medium, or low."
:category 'chime
chime-extra-alert-plist)))
+;;;; Timestamp Parsing
+
(defun chime--convert-12hour-to-24hour (timestamp hour)
"Convert HOUR from 12-hour to 24-hour format based on TIMESTAMP's am/pm suffix.
TIMESTAMP is the original timestamp string (e.g., \"<2025-11-05 Wed 1:30pm>\").
@@ -1497,6 +1519,8 @@ Timestamps are extracted as cons cells:
;; Combine property and plain timestamps, removing duplicates and nils
(-non-nil (append property-timestamps plain-timestamps)))))))
+;;;; Event Info Extraction
+
(defun chime--sanitize-title (title)
"Sanitize TITLE to prevent Lisp read syntax errors during async serialization.
Balances unmatched parentheses, brackets, and braces by adding matching pairs.
@@ -1568,6 +1592,8 @@ especially when buffer names contain angle brackets)."
(marker-file . ,(buffer-file-name (marker-buffer marker)))
(marker-pos . ,(marker-position marker))))
+;;;; Configuration Validation
+
;;;###autoload
(defun chime-validate-configuration ()
"Validate chime's runtime environment and configuration.
@@ -1633,6 +1659,8 @@ When called programmatically, returns structured validation results."
;; Return issues for programmatic use
issues))
+;;;; Core Lifecycle
+
(defun chime--stop ()
"Stop the notification timer and cancel any in-progress check."
(-some-> chime--timer (cancel-timer))