diff options
author | Jason Cox <me@jasoncarloscox.com> | 2023-10-28 22:08:56 -0400 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2023-11-23 00:14:12 +0100 |
commit | cb48d5b547e53125857af154b3b0bb921030ba88 (patch) | |
tree | b53e352bc2db515bcfa0ea7bf6b9d2ad95092d38 /app/compose.go | |
parent | 0be34bbb0bdb3045c21ab3352b65c906913d05c8 (diff) | |
download | aerc-cb48d5b547e53125857af154b3b0bb921030ba88.tar.gz |
compose: define useful vars in the editor's env
Add AERC_ACCOUNT and AERC_ADDRESS_BOOK_CMD to the editor's environment
when composing a message. These variables allow for per-account
configuration of the editor and facilitate address completion when
edit-headers = true.
Changelog-added: `AERC_ACCOUNT` and `AERC_ADDRESS_BOOK_CMD` are now
defined in the editor's environment when composing a message.
Signed-off-by: Jason Cox <me@jasoncarloscox.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'app/compose.go')
-rw-r--r-- | app/compose.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/app/compose.go b/app/compose.go index bf1d32cb..75f90f12 100644 --- a/app/compose.go +++ b/app/compose.go @@ -1331,6 +1331,11 @@ func (c *Composer) showTerminal() error { c.acct.PushError(fmt.Errorf("could not start editor: %w", err)) } editor := exec.Command("/bin/sh", "-c", editorName+" "+c.email.Name()) + env := os.Environ() + env = append(env, fmt.Sprintf("AERC_ACCOUNT=%s", c.Account().Name())) + env = append(env, fmt.Sprintf("AERC_ADDRESS_BOOK_CMD=%s", c.Account().AccountConfig().AddressBookCmd)) + editor.Env = env + c.editor, err = NewTerminal(editor) if err != nil { return err |