From dc6fd7c15e15fd1ec6a3b48a1367432a63bf4aaf Mon Sep 17 00:00:00 2001 From: Robin Jarry Date: Thu, 3 Feb 2022 09:54:23 +0100 Subject: [PATCH] compose: allow setting all headers in templates Allow setting To, Cc, Subject, Bcc in template headers. Fixes: https://todo.sr.ht/~rjarry/aerc/19 Signed-off-by: Robin Jarry --- doc/aerc-templates.7.scd | 4 ++++ widgets/compose.go | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/doc/aerc-templates.7.scd b/doc/aerc-templates.7.scd index 9b17e28..0180a2d 100644 --- a/doc/aerc-templates.7.scd +++ b/doc/aerc-templates.7.scd @@ -26,6 +26,10 @@ Chuck If you have a template that doesn't add any header, it *must* be preceded by a newline, to avoid parsing parts of the body as header text. +All headers defined in the template will have precedence over any headers that +are initialized by aerc (e.g. Subject, To, From, Cc) when composing a new +message, forwarding or replying. + # MESSAGE DATA The following data can be used in templates. Though they are not all diff --git a/widgets/compose.go b/widgets/compose.go index 1693314..7229ec8 100644 --- a/widgets/compose.go +++ b/widgets/compose.go @@ -109,11 +109,11 @@ func NewComposer(aerc *Aerc, acct *AccountView, conf *config.AercConfig, focused: 1, completer: cmpl, } - c.buildComposeHeader(aerc, cmpl) - if err := c.AddTemplate(template, templateData); err != nil { return nil, err } + c.buildComposeHeader(aerc, cmpl) + c.AddSignature() c.updateGrid()