diff options
| author | Craig Jennings <c@cjennings.net> | 2026-05-25 18:05:55 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-05-25 18:05:55 -0500 |
| commit | 406d2abb8d2e8f71f690a35fd271d59d88454d64 (patch) | |
| tree | d02a5431fd1c6d7ca5eedd37a1584a62d0d9741e /tests/test-org-export-config-task-default.el | |
| parent | ba7774b79d6e10be2e1d06e329593f64e86ee0f2 (diff) | |
| download | dotemacs-406d2abb8d2e8f71f690a35fd271d59d88454d64.tar.gz dotemacs-406d2abb8d2e8f71f690a35fd271d59d88454d64.zip | |
refactor(prog): run JSON/YAML/webdev formatters via argv, not a shell
cj/json-format-buffer, cj/yaml-format-buffer, and cj/webdev-format-buffer ran their formatters through shell-command-on-region, which goes via a shell. I moved each to call-process-region with an explicit program and argv list, so a filename or buffer content can't be word-split or read as shell syntax. The webdev path dropped its shell-quote-argument dance once the filename became a plain argv element.
Point preservation is unchanged. One deliberate improvement, and it's tested: shell-command-on-region with replace replaced the buffer with the formatter's error text on a non-zero exit. The new per-formatter helper captures output to a temp buffer, checks the exit code, replaces only on success, and otherwise raises a user-error carrying stderr — so a failed format leaves the buffer alone.
I kept a small format-region helper in each of the three modules rather than one shared helper. They have no common module to live in short of system-lib, and coupling three unrelated domain modules through it wasn't worth saving sixteen lines.
Diffstat (limited to 'tests/test-org-export-config-task-default.el')
0 files changed, 0 insertions, 0 deletions
