summaryrefslogtreecommitdiff
path: root/modules/org-capture-config.el
Commit message (Collapse)AuthorAgeFilesLines
* refactor(org-drill): share one validated drill-file selectorCraig Jennings13 days1-10/+3
| | | | org-capture-config.el and org-drill-config.el each scanned drill-dir with an inline directory-files call, so a missing, empty, or unreadable drill-dir surfaced as a low-level directory-files error or an empty completing-read, depending on which command ran. Added cj/--drill-files-or-error, the single validated entry point: it signals a clear user-error when the directory is missing, unreadable, or has no drill files, and otherwise returns the list. cj/--drill-pick-file and both drill capture templates now route through it. The pure cj/--drill-files-in primitive and its tests are unchanged. Tests cover missing dir, empty dir, a non-org-only dir, and a normal listing.
* fix(org-capture): single-source the file+headline cache keyCraig Jennings2026-05-111-1/+1
| | | | `cj/org-capture--goto-file-headline' stored the marker under `(list (expand-file-name (buffer-file-name)) headline)' while the lookup helper `cj/org-capture--file-headline-cache-key' uses `(list (org-capture-expand-file path) headline)'. They agree for plain absolute paths, but a symlinked target (`expand-file-name' doesn't follow symlinks, `find-file' canonicalizes the buffer name) or a capture path that needs `org-capture-expand-file's special handling would make the put-key and get-key diverge, so the cache would silently never hit. Production now goes through the helper too, so the key is built one way.
* perf(org-capture): cache file+headline target markersCraig Jennings2026-05-111-0/+106
| | | | A task capture took 15-20 seconds: Org resolves a `(file+headline FILE "Headline")' target by opening the file, widening, and regex-scanning from the top for the headline, and the inbox template captures to `(file+headline inbox-file "Inbox")' over and over. An `:around' advice on `org-capture-set-target-location' caches a marker per resolved file/headline. On the next capture it validates the marker (still live, still in an Org buffer, still at a heading, headline text still matches) and jumps straight there. On any mismatch it falls back to the normal scan/create and refreshes the cache. `M-x cj/org-capture-clear-target-cache' resets it. Tests cover the cache hit, marker invalidation after the headline text changes, and creating a missing headline.
* fix: close drill capture template source linkCraig Jennings2026-05-031-2/+2
| | | | | | | | | | | | | The "d" drill capture template had a malformed source link with only one closing bracket and a literal `n` where a newline should have been: Source: [[%:link][%:description] nCaptured On: %U So new drill captures wrote a broken link and `nCaptured On:` instead of a clean `Captured On:` line on the next row. I closed the link with the missing `]`, and removed the stray `n` so the line break before "Captured On" is just a real newline. The "f" (PDF drill) template was already correct, so I left it alone. I added `tests/test-org-capture-config-drill-template.el`. It loads the module, picks up the "d" template, and asserts both the closed link and the `\nCaptured On: %U` form, plus negative assertions against the broken pre-fix shapes.
* test: add 86 new tests, fix 3 production bugs, fix 8 stale testsCraig Jennings2026-02-151-16/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | New test coverage (86 tests across 7 files): - custom-case: 43 tests (title-case-region, upcase-dwim, downcase-dwim) - custom-datetime: 10 tests (all insert methods with mocked time) - config-utilities: 11 tests (format-build-time type branching) - org-capture-config: 22 tests (date-prefix + event-content) Production bugs found and fixed: - custom-case: title-case-region crashes on whitespace/punctuation-only input (char-after returns nil when no word chars found) - org-capture-config: browser branch missing empty-string guard on :initial plist value, producing stray newline in capture output - mousetrap-mode: keymap never registered in minor-mode-map-alist, so mode was silently not blocking any mouse events. Now pushes/removes on toggle. Additional fixes: - local-repository: fix cons cell syntax bug in localrepo-initialize (was calling vars as functions instead of using cons) - dupre-theme tests: update rainbow-delimiter color expectations - mousetrap tests: update dashboard profile (primary-click → scroll+primary) - music completion test: bind completion-ignore-case to prevent pollution - Delete redundant interactive recording test (duplicate of ERT version) Refactoring: - org-capture-config: extract cj/org-capture--date-prefix pure function from cj/org-capture-format-event-headline for testability Test checklist: todo.org updated to [11/25], removed untestable modules
* feat(calendar-sync): Add automatic timezone detection and chronological sortingCraig Jennings2025-11-161-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* refactor:org-modules: Improve org-mode configurationCraig Jennings2025-10-231-56/+48
| | | | | | | | Remove redundant declarations and reorganize settings for clarity. Centralize org-mode customizations and use `use-package` for streamlined loading and configuration. Remove backward-compatible safeguards and reduce inline comments for cleaner code. Optimize key mappings and simplify the setup of org-related packages.
* refactor: org-capture: Simplify and restructure capture configCraig Jennings2025-10-201-108/+69
| | | | | | | Streamlined org-capture-config.el by removing redundant comments, unused functions, and obsolete declarations. Consolidated the capture helper functions within use-package configuration for better readability and maintenance.
* feat: org-capture: Add drill capture helpers and templatesCraig Jennings2025-10-201-1/+57
| | | | | | | | | | | | Introduce functions `cj/drill-source-link` and `cj/drill-answer-content` for generating source links and content in org-drill captures. Expand org-capture-templates with new entries for drill questions and PDF captures. Adjust key mappings with `keymap-global-set` for task capture. Enhance the org-drill configuration with new keybindings using `keymap-set`. Remove old capture template setup and update initialization sequences.
* fix: org-capture: appt replaces event, selections auto-finishCraig Jennings2025-10-181-7/+8
| | | | | - moving away from two org files to manage events in favor of simply using gcal integration with org-gcal. disabled capture template for schedule-file. - text with selection should auto-finish at capture
* changing repositoriesCraig Jennings2025-10-121-0/+143