Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add astyle formatter #169

Merged
merged 12 commits into from
Apr 22, 2023
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@ The format is based on [Keep a Changelog].
by suppressing all logs from `ktlint`.

### Formatters

* [purs-tidy](https://github.com/natefaubion/purescript-tidy) for PureScript ([#182]).
mohkale marked this conversation as resolved.
Show resolved Hide resolved
* [`astyle`](https://github.com/steinwurf/astyle) for C ([#169]).

[#169]: https://github.com/radian-software/apheleia/issues/169
[#182]: https://github.com/radian-software/apheleia/pull/182

## 3.2 (released 2023-02-25)
Expand Down
4 changes: 3 additions & 1 deletion apheleia.el
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@
:link '(emacs-commentary-link :tag "Commentary" "apheleia"))

(defcustom apheleia-formatters
'((bean-format . ("bean-format"))
'((astyle . ("astyle" (apheleia-formatters-locate-file
"--options" ".astylerc")))
(bean-format . ("bean-format"))
(black . ("black"
(when (apheleia-formatters-extension-p "pyi") "--pyi")
(apheleia-formatters-fill-column "--line-length")
Expand Down
1 change: 1 addition & 0 deletions test/formatters/installers/astyle.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
apt-get install -y astyle
1 change: 1 addition & 0 deletions test/formatters/samplecode/astyle/in.c
5 changes: 5 additions & 0 deletions test/formatters/samplecode/astyle/out.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// https://www.ioccc.org/2020/burton/prog.c
int main(int b,char**i) {
long long n=B,a=I^n,r=(a/b&a)>>4,y=atoi(*++i),_=(((a^n/b)*(y>>T)|y>>S)&r)|(a^r);
printf("%.8s\n",(char*)&_);
}