alt-v: view source of email

This commit is contained in:
2026-03-11 23:16:19 +01:00
parent f703bc487a
commit 7653f052b7
3 changed files with 11 additions and 8 deletions

View File

@@ -16,11 +16,11 @@ BEGIN {
/^header{/ {
header = $0
}
/^part}/ {
/^(part|attachment)}/ {
level--
}
/^part{/ {
parts = sprintf("%s\n%"(2*level)"s%s", parts, "", substr($1, 7))
/^(part|attachment){/ {
parts = sprintf("%s\n%"(2*level)"s%s", parts, "", substr($1, index($1, "ID")))
level++
}
# /^part{ ID: [[:digit:]]+, Content-type: multipart\/alternative/ {

View File

@@ -3,11 +3,6 @@ BEGIN {
FS = "\n"
}
# message{ id:eb93d845-6fc7-4181-9848-7411ed999b3c@indyfac.ch depth:0 match:1 excluded:0 filename:/home/amin/.email/indyfac/INBOX/cur/1773225033.821818_4.fredkin,U=4172:2,S
# header{
# lobo loco <loboloco@indyfac.ch> (Today 10:12) (inbox)
/^message{/ {
id = ""
depth = -1

View File

@@ -58,6 +58,13 @@ if [ "${1:-}" = "--preview-message" ]; then
exit
fi
if [ "${1:-}" = "--view-source" ]; then
shift
messageid="$1"
less $($NOTMUCH search --output=files id:$messageid)
exit
fi
# FZF default configs
FZF_DEFAULT_PREVIEW_WINDOW="right,80,border-line,wrap-word"
FZF_ALTERNATE_PREVIEW_WINDOW="bottom,80%,border-line,wrap-word"
@@ -81,6 +88,7 @@ if [ "${1:-}" = "--show-thread" ]; then
--bind="enter:" \
--bind="ctrl-h,backward-eof:abort" \
--bind="alt-/:change-preview-window($FZF_ALTERNATE_PREVIEW_WINDOW|$FZF_DEFAULT_PREVIEW_WINDOW)" \
--bind="alt-v:execute:$0 --view-source {5}" \
--preview="$0 --preview-message {5}" \
--preview-window="$FZF_DEFAULT_PREVIEW_WINDOW" || true)
exit