aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* feat(dirvish): print the file at point with PCraig Jennings2026-05-122-1/+181
| | | | | | `P' in dirvish/dired now runs `cj/dirvish-print-file': it sends the file at point to the default printer via CUPS (`lp', falling back to `lpr'), after a confirmation prompt. It refuses directories and file types outside `cj/dirvish-print-extensions' (pdf, txt, org, images, source files, ...). CUPS filters handle PDFs directly, so `lp <file>' covers everything in the list, and no separate print dialog is needed. `P' was the project/home-relative variant of `cj/dired-copy-path-as-kill', now dropped (the `p' absolute-path and `l' org-link bindings stay, and `M-x cj/dired-copy-path-as-kill' still works). Plain dired's built-in `P' was `dired-do-print', which `dirvish-mode-map' had already shadowed, so this just replaces it with a type-aware version. Tests cover the predicates and the command's confirm / decline / no-file / directory / non-printable / no-printer / print-failure paths.
* test(scripts): add bats coverage for setup-email.sh password helpersCraig Jennings2026-05-123-39/+147
| | | | | | `setup-email.sh' ran top to bottom, so the only way to exercise `install_encrypted_password' / `decrypt_password' was to run the whole new-machine setup (mbsync, mu init). Its procedural body now lives in a `main()' function guarded by the usual `[[ "${BASH_SOURCE[0]}" == "${0}" ]]' check, so sourcing the script just defines the helpers, and running it directly is unchanged. New `tests/test-setup-email.bats' sources the script, points the password dirs at a per-test tmpdir, and covers both helpers across the normal / skip-existing / missing-source / (for decrypt) gpg-failure paths, stubbing `gpg' so no real key is needed. `make test-bash' runs the bats files, and `make test' picks them up after the Elisp suite when bats is installed.
* fix(mail): clear the marks after saving from the attachment selectorCraig Jennings2026-05-122-2/+12
| | | | `cj/mu4e-attachment-selection-save-marked' left the `[x]' marks set after a successful save, so a second `s' silently re-saved the same files. It now unmarks every row and re-renders once the save returns, so the buffer stays open for another batch (and `q'/RET still exit). The save-marked test asserts the marks are cleared.
* fix(slack): error when adding a reaction outside a Slack bufferCraig Jennings2026-05-122-7/+12
| | | | `cj/slack-message-add-reaction' wrapped its whole body in `when-let*' on `slack-current-buffer', so invoking C-; S ! outside a Slack message view did nothing at all, and with no message it looked like the key wasn't even bound. It now `user-error's "Not in a Slack buffer". A test covers the case.
* refactor(lsp): rename cj/lsp--disable-eldoc-hover for accuracyCraig Jennings2026-05-122-8/+9
| | | | The helper removes lsp-mode's entry from `eldoc-documentation-functions' in the current buffer. It never touched hover display, so the old name was misleading. It's now `cj/lsp--remove-eldoc-provider', the two tests rename to match, and the docstring drops the "hover" wording.
* refactor(mail): fail fast on an attachment part with no MIME handleCraig Jennings2026-05-122-7/+7
| | | | `cj/mu4e--save-attachment-part' called `cj/mu4e--ensure-attachment-save-functions' first, so a part with no MIME handle triggered the `mu4e-mime-parts' load before the handle check could fail. The handle check now runs first, so the malformed input is caught right away and the user-error fires the same way whether or not mu4e's MIME support is loadable. The test for that case drops the mu4e stubs it only needed because the load used to come first.
* refactor(mail): extract the mu4e attachment workflow into its own moduleCraig Jennings2026-05-124-308/+341
| | | | | | The attachment-save UI (the MIME-part filters, the three save commands, and the `special-mode'-derived selection buffer) was ~230 lines in `mail-config.el' and depended on nothing else there. It moves to `modules/mu4e-attachments.el', which `mail-config' now requires. `cj/email-map' and its C-; e bindings stay put. The keymap just points at commands that now live next door. The unit tests move with it: `test-mail-config-attachments.el' becomes `test-mu4e-attachments.el' and requires the new module directly instead of pulling in the whole mu4e and org-msg use-package stack. The two tests that check `cj/email-map' wiring move to a new `test-mail-config.el', since that map belongs to `mail-config'. One of the moved tests quietly relied on a real mu4e install (it loaded `mu4e-mime-parts' through a load-path entry that loading `mail-config' happens to add), so it now stubs that path itself.
* build: add make benchmark target and skip :perf tests by defaultCraig Jennings2026-05-122-11/+22
| | | | | | `make test', `make coverage', and the editor's PostToolUse test runner all selected `(not (tag :slow))', which let the now-`:perf'-tagged benchmark suite run alongside the unit tests. Each of those three filters now also excludes `:perf', and a new `make benchmark' target runs the benchmark file on its own. `make test-file' and `make test-name' keep their old filters so the suite stays reachable for ad-hoc runs. `COVERAGE_EXCLUDE' loses `test-lorem-optimum-benchmark.el'. The tag filter handles it now, so the only entry left is `test-all-comp-errors.el', which byte-compiles modules and can't run under undercover's instrumentation.
* test(lorem-optimum): tag benchmarks :perf and assert on scaling ratiosCraig Jennings2026-05-121-75/+71
| | | | | | The benchmark suite carried no tag, so `make test' ran it every time, and three of its tests asserted absolute wall-clock times (`(should (< time 5000.0))' and friends). Those numbers hold on my laptop and break on a slower box. Every benchmark is now `:perf'-tagged so the default test run skips it. The three absolute learn thresholds collapse into one `benchmark-learn-scaling' test: it times 1K, 10K, and 100K learns and requires each 10x jump in input to cost under 40x the time. Linear scaling lands near 10x, and the 40x ceiling tolerates GC pauses and slow hardware while still catching an O(N^2) regression. The rest drop their absolute `should's and stay as timing reports for `make benchmark'.
* docs: clarify the coverage-exclude and token-seed commentsCraig Jennings2026-05-112-2/+5
| | | | The Makefile's `COVERAGE_EXCLUDE' comment said why `test-all-comp-errors.el' is excluded but not why `test-lorem-optimum-benchmark.el' is. It now notes that undercover's instrumentation slows execution enough to fail the benchmark's wall-clock assertions. And `cj/markov-generate' now has a comment explaining why `tokens' is seeded reversed (`(list w2 w1)'): the list is built with `push' and `nreverse'd at the end, so without the note the reversed seed reads like a bug at a glance.
* test: close coverage gaps from the preceding batchCraig Jennings2026-05-115-0/+103
| | | | | | | | | Untested paths surfaced while reviewing the preceding feature/fix commits: - calendar-sync: a test that `-L' precedes `-l' in the worker command (separate `member' checks wouldn't catch a swap), plus a `:slow' tag on the real-subprocess worker test so it stays out of the default `make test' run. - org-capture cache: a killed marker buffer invalidates the entry and the next resolution rescans without erroring on the stale marker, `cj/org-capture-clear-target-cache' actually empties the hash, and non-`file+headline' targets (`file', `file+olp', `file+function') fall through to the original `org-capture-set-target-location'. - lorem-optimum: `cj/lipsum-title' on an empty chain returns "", not an error. - calibredb-epub: a negative `cj/nov-margin-percent' is clamped up to 0 (text takes the full window width). - mu4e attachments: the default save directory comes from the part's `:target-dir' and falls back to `~/Downloads/', and asking for the attachment at point on a header line fails with a `user-error'.
* 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.
* feat(mu4e): simpler attachment-save commands on C-; e S/s/mCraig Jennings2026-05-112-10/+474
| | | | Three project-owned commands that reuse mu4e's MIME metadata (`mu4e-view-mime-parts') and save primitives (`mm-save-part-to-file', `mu4e-uniquify-save-file-name-function') directly instead of driving mu4e's completion UI. `cj/mu4e-save-all-attachments' (`C-; e S') prompts once for a directory and saves every attachment-like part. `cj/mu4e-save-attachment-here' (`C-; e s') saves one attachment, picked by display label, with duplicate filenames shown as "name <part N>" so they don't collapse into one completion candidate. `cj/mu4e-save-some-attachments' (`C-; e m') opens a `*mu4e attachments*' selection buffer showing mark state, label, MIME type, and size per row, where `RET' toggles a row, `a' / `u' mark / unmark all, `s' saves the marked ones, and `q' quits. Replaced the old Embark/Vertico-workaround comment. Tests cover the attachment filtering, the duplicate-filename disambiguation, save-path construction, the no-handle error, command prompting, and the email-map bindings.
* refactor(epub): clean up calibredb-epub-config.elCraig Jennings2026-05-112-18/+89
| | | | Dropped the 1-second `:defer' from the calibredb use-package and the redundant explicit `nov-render-document' call in `cj/nov-apply-preferences'. Nov / visual-fill-column text width now recalculates on `window-configuration-change-hook'. `cj/nov--text-width-for-window' computes the (clamped, minimum-readable) width and `cj/nov-update-layout' installs it buffer-locally. Lowered `calibredb-search-page-max-rows' from 20000 to 500 (pagination was effectively disabled). Replaced the anonymous zathura keybinding with `cj/nov-open-external'. Tests cover the width computation and the external-open binding.
* build(make): exclude the lorem-optimum benchmark from coverage runsCraig Jennings2026-05-111-1/+3
| | | | `test-lorem-optimum-benchmark.el' runs under undercover during `make coverage', and the instrumentation slows the path enough to fail the benchmark's timing assertions. Added it to `COVERAGE_EXCLUDE' alongside `test-all-comp-errors.el'. It still runs in the normal `make test' flow.
* fix(slack): harden and curate the C-; S ! reaction workflowCraig Jennings2026-05-112-1/+185
| | | | Two problems with `C-; S !'. First, emacs-slack's `slack-reaction-echo-description' runs in a buffer-local `post-command-hook' and can error on every keystroke when a reaction widget's text properties are malformed, which makes it hard to leave the Slack buffer or recover with C-g. It's now wrapped in `condition-case' that, on error, removes the hook from that buffer's local `post-command-hook' and messages once. Second, without emojify the upstream reaction picker is a flat completing-read over 1600+ names. `cj/slack-message-add-reaction' now offers a curated common list (`thumbsup', `pray', `eyes', `white_check_mark', `heart', `joy', `thinking_face', `rocket', `tada') with "Other..." delegating back to `slack-message-reaction-input' for the full set. Tests cover the hook hardening, the curated picker, and the `C-; S !' rebinding.
* feat(setup-email): add the deepsat work accountCraig Jennings2026-05-111-29/+62
| | | | `setup-email.sh' was still gmail+cmail only. Added `dmail' as a first-class maildir (`~/.mail/dmail') and the work address to the `mu init' list, and reworked password bootstrap to match the live config: the gmail and dmail password files stay encrypted (mbsync/msmtp decrypt them on use), while cmail decrypts to `~/.config/.cmailpass' for ProtonBridge. A missing password source now fails loudly instead of continuing silently. `bash -n' verified. The script itself wasn't run, since it decrypts credentials, runs mbsync, and reindexes mu.
* perf(lorem-optimum): speed up the Markov generation pathCraig Jennings2026-05-113-56/+70
| | | | `cj/markov-join-tokens' collects tokens in a list and `mapconcat's once instead of repeated string concatenation. `cj/markov-generate' uses `push'/`nreverse' instead of repeated `append'. The Markov keys are cached as a vector so random key selection is O(1). Re-enabled the benchmark tests (the `:slow' tags were stale) and added a `cj/lipsum-title' test after byte-compilation flagged a malformed form there. `assets/liber-primus.txt' is left as-is (36 KB / 5,374 words, small enough not to need trimming). 100K-word learning now measures about 196 ms.
* refactor(prog-lsp): replace obsolete lsp-eldoc-hookCraig Jennings2026-05-112-1/+36
| | | | lsp-mode 9.0.0 made `lsp-eldoc-hook' an obsolete alias for Emacs's `eldoc-documentation-functions', and `lsp-managed-mode' already adds `lsp-eldoc-function' to that buffer-local hook. Dropped the obsolete `(setq lsp-eldoc-hook nil)'. `cj/lsp--disable-eldoc-hover' now removes `lsp-eldoc-function' from the buffer-local `eldoc-documentation-functions' via `lsp-managed-mode-hook', which clears the obsolete-variable byte-compile warning. Tests cover the hook removal, leaving the default `eldoc-documentation-functions' value alone, and the module no longer naming `lsp-eldoc-hook'.
* perf(org-capture): cache file+headline target markersCraig Jennings2026-05-112-0/+195
| | | | 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(calendar-sync): give the no-init .ics worker its module load-pathCraig Jennings2026-05-112-1/+26
| | | | The async .ics-to-Org worker runs `emacs --batch --no-site-file --no-site-lisp' and loads `calendar-sync.el' by absolute path, but that doesn't make its sibling `(require 'cj-org-text-lib)' resolvable, so the conversion died with "Cannot open load file: cj-org-text-lib". `calendar-sync--worker-command' now inserts `-L <module-dir>' before `-l calendar-sync.el', which keeps the worker isolated from `init.el' while letting it load its local module deps. Updated the worker-command test and added a regression test that runs the real no-init worker shape.
* feat(window): kill the other window's buffer with C-; b KCraig Jennings2026-05-113-1/+96
| | | | `cj/kill-other-window-buffer' (in undead-buffers.el, on `C-; b K') kills or buries the buffer shown in the other window and leaves that window and the split alone. The window just shows whatever bury/kill surfaces next. It reuses `cj/kill-buffer-or-bury-alive', so buffers in `cj/undead-buffer-list' (like `*scratch*') get buried. With more than two windows it acts on `next-window'. Sibling of `cj/kill-other-window' (M-S-o), which deletes the other window. This one keeps it.
* feat(window): resize the split with C-; b <arrow>Craig Jennings2026-05-113-7/+98
| | | | | | `C-; b <left>/<right>/<up>/<down>' moves the active window's divider that way (via `windsize'), then keeps `cj/window-resize-map' active so bare arrows keep nudging until any other key (or `C-g'/`<escape>'). `C-u N C-; b <right>' resizes by N. windsize was on `C-s-<arrow>' (Ctrl+Super), which a tiling WM intercepts, so those keys were useless. I dropped that binding. The package is now `:commands'-deferred, and `windsize-cols'/`windsize-rows' drop to 2 (8/4 overshoots in a held nudge loop). `cj/window-resize-sticky' dispatches on the arrow that triggered it and arms the loop.
* feat(ai-vterm): order the project picker by most-recently-usedCraig Jennings2026-05-115-21/+151
| | | | | | The picker's active group (projects with a live tmux session) used to sort alphabetically. It now leads with projects opened this session, most-recent first, then the rest of the active group alpha, then the no-session group alpha. An in-session list (`cj/--ai-vterm-mru'), pushed to the front by `cj/--ai-vterm-show-or-create' on every open, drives the order. An empty list reproduces the old alphabetical behavior. I also pulled in a fix: `cj/--ai-vterm-tmux-session-name' now sanitizes `.' and `:' in the basename to `_'. tmux disallows those chars in session names and silently rewrites them, so `.emacs.d' really runs in session `aiv-_emacs_d', not `aiv-.emacs.d'. The computed name never matched, so `.emacs.d' was wrongly treated as having no session and landed in the no-session picker group. (A crash-recovery would also spawn a duplicate instead of reattaching.) Sanitizing the same way tmux does keeps the names in sync.
* feat(keymap): bind eval-buffer to C-; b eCraig Jennings2026-05-111-3/+5
| | | | `C-; b e' read best for `eval-buffer', but `e' was `cj/view-email-in-buffer' and the requested fallback `C-; b m' is `cj/move-buffer-and-file', so email-view moves to `C-; b E' (docstring and which-key updated).
* feat(vterm): unify the keys in vterm copy-mode and tmux historyCraig Jennings2026-05-113-45/+64
| | | | | | | | `vterm-copy-mode' and the `C-; x h' tmux-history buffer now share one key story. `M-w' copies the active region and stays put, so I can copy several things in a row. `C-g', `<escape>', or `q' leaves (resuming the live terminal, or closing the history buffer) without copying. `RET' is unbound (no special "copy and exit"). In copy-mode that meant removing vterm's default `RET' -> `vterm-copy-mode-done' binding. Before, `M-w' exited and copied as it went, which made grabbing more than one selection awkward. The history buffer's `cj/vterm-tmux-history-copy-and-quit' was the copy-and-exit one-shot. It's gone. `M-w' then `q' is the equivalent. I also moved `cj/vterm-tmux-history' from `C-; x C' to `C-; x h' (unshifted, and it frees `C') and refreshed the file's stale commentary header, which still referenced the old `C-; V' prefix and `<pause>'.
* feat(ai-vterm): keep emacsclient files out of the agent windowCraig Jennings2026-05-112-0/+172
| | | | | | `server-start' leaves `server-window' nil, so `server-switch-buffer' opens an `emacsclient -n' file in the selected window. When I'm typing in the agent vterm, the selected window is the agent window, so "tell the agent to open something" replaced the agent buffer with that file. I wired `server-window' to a function. When the selected window shows an `agent [...]' buffer, it puts the file in a non-agent window instead, splitting one off to the left of the agent when the agent is the only window. emacsclient invocations from anywhere else still go through `pop-to-buffer' unchanged. `cj/--ai-vterm-non-agent-window' picks the target window. It skips the minibuffer, dedicated windows, and any window already showing an agent buffer.
* fix(ui-config): use the writeable cursor color in a live vtermCraig Jennings2026-05-112-6/+116
| | | | | | `vterm-mode' sets `buffer-read-only', so `cj/set-cursor-color-according-to-mode' painted the cursor with the read-only color (orange) whenever point was in a vterm. That includes the live terminal, not just `vterm-copy-mode'. But a live terminal takes input: keystrokes go to the process, not the buffer. So a live vterm now reports `unmodified' instead. `vterm-copy-mode' still reports `read-only': there it really is a read-only Emacs buffer the user navigates, and the orange cursor is the right signal. I pulled the state cond out of `cj/set-cursor-color-according-to-mode' into `cj/--buffer-cursor-state' so it's unit-testable without a real frame or `set-cursor-color'.
* chore(hooks): eval load-prefer-newer before byte-compile and test runsCraig Jennings2026-05-111-1/+5
| | | | The validate-el.sh hook loaded stale `.elc` files when the matching `.el` was newer (e.g. after a sed-driven rename where the byte-compile hook never fires). `make test` already sets this. The hook didn't, so I added `(setq load-prefer-newer t)` to all three emacs invocations: the parens check, the byte-compile, and the test run.
* refactor(ai-vterm): rename Claude-specific names to a generic "agent"Craig Jennings2026-05-1122-445/+448
| | | | | | | | | | | | | | | | | I may add other terminal agents to this launcher (aider, an open-source LLM TUI), so the buffer prefix, the user knob, and the internal helpers shouldn't say "Claude". The module name (ai-vterm) and the `cj/ai-vterm-*` customs were already generic. This finishes the job: - buffer prefix `claude [<basename>]` -> `agent [<basename>]` (the `defconst` and the matching display-buffer-alist regex move together) - `cj/ai-vterm-claude-command` -> `cj/ai-vterm-agent-command` (the default still runs the `claude` CLI, with a docstring note on swapping it) - `cj/--ai-vterm-claude-buffers` / `-displayed-claude-window` / `-reuse-existing-claude` -> `-agent-*`, and their test files renamed to match - prose in the module commentary and docstrings, plus the matching test docstrings and buffer-name literals `vterm-config.el` hardcodes the same buffer prefix in `cj/--vterm-toggle-buffer-p` (F12 excludes agent buffers from its candidate set), so that literal moved too. Collapsing it into the shared `cj/--ai-vterm-name-prefix` is a cleanup for another day. After a reload, a project's buffer opens as `agent [foo]` instead of `claude [foo]`. Old buffers keep their names until killed. I also corrected two stale `eshell-vterm-config.el` references in ai-vterm.el docstrings (that module was split into `vterm-config.el`). Two things keep saying "Claude": the `cj/ai-vterm-agent-command` default value (the actual CLI), and the "Claude Code" example in `vterm-config.el`'s cursor-restore docstring (a concrete TUI example, not branding). 90 tests pass. `make validate-modules` clean.
* feat(ai-vterm): name the tmux session's first window "ai"Craig Jennings2026-05-112-6/+36
| | | | I pass `tmux new-session -n` so the window running the AI tool shows up as "ai" in the window list instead of auto-naming after the running program. A shell opened by hand in a later window still auto-names (e.g. "zsh"), so the two read distinctly. The name is a new `defcustom` (`cj/ai-vterm-tmux-window-name`), symmetric with the session-prefix custom.
* feat(ai-vterm): surface surviving tmux sessions in the project pickerCraig Jennings2026-05-116-61/+344
| | | | | | Each project's tmux session is now named `<cj/ai-vterm-tmux-session-prefix><basename>` (default `aiv-`), so `tmux ls` can be filtered to AI-vterm's own sessions. After an Emacs crash the C-F9 project picker reads `tmux list-sessions`, matches surviving sessions back to their directories, and sorts those to the top: `[detached]` when only the tmux session is alive, `[running]` when a vterm buffer exists. The rest follow alphabetically. With tmux missing or no server running, it falls back to a plain alphabetical list. The picker's collection is a completion table that pins display order so Vertico doesn't re-sort and undo the active-first grouping. The prefix is a new `defcustom` rather than `claude-`, which collides with hand-rolled tmux sessions. Sessions named before this change use the bare basename and won't be matched afterward. One `tmux kill-server` clears any orphans.
* test(vterm): cover AI-vterm inheritance of the vterm copy pathCraig Jennings2026-05-111-0/+32
| | | | I added three ERT cases around `cj/vterm--current-tmux-pane-id` and `cj/vterm-copy-mode-cancel`: the pane-id lookup rejects a non-`vterm-mode` buffer, it still resolves a `claude [...]`-named buffer by process TTY, and the copy-mode cancel command errors outside copy mode. The pane-id-by-TTY case pins the contract that AI-vterm buffers get the copy commands because they're `vterm-mode` buffers, not because of any buffer-name check.
* docs: add Python tree-sitter font-lock predicate-mismatch diagnosticCraig Jennings2026-05-111-0/+196
| | | | Pins down why every Python buffer fires `treesit-query-error` on redisplay: Emacs 30.2 emits `#match` predicates, but tree-sitter 0.26 only accepts `#match?`. The doc has the reproduction, the six fix options with their trade-offs, and the verification path. The next pass picks up at decision-time instead of re-deriving the cause.
* refactor(external-open): extract external-open-lib for shared helpersCraig Jennings2026-05-106-33/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Same shared-helpers split-pattern that ai-vterm/vterm-config use through cj-window-toggle-lib and that calendar-sync uses through cj-org-text-lib. Pull the two pure dispatch helpers out of the external-open feature module into a sibling library so consumers that only need the dispatch don't have to require the whole feature. New `modules/external-open-lib.el' carries: - `cj/external-open-command' - `cj/external-open-launcher-p' `modules/external-open.el' stays as the feature module: the `default-open-extensions' defcustom, the `find-file' advice (`cj/find-file-auto'), and the interactive commands (`cj/xdg-open', `cj/open-this-file-with'). It now requires external-open-lib for the dispatch helpers. Migrate consumers: - system-utils.el used to require `external-open' for `cj/external-open-launcher-p' alone -- now requires `external-open-lib' directly. - dirvish-config.el calls `cj/external-open-command' from `cj/dirvish-open-file-manager-here' -- add an explicit `(require \='external-open-lib)'. Test files renamed to match the system-lib naming pattern (test-<library>-<feature>.el): - test-external-open-command.el -> test-external-open-lib-command.el - test-external-open-launcher-p.el -> test-external-open-lib-launcher-p.el No behavior change.
* refactor(tests): rename test files to match cj-*-lib.el modulesCraig Jennings2026-05-102-7/+7
| | | | | | | | | | | | The earlier cj-cache and cj-org-text rename commits renamed the modules but missed renaming the test files. Bring them in line: - tests/test-cj-cache.el -> tests/test-cj-cache-lib.el - tests/test-cj-org-text-sanitize.el -> tests/test-cj-org-text-lib-sanitize.el Update file headers, provide forms, and the in-commentary references. No behavior change.
* refactor(cj-window-geometry): rename to cj-window-geometry-libCraig Jennings2026-05-105-12/+12
| | | | | | | | | | | | Same naming-convention fix as the other library renames in this series. Rename modules/cj-window-geometry.el -> modules/cj-window-geometry-lib.el and tests/test-cj-window-geometry.el -> tests/test-cj-window-geometry-lib.el. Update provide forms, file headers, and the (require 'cj-window-geometry) call sites in cj-window-toggle-lib.el, ai-vterm.el, vterm-config.el, and the test file. No behavior change.
* refactor(cj-window-toggle): rename to cj-window-toggle-lib for naming ↵Craig Jennings2026-05-104-10/+10
| | | | | | | | | | | | consistency Rename modules/cj-window-toggle.el -> modules/cj-window-toggle-lib.el and tests/test-cj-window-toggle.el -> tests/test-cj-window-toggle-lib.el. Update provide forms, file headers, and the (require 'cj-window-toggle) call sites in ai-vterm.el, vterm-config.el, and the test file. Same rationale as the cj-cache and cj-org-text renames -- library files in this codebase are suffixed `-lib'. No behavior change.
* refactor(cj-org-text): rename to cj-org-text-lib for naming consistencyCraig Jennings2026-05-103-5/+5
| | | | | | | | | | | Same naming-convention fix as the cj-cache rename. Org-safe text sanitizers extracted in Phase 3 went into modules/cj-org-text.el, should have followed the established `-lib' suffix convention. Rename modules/cj-org-text.el -> modules/cj-org-text-lib.el; update provide form, file header, and the two (require 'cj-org-text) call sites in calendar-sync and test-cj-org-text-sanitize. No behavior change.
* refactor(cj-cache): rename to cj-cache-lib for naming consistencyCraig Jennings2026-05-104-6/+6
| | | | | | | | | | | | | Library files in this codebase are suffixed `-lib' (system-lib.el is the established precedent). The Phase 5 cache helper landed as cj-cache.el; the spec's table proposed names without the suffix and I followed it without checking against convention. Fix the inconsistency now while there are only two consumers and one test. Rename modules/cj-cache.el -> modules/cj-cache-lib.el; update provide form, file header, and the three (require 'cj-cache) call sites in org-agenda-config, org-refile-config, and test-cj-cache. No behavior change.
* refactor(org-refile): migrate to cj-cache helperCraig Jennings2026-05-102-334/+146
| | | | | | | | | | | | | | Phase 5 step 3 of utility-consolidation, second of two cache migrations. Same shape as the agenda migration: drop four state vars, replace the build-with-cache function with a thin wrapper around `cj/cache-value-or-rebuild', extract the slow scan into a pure-ish helper. Add `cj/--org-refile-scan-targets' as the slow filesystem walk (org-roam node enumeration plus 30,000+ todo.org files across code-dir and projects-dir). `cj/build-org-refile-targets' now reads as: detect background-build state, ask the cache helper for the value with the scan helper as BUILD-FN, route the original log lines through :on-hit / :on-build-success. Drop four module-level state vars: - `cj/org-refile-targets-cache' - `cj/org-refile-targets-cache-time' - `cj/org-refile-targets-cache-ttl' - `cj/org-refile-targets-building' Rewrite the existing test file to test wrapper behavior at the contract level (stub the scan helper, verify wrapper outcomes). 8 tests parallel the agenda test set: first-call builds, second-call uses cache, force-rebuild bypass, TTL expiration, empty scan, building-flag cleanup on success and error, and error propagation.
* refactor(org-agenda): migrate to cj-cache helperCraig Jennings2026-05-102-306/+130
| | | | | | | | | | | | | | | | Phase 5 step 2 of utility-consolidation. The agenda-files cache (four module-level vars + 35-line build-with-cache function) now delegates to `cj-cache.el'. Behavior preserved: cache-hit logging, "Building..." background message, building-flag cleanup on error. Add `cj/--org-agenda-scan-files' as a pure-ish helper that returns the file list (the slow filesystem walk). `cj/build-org-agenda-list' becomes a thin wrapper that calls `cj/cache-value-or-rebuild' with the scan helper as BUILD-FN and routes the original log lines through :on-hit / :on-build-success. Drop four module-level state vars: - `cj/org-agenda-files-cache' - `cj/org-agenda-files-cache-time' - `cj/org-agenda-files-cache-ttl' - `cj/org-agenda-files-building' Replace with a single `cj/--org-agenda-files-cache' plist held by the helper. Rewrite the existing test file to test wrapper behavior at the contract level (stub the scan helper, verify wrapper outcomes) instead of poking at internal state vars. 8 tests cover first-call builds, second-call uses cache, force-rebuild bypass, TTL expiration, empty scan, building-flag cleanup on success and error, and error propagation.
* feat(cj-cache): add TTL+building cache helperCraig Jennings2026-05-102-0/+258
| | | | | | | | Phase 5 step 2 of utility-consolidation. Add `modules/cj-cache.el' implementing the API specified in `docs/design/cache-helper-design.org': `cj/cache-make' / `cj/cache-valid-p' / `cj/cache-value-or-rebuild' / `cj/cache-building-p' / `cj/cache-invalidate'. The helper captures the TTL+building-guard pattern that org-agenda-config and org-refile-config currently hand-roll. Both consumers will migrate in follow-up commits. No call-site changes in this commit -- helper plus its 15 tests only. Tests cover: default and custom TTL, fresh/recent/expired/nil-value validity, miss calls build / hit skips build, force-rebuild overrides hit, the four log callbacks (on-hit / on-build-start / on-build-success / on-build-error), error-rethrow and building-flag cleanup on both success and error paths.
* docs(design): add Phase 5 cache helper design addendumCraig Jennings2026-05-101-0/+165
| | | | | | | | Per Phase 5 step 1 of utility-consolidation. Specifies the cache API to extract from org-agenda-config and org-refile-config (both have parallel TTL+building-guard implementations today). Documents the API: `cj/cache-make', `cj/cache-valid-p', `cj/cache-value-or-rebuild', `cj/cache-building-p', `cj/cache-invalidate'. Out-of-scope: modeline VC cache (buffer-local + key-based, not TTL). Per the spec, that's a future round. Documents the migration order (agenda first, refile second), test plan for the helper, and risk notes (cache-hit logging preservation, building-flag leak guard, async-timer interaction).
* refactor(external-open): consolidate OS-open dispatch in external-open.elCraig Jennings2026-05-108-222/+170
| | | | | | | | | | | | | | | | Phase 4 of utility-consolidation. Three previously-overlapping helpers (system-utils' `cj/identify-external-open-command' and `cj/--open-with-is-launcher-p', plus the dirvish-only `cj/--file-manager-program-for' shipped earlier today) all answered "which OS-open program should I run?". Pull the answer into one place: external-open.el. Move and rename: - `cj/--open-with-is-launcher-p' (system-utils) -> `cj/external-open-launcher-p' (external-open). Public name now matches its module. - `cj/identify-external-open-command' (system-utils) -> `cj/external-open-command' (external-open). Returns nil for unsupported hosts instead of signaling -- callers that need a command must handle nil explicitly. The wrapper `cj/xdg-open' (also moved into external-open) converts nil to a `user-error' with a clear message, preserving the user-facing failure shape. - Delete dirvish's `cj/--file-manager-program-for' helper. `cj/dirvish-open-file-manager-here' now calls `cj/external-open-command' directly. The shell-command fallback for nil-program preserves the previous escape hatch. Break the system-utils <-> external-open recursive require by moving `cj/xdg-open' (the only system-utils function that external-open used) into external-open along with the dispatch. Tests reorganized to match the move. Two new test files (`test-external-open-command.el', `test-external-open-launcher-p.el') replace the two system-utils-named test files. The dirvish file-manager-program test goes away with the helper. 11 tests covering Normal/Boundary/Error for the dispatch (plus the new "unsupported host returns nil" contract). Add `(require \='external-open)' to system-utils.el and `(require \='system-lib)' to external-open.el (for `cj/file-from-context' which xdg-open uses).
* refactor(cj-org-text): extract Org-safe text sanitizers from calendar-syncCraig Jennings2026-05-104-129/+176
| | | | | | | | | | | | | | Phase 3 of utility-consolidation. Three sanitizers moved from calendar-sync.el into a new cj-org-text.el module so other consumers (web-clipper, AI conversation, mail-to-org capture) can compose Org content from external text without depending on calendar: - `calendar-sync--sanitize-org-body' -> `cj/org-sanitize-body-text' - `calendar-sync--sanitize-org-property-value' -> `cj/org-sanitize-property-value' - `calendar-sync--sanitize-org-heading' -> `cj/org-sanitize-heading' The helpers stay pure (string in, string out, nil-safe) and have no Org-mode dependency, so they work in batch and in tests without loading Org. Migrate calendar-sync.el to use the new public names: drop the three local defuns, add `(require \='cj-org-text)', update the six call sites in `calendar-sync--make-event-entry'. Move the existing 17-test file to `tests/test-cj-org-text-sanitize.el', rename test names to match the new helpers, add 1 nil-input test for `cj/org-sanitize-heading' that wasn't in the original file. Total: 18 Normal/Boundary tests across the three helpers.
* refactor(system-lib): extract cj/file-from-context from system-utilsCraig Jennings2026-05-103-42/+48
| | | | | | | | Phase 2.4 of utility-consolidation, the last item in the spec's recommended order. `cj/--file-from-context' resolves "the current file" via a three-step fallback chain (explicit arg, `buffer-file-name', dired file at point) -- a useful pattern for any command that operates on the current file regardless of which kind of buffer the user is in. Promote to public `cj/file-from-context' and re-home in system-lib.el so other modules (mail capture, external-open, AI conversation, dirvish helpers) can use it without an awkward dependency on system-utils. Migrate the two callers in system-utils.el (`cj/open-this-file-with' and `cj/open-file-with-command') and add `(require \='system-lib)' there per the Phase 2 exit criterion. Move the existing 7-test file to `tests/test-system-lib-file-from-context.el' and update its references to the new public name. The test shape is unchanged: 4 Normal + 3 Boundary cases covering explicit-arg precedence, buffer-file-name fallback, dired fallback, and the all-nil case.
* refactor(system-lib): extract cj/process-output-or-error and ↵Craig Jennings2026-05-103-15/+120
| | | | | | | | | | | | cj/git-output-or-error from coverage-core Phase 2.3 of utility-consolidation. `cj/--coverage-git-string' was a generic argv-based runner ("run program, return stdout, raise user-error on non-zero with status+output in the message") trapped inside coverage-core. Lift the generic shape into `cj/process-output-or-error' and add `cj/git-output-or-error' as a one-line wrapper that supplies "git" as the program. Both live in system-lib.el. Future callers I have in mind: reconcile-open-repos shell-style git calls (the high-priority data-safety task), vc-config clipboard cloning, mail integrations that touch git for commit signatures. Six Normal/Boundary/Error tests cover success/no-args/non-zero-exit for the generic runner, the user-error message content (program name, exit status, trimmed output), and the git wrapper's program argument routing. Migrate coverage-core's `cj/--coverage-git-merge-base' and `cj/--coverage-git-diff' to call the new git wrapper. Drop the local `cj/--coverage-git-string' definition. Add `(require \='system-lib)' to coverage-core.el per the Phase 2 exit criterion.
* refactor(system-lib): extract cj/shell-quote-argument-readable from dev-fkeysCraig Jennings2026-05-103-17/+79
| | | | | | | | Phase 2.2 of utility-consolidation. The "quote only when shell-unsafe characters appear, otherwise leave the argument readable" pattern was trapped in dev-fkeys as `cj/--f6-shell-quote-argument' alongside its `cj/--f6-shell-safe-argument-regexp' constant. Lift both into system-lib.el under their generic names; the F6 branding hid that the same shape is useful for any generated compile/test command where the surrounding line ends up in a *compilation* buffer the user reads. Six Normal/Boundary tests cover safe inputs that pass through unchanged (alphanumeric paths, test regexes, `FLAG=value', `host:port'), unsafe inputs that get quoted (spaces, `$', `;', `&', backticks, `*'), and the empty-string boundary. Migrate dev-fkeys's five callers to the new name and add `(require \='system-lib)' per the Phase 2 exit criterion.
* docs: update test and coverage documentationCraig Jennings2026-05-104-23/+38
|