From cb48d5b547e53125857af154b3b0bb921030ba88 Mon Sep 17 00:00:00 2001 From: Jason Cox Date: Sat, 28 Oct 2023 22:08:56 -0400 Subject: 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 Acked-by: Robin Jarry --- app/compose.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'app/compose.go') 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 -- cgit