aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTyler Langlois <tylerjl@users.noreply.github.com>2025-02-07 15:27:35 -0700
committerGitHub <noreply@github.com>2025-02-07 14:27:35 -0800
commitba333e7ddce49fcbb34b7ad6e37ed880a90e4f4d (patch)
tree649a9526bebafe8150f048eabca63de0cd282478
parent814bb47486ac4fc0707f94882d212c599a1ac7ad (diff)
Resolve formatter executable commands prior to calling them (#341)
Hi! Thanks for your work on apheleia, it's great. An issue I've run into recently is that sometimes my remote executables aren't immediately in-`$PATH`: I need to resolve them via `executable-find` - which does find them - before invoking the process. This should be safe, given that the step is performed at a prior step. I'm overwriting the `command` variable since I infer that the executable _name_ is being reused later when you're matching a callback, I think? I mentioned that `executable-find` happens earlier in the call chain so I could maybe improve this by removing that and only resolving the executable once, but I wanted to check in with you to determine whether the overall problem and solution even make sense to somebody else. --------- Co-authored-by: Radon Rosborough <radon@intuitiveexplanations.com>
-rw-r--r--CHANGELOG.md4
-rw-r--r--apheleia-formatters.el3
2 files changed, 7 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 561e30f..561c0cf 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog].
## Unreleased
+### Bugs fixed
+* `$PATH` was not correctly respected for some remote executables ([#341]).
+
### Formatters
* [cljstyle](https://github.com/greglook/cljstyle)
for clojure, clojurescript, edn files.
@@ -22,6 +25,7 @@ The format is based on [Keep a Changelog].
[#183]: https://github.com/radian-software/apheleia/pull/183
[#339]: https://github.com/radian-software/apheleia/pull/339
+[#341]: https://github.com/radian-software/apheleia/pull/341
[#342]: https://github.com/radian-software/apheleia/pull/342
[#343]: https://github.com/radian-software/apheleia/pull/343
diff --git a/apheleia-formatters.el b/apheleia-formatters.el
index ac05fe7..c12c970 100644
--- a/apheleia-formatters.el
+++ b/apheleia-formatters.el
@@ -565,6 +565,9 @@ NO-QUERY, and CONNECTION-TYPE."
(ignore name noquery connection-type)
(let* ((run-on-remote (and (eq apheleia-remote-algorithm 'remote)
remote))
+ ;; Resolve the formatter executable's path to ensure it's
+ ;; found
+ (command (cons (executable-find (car command) run-on-remote) (cdr command)))
(stderr-file (apheleia--make-temp-file run-on-remote "apheleia"))
(args
(append