aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohsin Kaleem <mohkale@kisara.moe>2023-04-22 10:36:38 +0100
committerGitHub <noreply@github.com>2023-04-22 10:36:38 +0100
commit0290ae18cce6a90d959a3fc228aa14973a26e7af (patch)
tree337545ff3805e85d509d4ebc21a3a4d713dc29ce
parentbc6b72c05da5fa30919645592baa47501200d587 (diff)
Add astyle formatter (#169)
-rw-r--r--CHANGELOG.md2
-rw-r--r--apheleia.el4
-rw-r--r--test/formatters/installers/astyle.bash1
l---------test/formatters/samplecode/astyle/in.c1
-rw-r--r--test/formatters/samplecode/astyle/out.c5
5 files changed, 12 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4e8d922..f979fcb 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -21,8 +21,10 @@ The format is based on [Keep a Changelog].
* [`gawk`](https://www.gnu.org/software/gawk/) for
[awk](https://en.wikipedia.org/wiki/AWK) ([#187]).
* [`asmfmt`](https://github.com/klauspost/asmfmt) for assembly ([#168]).
+* [`astyle`](https://github.com/steinwurf/astyle) for C ([#169]).
[#168]: https://github.com/radian-software/apheleia/pull/168
+[#169]: https://github.com/radian-software/apheleia/pull/169
[#174]: https://github.com/radian-software/apheleia/pull/174
[#182]: https://github.com/radian-software/apheleia/pull/182
[#187]: https://github.com/radian-software/apheleia/pull/187
diff --git a/apheleia.el b/apheleia.el
index 5684990..66a4025 100644
--- a/apheleia.el
+++ b/apheleia.el
@@ -32,7 +32,9 @@
:link '(emacs-commentary-link :tag "Commentary" "apheleia"))
(defcustom apheleia-formatters
- '((asmfmt . ("asmfmt"))
+ '((astyle . ("astyle" (apheleia-formatters-locate-file
+ "--options" ".astylerc")))
+ (asmfmt . ("asmfmt"))
(bean-format . ("bean-format"))
(black . ("black"
(when (apheleia-formatters-extension-p "pyi") "--pyi")
diff --git a/test/formatters/installers/astyle.bash b/test/formatters/installers/astyle.bash
new file mode 100644
index 0000000..2a9cde9
--- /dev/null
+++ b/test/formatters/installers/astyle.bash
@@ -0,0 +1 @@
+apt-get install -y astyle
diff --git a/test/formatters/samplecode/astyle/in.c b/test/formatters/samplecode/astyle/in.c
new file mode 120000
index 0000000..4e7891c
--- /dev/null
+++ b/test/formatters/samplecode/astyle/in.c
@@ -0,0 +1 @@
+../clang-format/in.c \ No newline at end of file
diff --git a/test/formatters/samplecode/astyle/out.c b/test/formatters/samplecode/astyle/out.c
new file mode 100644
index 0000000..bfc35f6
--- /dev/null
+++ b/test/formatters/samplecode/astyle/out.c
@@ -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*)&_);
+}