mirror of
https://github.com/vale981/apheleia
synced 2025-03-04 17:11:40 -05:00
Revert "Update tests to fix failures from formatter definition changes"
This reverts commit e2062d612d
.
This commit is contained in:
parent
e2062d612d
commit
a7800ac50b
9 changed files with 76 additions and 53 deletions
|
@ -226,12 +226,8 @@ environment variable, defaulting to all formatters."
|
|||
(let ((load-suffixes '(".el")))
|
||||
(locate-library "apheleia"))))))
|
||||
exec-path)))
|
||||
;; Some formatters use the current file-name or buffer-name to interpret the
|
||||
;; type of file that is being formatted. Some may not be able to determine
|
||||
;; this from the contents of the file so we set this to force it.
|
||||
(rename-buffer in-file)
|
||||
(setq stdout-buffer (get-buffer-create
|
||||
(format "*apheleia-ft-stdout-%S%s" formatter extension)))
|
||||
(format "*apheleia-ft-stdout-%S" formatter)))
|
||||
(with-current-buffer stdout-buffer
|
||||
(erase-buffer))
|
||||
(if (functionp command)
|
||||
|
@ -247,14 +243,41 @@ environment variable, defaulting to all formatters."
|
|||
(copy-to-buffer stdout-buffer (point-min) (point-max))))
|
||||
(progn
|
||||
|
||||
(let ((result (apheleia--format-command command nil nil)))
|
||||
(setq command (nthcdr 3 result)
|
||||
in-temp-real-file (nth 0 result)
|
||||
out-temp-file (nth 1 result)))
|
||||
|
||||
(with-current-buffer stdout-buffer
|
||||
(erase-buffer))
|
||||
|
||||
(mapc
|
||||
(lambda (arg)
|
||||
(when (memq arg '(file filepath input output inplace))
|
||||
(cl-pushnew arg syms)))
|
||||
command)
|
||||
(when (or (memq 'file syms) (memq 'filepath syms))
|
||||
(setq in-temp-real-file (apheleia-ft--write-temp-file
|
||||
in-text extension)))
|
||||
(when (or (memq 'input syms) (memq 'inplace syms))
|
||||
(setq in-temp-file (apheleia-ft--write-temp-file
|
||||
in-text extension))
|
||||
(when (memq 'inplace syms)
|
||||
(setq out-temp-file in-temp-file)))
|
||||
(when (memq 'output syms)
|
||||
(setq out-temp-file (apheleia-ft--write-temp-file
|
||||
"" extension)))
|
||||
(setq command (delq 'npx command))
|
||||
(setq command
|
||||
(mapcar
|
||||
(lambda (arg)
|
||||
(pcase arg
|
||||
((or `file `filepath)
|
||||
in-temp-real-file)
|
||||
((or `input `inplace)
|
||||
in-temp-file)
|
||||
(`output
|
||||
out-temp-file)
|
||||
((guard (stringp arg))
|
||||
arg)
|
||||
(_ (eval arg))))
|
||||
command))
|
||||
(setq stdout-buffer (get-buffer-create
|
||||
(format "*apheleia-ft-stdout-%S" formatter)))
|
||||
(setq exit-status
|
||||
(apply
|
||||
#'call-process
|
||||
|
|
Loading…
Add table
Reference in a new issue