mirror of
https://github.com/vale981/apheleia
synced 2025-03-04 17:11:40 -05:00
Assume filename correctly (#128)
Fixes #108 Co-authored-by: Radon Rosborough <radon@intuitiveexplanations.com>
This commit is contained in:
parent
e01ced3ac9
commit
9101a3380c
3 changed files with 16 additions and 2 deletions
|
@ -29,6 +29,9 @@ The format is based on [Keep a Changelog].
|
|||
correctly; it throws an error. It doesn't make sense to attempt to
|
||||
format if we can't find the correct formatter, so instead formatting
|
||||
is only attempted when the formatter is found. [#126]
|
||||
* clang-format doesn't handle filenames correctly by default. Support
|
||||
for guessing the flags from first the file name then the major mode
|
||||
in the case of a temporary buffer was added in [#128]
|
||||
|
||||
### Formatters
|
||||
* [elm-format](https://github.com/avh4/elm-format) for Elm ([#100]).
|
||||
|
@ -56,6 +59,7 @@ The format is based on [Keep a Changelog].
|
|||
[#123]: https://github.com/radian-software/apheleia/issues/123
|
||||
[#124]: https://github.com/radian-software/apheleia/issues/124
|
||||
[#125]: https://github.com/radian-software/apheleia/pull/125
|
||||
[#126]: https://github.com/radian-software/apheleia/pull/126
|
||||
[#127]: https://github.com/radian-software/apheleia/pull/127
|
||||
[#128]: https://github.com/radian-software/apheleia/pull/128
|
||||
|
||||
|
|
10
apheleia.el
10
apheleia.el
|
@ -925,7 +925,15 @@ being run, for diagnostic purposes."
|
|||
'((bean-format . ("bean-format"))
|
||||
(black . ("black" "-"))
|
||||
(brittany . ("brittany"))
|
||||
(clang-format . ("clang-format"))
|
||||
(clang-format . ("clang-format"
|
||||
"-assume-filename"
|
||||
(or (buffer-file-name)
|
||||
(cdr (assoc major-mode
|
||||
'((c-mode . ".c")
|
||||
(c++-mode . ".cpp")
|
||||
(cuda-mode . ".cu")
|
||||
(protobuf-mode . ".proto"))))
|
||||
".c")))
|
||||
(dart-format . ("dart" "format"))
|
||||
(elm-format . ("elm-format" "--yes" "--stdin"))
|
||||
(fish-indent . ("fish_indent"))
|
||||
|
|
|
@ -271,7 +271,9 @@ environment variable, defaulting to all formatters."
|
|||
in-temp-file)
|
||||
(`output
|
||||
out-temp-file)
|
||||
(_ arg)))
|
||||
((guard (stringp arg))
|
||||
arg)
|
||||
(_ (eval arg))))
|
||||
command))
|
||||
(setq command (delq 'npx command))
|
||||
(setq stdout-buffer (get-buffer-create
|
||||
|
|
Loading…
Add table
Reference in a new issue