From 3843163e2e1202f12486edb22eb545170b806630 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Fri, 31 Dec 2021 09:26:49 +0100 Subject: [PATCH] rc mail: enable jumping from inline diff to source file This allows to jump from a mail buffer that contains an inline diff to the source files (most accurate when the patch has been applied locally). This makes the diff module a mandatory dependency; we could relax that. --- rc/filetype/mail.kak | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rc/filetype/mail.kak b/rc/filetype/mail.kak index c99bd68f..9fb2d14e 100644 --- a/rc/filetype/mail.kak +++ b/rc/filetype/mail.kak @@ -4,6 +4,10 @@ hook global BufCreate .+\.eml %{ hook global WinSetOption filetype=mail %{ require-module mail + map buffer normal %{: diff-jump} + hook -once -always window WinSetOption filetype=.* %{ + unmap buffer normal %{: diff-jump} + } } hook -group mail-highlight global WinSetOption filetype=mail %{ @@ -14,6 +18,8 @@ hook -group mail-highlight global WinSetOption filetype=mail %{ provide-module mail %{ +require-module diff + add-highlighter shared/mail group add-highlighter shared/mail/ regex ^(From|To|Cc|Bcc|Subject|Reply-To|In-Reply-To|References|Date):([^\n]*(?:\n\h+[^\n]+)*)$ 1:keyword 2:attribute add-highlighter shared/mail/ regex <[^@>]+@.*?> 0:string