Description
I'm having this weird problem where elixir-format
doesn't respect the .formatter.exs
file in my project's root directory when I follow the settings here.
How to reproduce:
mix new
a project and change the generated.formatter.exs
to be
# Used by "mix format"
[
inputs: []
]
which should not format anything. Assume the project is located at ~/Projects/test
.
-
Mess with the format of
mix.exs
in some way, and runmix format
from the project root directory manually to confirm thatmix.exs
doesn't get formatted. -
Now open
mix.exs
with Emacs, enableprojectile-mode
, and runelixir-format
. This timemix.exs
does get formatted, although the value ofelixir-format-arguments
is shown to be("--dot-formatter" "~/Projects/test/.formatter.exs")
.
My elixir-mode
settings:
(use-package elixir-mode
:ensure t
:config
(add-hook 'elixir-format-hook
(lambda () (if (projectile-project-p)
(setq elixir-format-arguments
(list "--dot-formatter"
(concat (locate-dominating-file
buffer-file-name
".formatter.exs")
".formatter.exs")))
(setq elixir-format-arguments nil)))))
No matter what I do, the file always gets formatted when I run elixir-format
. I'm not sure whether I'm configuring things incorrectly or hitting a bug.