From bbdf9df75e8597e38cf1d90145f22aab9bd95178 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Sun, 31 Mar 2019 14:24:53 -0400 Subject: Add basic filter implementation --- config/aerc.conf | 45 ++++++++++++++++++++------------------------- 1 file changed, 20 insertions(+), 25 deletions(-) (limited to 'config/aerc.conf') diff --git a/config/aerc.conf b/config/aerc.conf index 5a4317f..3a89151 100644 --- a/config/aerc.conf +++ b/config/aerc.conf @@ -54,32 +54,12 @@ empty-message=(no messages) [viewer] # -# We can use different programs to display various kinds of email attachments. -# These programs will have the mail piped into them and are expected to output -# it ready to display on a terminal (you can include terminal control -# characters if you like, for colors and such). Emails will be stripped of -# non-printable characters before being piped into these commands, and will be -# encoded with UTF-8. These commands are invoked with sh and run -# non-interactively, and their output is piped into your pager command -# (interactively). The following environment variables will be set: +# Specifies the pager to use when displaying emails. Note that some filters +# may add ANSI codes to add color to rendered emails, so you may want to use a +# pager which supports ANSI codes. # -# $WIDTH: the width of the terminal window -# $HEIGHT: the height of the terminal window -# $MIMETYPE: the email's mimetype -# -# You can use * as a wildcard for any subtype of a given mimetype. When -# displaying a text/* message and no command matches, the message will just be -# piped directly into your pager (after being stripped of non-printable -# characters). - -# Examples: -# -#text/html=w3m -T text/html -cols $WIDTH -dump -o display_image=false -o display_link_number=true -text/*=fold -sw $WIDTH - -# -# Default: less -r -pager=less -r +# Default: less -R +pager=less -R # # If an email offers several versions (multipart), you can configure which @@ -89,6 +69,21 @@ pager=less -r # Default: text/plain,text/html alternatives=text/plain,text/html +[filters] +# +# Filters allow you to pipe an email body through a shell command to render +# certain emails differently, e.g. highlighting them with ANSI escape codes. +# +# The first filter which matches the email's mimetype will be used, so order +# them from most to least specific. +# +# You can also match on non-mimetypes, by prefixing with the header to match +# against (non-case-sensitive) and a colon, e.g. subject:text will match a +# subject which contains "text". Use header~:regex to match against a regex. +subject~:PATCH=contrib/hldiff.py +text/html=w3m -T text/html -cols $(tput cols) -dump -o display_image=false -o display_link_number=true +text/*=contrib/plaintext.py + [lbinds] # # Binds are of the form = -- cgit v1.2.3