diff options
| author | Craig Jennings <c@cjennings.net> | 2025-11-17 03:11:04 -0600 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2025-11-17 03:11:04 -0600 |
| commit | 1975a14cac038b87a081fbc4c59454fea5670a80 (patch) | |
| tree | a9abe64559eb7a701901c71d2ee844d0fcfc0f06 | |
| parent | 200f7ca2d6621a7173ee73bc8e9111a5fde2c07d (diff) | |
refactor(calendar-sync): Make interval configurable in minutes
Changed calendar-sync-interval (seconds) to calendar-sync-interval-minutes
for more user-friendly configuration.
Changes:
- Renamed: calendar-sync-interval → calendar-sync-interval-minutes
- Units: seconds → minutes (default: 15)
- Internal conversion to seconds happens in calendar-sync-start
- Updated docstrings and messages to reference minutes
Benefits:
- More intuitive configuration (users think in minutes, not seconds)
- Clearer variable name indicates units
- No functional change, just better UX
Example usage:
(setq calendar-sync-interval-minutes 30) ; Sync every 30 minutes
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
| -rw-r--r-- | modules/calendar-sync.el | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/modules/calendar-sync.el b/modules/calendar-sync.el index 344b85c5..5e7989a6 100644 --- a/modules/calendar-sync.el +++ b/modules/calendar-sync.el @@ -46,9 +46,9 @@ "Google Calendar private .ics URL. Get this from Google Calendar Settings → Integrate calendar → Secret address in iCal format.") -(defvar calendar-sync-interval (* 15 60) - "Sync interval in seconds. -Default: 15 minutes (900 seconds).") +(defvar calendar-sync-interval-minutes 15 + "Sync interval in minutes. +Default: 15 minutes.") (defvar calendar-sync-file gcal-file "Location of synced calendar file. @@ -366,7 +366,7 @@ Checks for timezone changes and triggers re-sync if detected." ;;;###autoload (defun calendar-sync-start () "Start automatic calendar syncing. -Syncs immediately, then every `calendar-sync-interval' seconds." +Syncs immediately, then every `calendar-sync-interval-minutes' minutes." (interactive) (when calendar-sync--timer (cancel-timer calendar-sync--timer)) @@ -374,13 +374,14 @@ Syncs immediately, then every `calendar-sync-interval' seconds." (message "calendar-sync: Please set calendar-sync-ics-url before starting") ;; Sync immediately (calendar-sync-now) - ;; Start timer for future syncs - (setq calendar-sync--timer - (run-at-time calendar-sync-interval - calendar-sync-interval - #'calendar-sync--sync-timer-function)) + ;; Start timer for future syncs (convert minutes to seconds) + (let ((interval-seconds (* calendar-sync-interval-minutes 60))) + (setq calendar-sync--timer + (run-at-time interval-seconds + interval-seconds + #'calendar-sync--sync-timer-function))) (message "calendar-sync: Auto-sync started (every %d minutes)" - (/ calendar-sync-interval 60)))) + calendar-sync-interval-minutes))) ;;;###autoload (defun calendar-sync-stop () @@ -441,7 +442,7 @@ Syncs immediately, then every `calendar-sync-interval' seconds." )) ;; Start auto-sync if enabled and URL is configured -;; Syncs immediately then every calendar-sync-interval (default: 15 minutes) +;; Syncs immediately then every calendar-sync-interval-minutes (default: 15 minutes) (when (and calendar-sync-auto-start calendar-sync-ics-url) (calendar-sync-start)) |
