summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2022-01-19 21:28:06 +0100
committerRobin Jarry <robin@jarry.cc>2022-01-19 21:42:41 +0100
commit877a94f5d9a7852af5fbcfd1196a4b1f4c676564 (patch)
tree798e640ec50520cdd040570ecf1f16fb911a1e2f
parent92bf89c3389b8e08cf99d30cf20a818529680f51 (diff)
downloadaerc-877a94f5d9a7852af5fbcfd1196a4b1f4c676564.zip
compose: add default template for new messages
Allow defining a default template to use when composing new messages. Add an example to be used for new users. Signed-off-by: Robin Jarry <robin@jarry.cc>
-rw-r--r--Makefile1
-rw-r--r--commands/account/compose.go3
-rw-r--r--config/aerc.conf.in5
-rw-r--r--config/config.go2
-rw-r--r--doc/aerc-config.5.scd5
-rw-r--r--templates/new_message1
6 files changed, 17 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index a2492e6..d37f2c7 100644
--- a/Makefile
+++ b/Makefile
@@ -99,6 +99,7 @@ install: all
install -m755 filters/hldiff $(DESTDIR)$(SHAREDIR)/filters/hldiff
install -m755 filters/html $(DESTDIR)$(SHAREDIR)/filters/html
install -m755 filters/plaintext $(DESTDIR)$(SHAREDIR)/filters/plaintext
+ install -m644 templates/new_message $(DESTDIR)$(SHAREDIR)/templates/new_message
install -m644 templates/quoted_reply $(DESTDIR)$(SHAREDIR)/templates/quoted_reply
install -m644 templates/forward_as_body $(DESTDIR)$(SHAREDIR)/templates/forward_as_body
install -m644 config/default_styleset $(DESTDIR)$(SHAREDIR)/stylesets/default
diff --git a/commands/account/compose.go b/commands/account/compose.go
index 62bf11d..d4128db 100644
--- a/commands/account/compose.go
+++ b/commands/account/compose.go
@@ -30,6 +30,9 @@ func (Compose) Execute(aerc *widgets.Aerc, args []string) error {
return err
}
acct := aerc.SelectedAccount()
+ if template == "" {
+ template = aerc.Config().Templates.NewMessage
+ }
composer, err := widgets.NewComposer(aerc, acct,
aerc.Config(), acct.AccountConfig(), acct.Worker(),
diff --git a/config/aerc.conf.in b/config/aerc.conf.in
index 4decaef..3919b39 100644
--- a/config/aerc.conf.in
+++ b/config/aerc.conf.in
@@ -224,6 +224,11 @@ new-email=
# default: @SHAREDIR@/templates/
template-dirs=@SHAREDIR@/templates/
+# The default template to be used for new messages.
+#
+# default: new_message
+new-message=new_message
+
# The default template to be used for quoted replies.
#
# default: quoted_reply
diff --git a/config/config.go b/config/config.go
index 0472daf..2e1d589 100644
--- a/config/config.go
+++ b/config/config.go
@@ -146,6 +146,7 @@ type TriggersConfig struct {
type TemplateConfig struct {
TemplateDirs []string `ini:"template-dirs", delim:":"`
+ NewMessage string `ini:"new-message"`
QuotedReply string `ini:"quoted-reply"`
Forwards string `ini:"forwards"`
}
@@ -595,6 +596,7 @@ func LoadConfigFromFile(root *string, sharedir string) (*AercConfig, error) {
Templates: TemplateConfig{
TemplateDirs: []string{path.Join(sharedir, "templates")},
+ NewMessage: "new_message",
QuotedReply: "quoted_reply",
Forwards: "forward_as_body",
},
diff --git a/doc/aerc-config.5.scd b/doc/aerc-config.5.scd
index 067ad91..cbd64fa 100644
--- a/doc/aerc-config.5.scd
+++ b/doc/aerc-config.5.scd
@@ -382,6 +382,11 @@ These options are configured in the *[templates]* section of aerc.conf.
Default: "/usr/share/aerc/templates"
+*new-message*
+ The default template to be used for new messages.
+
+ Default: "new_message"
+
*quoted-reply*
The default template to be used for quoted replies.
diff --git a/templates/new_message b/templates/new_message
new file mode 100644
index 0000000..f6b3d02
--- /dev/null
+++ b/templates/new_message
@@ -0,0 +1 @@
+X-Mailer: aerc {{version}}