From bdf35b89fe8d653847ab077d4183b71feebd48d2 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Sat, 8 Mar 2025 22:03:48 +0300 Subject: added "email" lexer for writing mails * Highlights both 1st level and 2nd level quotes and signatures. * This also sets the edge to 78 columns, as is recommended for email and enables word wrapping. The edge mode is not set, since it kind of looks ugly in Scinterm. * Helps when using SciTECO as the email editor for instance in the Aerc mail client. * Unfortunately, we cannot set up Scintilla to automatically break words after 78 columns (or perhaps that's a good thing). You can use the M#rf reformat-paragraph macro to reflow paragraphs before sending the mail. This will take the edge column into account even if no edge mode is set. --- lib/Makefile.am | 3 ++- lib/lexers/email.tes | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 lib/lexers/email.tes (limited to 'lib') diff --git a/lib/Makefile.am b/lib/Makefile.am index 70f39b7..3ee3ab3 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -102,6 +102,7 @@ dist_lexer_DATA += lexers/verilog.tes \ lexers/asciidoc.tes \ lexers/troff.tes \ lexers/git.tes \ - lexers/sciteco.tes + lexers/sciteco.tes \ + lexers/email.tes endif diff --git a/lib/lexers/email.tes b/lib/lexers/email.tes new file mode 100644 index 0000000..895aeea --- /dev/null +++ b/lib/lexers/email.tes @@ -0,0 +1,34 @@ +!* + * E-Mail messages with signatures and quotes. + * + * NOTE: This is not a real lexer. + * It only styles the document once. + *! + +@[lexer.test.email]{ + :EN*.emlQ* +} + +@[lexer.set.email]{[: + 78ESSETEDGECOLUMN 1ESSETWRAPMODE + !!1ESSETEDGEMODE + + :M[color.comment],1M[color.set] + :M[color.preproc],2M[color.set] + :M[color.preproc2],3M[color.set] + + ZU.z + ZJ [_-:S^J-- ^J]_"S !* signatures *! + 4R .U.z + ESSTARTSTYLING 1,(:-)ESSETSTYLING + ' + + J< .-Q.z"= 1; ' + 0A->"= !* quotes *! + U.s + <:C; 0A- "N 1; '> .-Q.z"= 1; ' + Q.sESSTARTSTYLING + (0A->"=3|2'),(Q.lESLINELENGTH)ESSETSTYLING + ' + :L; %.l> +]:} -- cgit v1.2.3