summaryrefslogtreecommitdiff
path: root/modules/calendar-sync.el
AgeCommit message (Collapse)Author
2025-11-17feat(calendar-sync): Make ICS fetching asynchronousCraig Jennings
Changed calendar-sync--fetch-ics from synchronous call-process to asynchronous make-process with callback pattern. This prevents Emacs from freezing during calendar syncs. Changes: - calendar-sync--fetch-ics now takes a callback parameter - Uses make-process with sentinel for async completion - calendar-sync-now updated to use callback pattern - Fetch completes in background without blocking Emacs All 56 tests pass. User confirmed improved responsiveness. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17chore(calendar-sync): Change default interval to 60 minutesCraig Jennings
Changed default sync interval from 15 minutes to 60 minutes (1 hour). Rationale: - Calendar events typically don't change that frequently - Reduces network requests and potential blocking events - Users can still manually sync or adjust interval as needed - More conservative default that balances freshness with performance 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17refactor(calendar-sync): Make interval configurable in minutesCraig Jennings
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>
2025-11-17feat(calendar-sync): Add auto-start toggle and convert to defvarCraig Jennings
Changes: 1. Converted defcustom → defvar (3 variables): - calendar-sync-ics-url - calendar-sync-interval - calendar-sync-file - Removed defgroup (not using customize system) 2. Added calendar-sync-auto-start variable (default: t) - Controls whether auto-sync starts when module loads - Set to nil to disable automatic startup 3. Updated initialization to check auto-start flag - Auto-sync only starts if both auto-start and URL are non-nil - Provides user control over automatic behavior Rationale: - Auto-sync is convenient but should be toggleable - defvar is simpler and more direct than defcustom - Consistent with project style (no customize interface) Default behavior: Auto-sync enabled (backwards compatible with user expectation) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17fix(calendar-sync): Remove carriage return characters from synced eventsCraig Jennings
Problem: Google Calendar .ics files use CRLF line endings (RFC 5545 spec), which resulted in 11,685 ^M (CR) characters appearing in gcal.org, particularly at the end of org header lines. Solution: - Created calendar-sync--normalize-line-endings function to strip all \r characters from .ics content - Integrated into calendar-sync--fetch-ics immediately after curl download - Ensures clean Unix LF-only line endings throughout parsing pipeline Testing: - Added comprehensive test suite: test-calendar-sync--normalize-line-endings.el - 16 tests covering Normal, Boundary, and Error cases - All 56 existing calendar-sync tests still pass (no regressions) - Verified: gcal.org now has 0 CR characters (was 11,685) Files modified: - modules/calendar-sync.el: Added normalize function, updated fetch function - tests/test-calendar-sync--normalize-line-endings.el: New comprehensive test suite 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-16feat(calendar-sync): Add automatic timezone detection and chronological sortingCraig Jennings
Implemented calendar-sync.el as a complete replacement for org-gcal, featuring: **Core Functionality:** - One-way sync from Google Calendar to Org (via .ics URL) - UTC to local timezone conversion for all event timestamps - Chronological event sorting (past → present → future) - Non-blocking sync using curl (works reliably in daemon mode) **Automatic Timezone Detection:** - Detects timezone changes when traveling between timezones - Tracks timezone offset in seconds (-21600 for CST, -28800 for PST, etc.) - Triggers automatic re-sync when timezone changes detected - Shows informative messages: "Timezone change detected (UTC-6 → UTC-8)" **State Persistence:** - Saves sync state to ~/.emacs.d/data/calendar-sync-state.el - Persists timezone and last sync time across Emacs sessions - Enables detection even after closing Emacs before traveling **User Features:** - Interactive commands: calendar-sync-now, calendar-sync-start/stop - Keybindings: C-; g s (sync), C-; g a (start auto-sync), C-; g x (stop) - Optional auto-sync every 15 minutes (disabled by default) - Clear status messages for all operations **Code Quality:** - Comprehensive test coverage: 51 ERT tests (100% passing) - Refactored UTC conversion into separate function - Clean separation of concerns (parsing, conversion, formatting, sorting) - Well-documented with timezone behavior guide and changelog **Migration:** - Removed org-gcal-config.el (archived in modules/archived/) - Updated init.el to use calendar-sync - Moved gcal.org to .emacs.d/data/ for machine-independent syncing - Removed org-gcal appointment capture template Files modified: modules/calendar-sync.el:442, tests/test-calendar-sync.el:577 Files created: data/calendar-sync-state.el, tests/testutil-calendar-sync.el Documentation: docs/calendar-sync-timezones.md, docs/calendar-sync-changelog.md 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>