aboutsummaryrefslogtreecommitdiffstats
path: root/filters/vectors/colorize-patch.in
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2023-01-15 23:27:29 +0100
committerRobin Jarry <robin@jarry.cc>2023-01-26 00:20:48 +0100
commit98e32d2ff22cba1e60caf6a252eee0d38f26f736 (patch)
tree249564b1942d0a42225243a8a598ec48bc896c6b /filters/vectors/colorize-patch.in
parent3191ee171c435a43912264b131340af66fea8112 (diff)
downloadaerc-98e32d2ff22cba1e60caf6a252eee0d38f26f736.tar.gz
filters: rewrite colorize in c
Since its introduction, we had multiple issues with the colorize awk script with regard to non-GNU awk compatibility. Also, this script is standalone and the color theme must be hard coded into it. Reading from an external configuration file (aerc's styleset) from a non-GNU awk is close to impossible (and even far from trivial with GNU awk). Rewrite the builtin colorize filter in C to allow getting the color theme from aerc's active styleset. The theme is configured using the existing styleset syntax and attributes under a separate [viewer] section (see examples and man page). Export the active styleset file path to AERC_STYLESET env var when invoking the filter command so that colorize can access it and use it. I have tested compilation (with clang-analyzer and gcc -fanalyzer) and basic operation on FreeBSD, Fedora (glibc) and Alpine (muslibc). More tests would probably be required on MacOSX and older Linux distros. I also added test vectors to give some confidence that this works as expected. The execution with these vectors passed valgrind --leak-check=full without errors. NB: the default theme has changed to be more minimal. Sample stylesets have more colorful examples. The awk -v theme=xxx option is no longer supported. usage: colorize [-h] [-s FILE] [-f FILE] options: -h show this help message -s FILE use styleset file (default $AERC_STYLESET) -f FILE read from filename (default stdin) Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
Diffstat (limited to 'filters/vectors/colorize-patch.in')
-rw-r--r--filters/vectors/colorize-patch.in49
1 files changed, 49 insertions, 0 deletions
diff --git a/filters/vectors/colorize-patch.in b/filters/vectors/colorize-patch.in
new file mode 100644
index 00000000..48e12d8e
--- /dev/null
+++ b/filters/vectors/colorize-patch.in
@@ -0,0 +1,49 @@
+From: Robin Jarry <robin@jarry.cc>
+Date: Mon, 26 Dec 2022 17:02:14 +0100
+Subject: [PATCH aerc] doc: fix numbered lists
+
+According to scdoc(5), numbered lists start with a period.
+
+Fixes: af63bd0188d1 ("doc: homogenize scdoc markup")
+Signed-off-by: Robin Jarry <robin@jarry.cc>
+---
+ doc/aerc-stylesets.7.scd | 18 +++++++++---------
+ 1 file changed, 9 insertions(+), 9 deletions(-)
+
+diff --git a/doc/aerc-stylesets.7.scd b/doc/aerc-stylesets.7.scd
+index d82ba7cf8163..34bbf4af0fc5 100644
+--- a/doc/aerc-stylesets.7.scd
++++ b/doc/aerc-stylesets.7.scd
+@@ -180,20 +180,20 @@ that style applies, unless overridden by a higher layer.
+
+ The order that *msglist_\** styles are applied in is, from first to last:
+
+-1. *msglist_default*
+-2. *msglist_unread*
+-3. *msglist_read*
+-4. *msglist_flagged*
+-5. *msglist_deleted*
+-6. *msglist_marked*
++. *msglist_default*
++. *msglist_unread*
++. *msglist_read*
++. *msglist_flagged*
++. *msglist_deleted*
++. *msglist_marked*
+
+ So, the marked style will override all other msglist styles.
+
+ The order for *dirlist_\** styles is:
+
+-1. *dirlist_default*
+-2. *dirlist_unread*
+-3. *dirlist_recent*
++. *dirlist_default*
++. *dirlist_unread*
++. *dirlist_recent*
+
+ ## COLORS
+
+--
+2.39.0
+