purcell / emacs-reformatter

Define commands which run reformatters on the current Emacs buffer
265 stars 21 forks source link

Support formatters which don't accept input from stdin #18

Closed clemera closed 4 years ago

clemera commented 5 years ago

Some formatters like isort need a file as input and change the file in place . An additional argument like :file t could result in creating a temp file and pass that to :program and use the changed temp file as new buffer content.

chmouel commented 5 years ago

Same goes for python's black https://github.com/psf/black

purcell commented 5 years ago

Same goes for python's black https://github.com/psf/black

No, that can definitely work on stdin and stdout. Look at the existing blacken-mode code: https://github.com/pythonic-emacs/blacken/blob/5f30f17b048af1fe73ba710781650e3490a7be49/blacken.el#L82-L104

purcell commented 5 years ago

An additional argument like :file t could result in creating a temp file and pass that to :program and use the changed temp file as new buffer content.

That sounds quite nice. Will try to get get to something like that soon.

clemera commented 4 years ago

This looks great! Thank you!