|
36 | 36 |
|
37 | 37 | (require 'cl-lib) |
38 | 38 |
|
39 | | -(defvar-local refmt-opam-bin-dir nil) |
40 | | - |
41 | | -(defcustom refmt-command "refmt" |
42 | | - "The 'refmt' command." |
43 | | - :type '(choice (file :tag "Filename (default binary is \"refmt\")") |
44 | | - (const :tag "Use current opam switch" opam) |
45 | | - (const :tag "Use current npm version (via npx)" npm) |
46 | | - (const :tag "Use current esy version (via esy exec-command)" esy)) |
47 | | - :group 're-fmt) |
| 39 | +(defvar refmt-command "refmt" |
| 40 | + "The 'refmt' command.") |
48 | 41 |
|
49 | 42 | (defcustom refmt-show-errors 'buffer |
50 | 43 | "Where to display refmt error output. |
@@ -203,31 +196,7 @@ function." |
203 | 196 | (erase-buffer)) |
204 | 197 | (if (zerop (let* ((files (list (list :file outputfile) errorfile)) |
205 | 198 | (args (append width-args (list "--parse" from "--print" to bufferfile)))) |
206 | | - (cond ((equal refmt-command 'opam) |
207 | | - ;; this was originally done via `opam exec' but that does not |
208 | | - ;; work for opam 1, and added a performance hit |
209 | | - (progn |
210 | | - (when (not refmt-opam-bin-dir) |
211 | | - (setq-local |
212 | | - refmt-opam-bin-dir |
213 | | - (with-temp-buffer |
214 | | - (when (eq (call-process-shell-command |
215 | | - "opam config var bin" nil (current-buffer) nil) 0) |
216 | | - (replace-regexp-in-string "\n$" "" (buffer-string)))))) |
217 | | - |
218 | | - (apply 'call-process (concat refmt-opam-bin-dir "/refmt") nil files nil args))) |
219 | | - |
220 | | - ((equal refmt-command 'npm) |
221 | | - (apply 'call-process |
222 | | - "npx" nil files nil (append '("refmt") args))) |
223 | | - |
224 | | - ((equal refmt-command 'esy) |
225 | | - (apply 'call-process |
226 | | - "esy" nil files nil (append '("exec-command" "refmt") args))) |
227 | | - |
228 | | - (t |
229 | | - (apply 'call-process |
230 | | - refmt-command nil files nil args))))) |
| 199 | + (apply 'call-process refmt-command nil files nil args))) |
231 | 200 | (progn |
232 | 201 | (call-process-region start end "diff" nil patchbuf nil "-n" "-" |
233 | 202 | outputfile) |
|
0 commit comments