Closed kenranunderscore closed 2 years ago
Really the preferred method here would be to not even support stylish
in haskell-mode
: there are numerous separate packages which can trivially provide support for formatters, and be installed according to users' needs. My own reformatter
package makes it easy to construct such things. I imagine that the existing ormolu
emacs package can trivially be made to run fourmolu
instead.
I'm using a patched version of fourmolu
for now (for months, actually; just forgot to answer here).
I've installed reformatter
(but haven't configured it yet) since what you're saying really makes sense and this will surely make my life easier with other languages in Emacs in the long run, thanks!
fourmolu is a formatter forked from ormolu, but with the option to load its configuration from a file. If one chooses to do so (by adding a
fourmolu.yaml
to the project root), it outputs a message likeLoaded config from fourmolu.yaml
tostderr
.Now
haskell-buffer-apply-command
- which is called byhaskell-mode-stylish-buffer
- never checks the error code (which is0
here in my case, as the buffer can successfully be formatted), but only the contents of the error file, containing the above message.I've created an issue with fourmolu (https://github.com/fourmolu/fourmolu/issues/110) to maybe suppress this message altogether, but I feel like disregarding the error code is not the optimal choice in this case.
I'd have created some PR for this, but I'm actually not really sure how to best handle the branches. Replacing the first check for
err-file-empty-p
with(= errcode 0)
worked for me, but it leaves the case unhandled where:0