mawww / kakoune

mawww's experiment for a better code editor
http://kakoune.org
The Unlicense
9.85k stars 711 forks source link

[REQUEST] Highlighting for signature block in email #4998

Closed ewtoombs closed 9 months ago

ewtoombs commented 10 months ago

Feature

In emails, highlight -- and all text below it differently, to make it clear it is a signature block.

Usecase

Plaintext email signature blocks are separated from the email with --.

It would be nice if https://github.com/mawww/kakoune/blob/master/rc/filetype/mail.kak automatically found this marker and highlighted the signature differently. This way, if there is a typo in the --, there will be a notable lack of separate highlighting, helping reveal the mistake.

This would also be nice for reading already-written plaintext .eml files in kakoune.

arachsys commented 9 months ago

Perhaps something like

diff --git a/rc/filetype/mail.kak b/rc/filetype/mail.kak
index 4cbae02a..8f99b2b9 100644
--- a/rc/filetype/mail.kak
+++ b/rc/filetype/mail.kak
@@ -24,5 +24,6 @@ add-highlighter shared/mail group
 add-highlighter shared/mail/ regex ^(From|To|Cc|Bcc|Subject|Reply-To|In-Reply-To|References|Date|Message-Id|User-Agent):([^\n]*(?:\n\h+[^\n]+)*)$ 1:keyword 2:attribute
 add-highlighter shared/mail/ regex <[^@>]+@.*?> 0:string
 add-highlighter shared/mail/ regex ^>.*?$ 0:comment
+add-highlighter shared/mail/ regex ^--\ \n.* 0:comment

 }

would be sufficient? I noticed this myself this afternoon while editing patch emails.