summaryrefslogtreecommitdiff
path: root/modules/system-utils.el
Commit message (Collapse)AuthorAgeFilesLines
* refactor(external-open): extract external-open-lib for shared helpersCraig Jennings2026-05-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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(external-open): consolidate OS-open dispatch in external-open.elCraig Jennings2026-05-101-38/+2
| | | | | | | | | | | | | | | | 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(system-lib): extract cj/file-from-context from system-utilsCraig Jennings2026-05-101-14/+4
| | | | | | | | 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.
* fix: restore daemon icons and consolidate nerd-icons setupCraig Jennings2026-05-071-11/+3
| | | | | | | | | | I replaced the load-time icon-stub block in keyboard-compat with per-call :around advice that checks display-graphic-p against the rendering frame. The old block ran at module-load. Under daemon startup no frame exists yet, so display-graphic-p returned nil and the empty-string stubs installed permanently. Every GUI client connecting to that daemon then saw blanks. The new shape lets one daemon serve real icons to GUI clients and blanks to terminal clients. I also pulled the nerd-icons-completion and nerd-icons-ibuffer integrations, the package install, and a new tint helper into modules/nerd-icons-config.el. Per-feature use stays in the consuming module (dashboard, dirvish, keyboard-compat). The malformed cons-cell on the marginalia hook in selection-framework.el got fixed in the move. Added a default darkgoldenrod tint, a :filter-return advice on nerd-icons-icon-for-dir so dir icons pick up a color face, and a buffer-local face-remap in dired-mode-hook so plain files in dired render in shadow grey. 13 tests across 3 new files cover the per-call gate, the dir-color helper (idempotent under nerd-icons' memoized return strings), and the bulk-tint helper.
* refactor(system-utils): extract testable open-file helpersCraig Jennings2026-04-231-54/+57
| | | | | | | | | | | | | | | | | | | | Extracts two pure helpers from cj/open-file-with-command and cj/xdg-open so the file-resolution and launcher-detection logic becomes testable without mocking process launchers. New helpers: - cj/--file-from-context returns a file path from the current context, resolving in priority order (explicit arg, buffer-file-name, dired file at point). Returns nil when none apply. - cj/--open-with-is-launcher-p is a predicate for whether a command is a desktop launcher (xdg-open, open, start) that needs call-process detachment. Both commands now delegate. cj/open-file-with-command uses cj/--file-from-context with read-file-name as the final fallback, plus cj/--open-with-is-launcher-p for the launcher dispatch. cj/xdg-open uses cj/--file-from-context with user-error as the "no file" fallback. Behavior preserved. The existing system-utils test suites still pass, and the shape of each command's final effect is identical. New tests, 14 cases across two per-function files: - tests/test-system-utils--file-from-context.el covers: explicit wins over buffer-file, explicit wins over dired, buffer-file fallback, dired fallback, all-nil returns nil, explicit-nil uses chain, dired-mode-but-no-file-at-point. - tests/test-system-utils--open-with-is-launcher-p.el covers: each of the three launcher names returns t, non-launcher returns nil, empty string returns nil, case-sensitive check, nil input returns nil. Coverage: system-utils.el went from 10/52 (19.2%) to 15/52 (28.8%). The remaining uncovered lines are mostly in the process-launching paths of cj/open-file-with-command and cj/xdg-open. Those are testability-blocked. Mocking call-process, start-process-shell-command, and generate-new-buffer would give a lot of mock surface for low value. cj/server-shutdown is not meaningfully testable because it kills Emacs.
* feat(buffer): add open-with-default-app and open-with-program keybindingsCraig Jennings2026-02-251-1/+5
| | | | | | Wire cj/xdg-open (C-; b o) and cj/open-this-file-with (C-; b O) into the buffer keymap. Fix xdg-open fallback to try buffer-file-name before dired context. Remove old C-c x o binding from external-open.
* feat(dirvish): add project shortcuts and remove scratch font overrideCraig Jennings2026-01-091-2/+1
| | | | | Added dirvish quick-access shortcuts for homelab, kit, and nextjob projects. Removed 16pt font size override from scratch buffer startup hook.
* fix: add quick-sdcv quit binding and fix calendar-sync sentinelCraig Jennings2025-11-211-0/+2
| | | | | | | - Add 'q' keybinding in quick-sdcv-mode to quit-window for easier dictionary dismissal while reading epubs - Fix "Selecting deleted buffer" error in calendar-sync by checking buffer-live-p before accessing process buffer in sentinel
* fix(tests): Move cj/log-silently to system-lib.el, fix all test failuresCraig Jennings2025-11-151-12/+0
| | | | | | | | | | | | | | | | | | | | | | | | | Consolidated cj/log-silently function to system-lib.el as the canonical location for low-level utility functions. This fixes 4 failing tests in video-audio-recording that couldn't find the function. Changes: - Move cj/log-silently to system-lib.el (from system-utils.el) - Remove duplicate definition from org-agenda-config-debug.el - Remove duplicate definition from system-utils.el - Add (require 'system-lib) to all modules using cj/log-silently: - video-audio-recording.el - org-agenda-config-debug.el - media-utils.el (also removed declare-function) - elfeed-config.el (replaced system-utils with system-lib) - wrap-up.el Test Results: - Before: 112/113 passing (4 video-audio-recording tests failing) - After: 113/113 passing ✓ All tests now pass with zero failures. Fixes TODO #809-895 (move cj/log-silently to system-lib.el)
* feat(scratch): Set scratch buffer font to 16pt and fix missing variableCraig Jennings2025-11-151-7/+7
| | | | | | | - Add missing scratch-greet variable definition - Set scratch buffer font height to 16pt for better readability - Fix buffer targeting using with-current-buffer for reliability - Simplify scratch greeting message
* feat: Configure scratch buffer for org-mode with cursor at endCraig Jennings2025-11-051-2/+11
| | | | | | | | | | | - Set initial-major-mode to org-mode for *scratch* buffer - Add emacs-startup-hook to position cursor at end of buffer - Update greeting message comment syntax from ;; to # for org-mode - Re-enable debug flag reset on startup in early-init.el This makes the scratch buffer immediately ready for org-mode note-taking with cursor positioned for typing, eliminating manual mode switching and cursor movement.
* chore:system-utils: Fix indentation and update history persistenceCraig Jennings2025-11-011-4/+31
| | | | | | | Fix inconsistent indentation in dired-mode section to improve code readability. Enhance history persistence settings by configuring 'savehist' to include additional variables and set history length limits, ensuring better session management.
* feat:which-key: Add descriptive labels for custom keymapsCraig Jennings2025-10-271-0/+3
| | | | | | | | | | | | Enhance which-key integration by providing detailed descriptions for new key bindings across multiple modules. This improves the usability of custom keymaps by clarifying the purpose of each keybinding, making it easier for users to navigate and understand different menus and options available within the configuration. This update ensures that all custom keymaps now display a descriptive label in the which-key popup to explain their functionality, aiding users in identifying keymap purposes promptly.
* refactor: unify and simplify key binding setupsCraig Jennings2025-10-231-1/+1
| | | | | | | | Optimized key binding configurations across modules for consistency and reduced redundancy. Improved conditional requiring to handle errors gracefully in `music-config.el`, ensuring robustness across different machine environments. Eliminated comments clutter and adjusted function definitions to adhere to revised standards.
* refactor: system-utils: Improve function declarations and keybindingsCraig Jennings2025-10-201-23/+25
| | | | | | | - Replace `require` statements with `declare-function` for better performance, - Switch from `global-set-key` to `keymap-global-set` for setting keybindings - Remove unnecessary `defer` in `use-package` and simplify `savehist` configuration. - Adjust error messaging for clarity and refactor buffer evaluation logic to handle errors more gracefully.
* changing repositoriesCraig Jennings2025-10-121-0/+202