X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=lib-lua%2Fmadmutt.c;h=3bd3428b629329660ab56406a2440381c6b28492;hp=4bb0095d8780ca7b8f75a37426675c4eef2d3c7d;hb=488a60c8ef78872f38bbb3439a75cb2cda985a12;hpb=6f1bd3d49f9bb02c57e2c7a1ba8e5507edb28ad5 diff --git a/lib-lua/madmutt.c b/lib-lua/madmutt.c index 4bb0095..3bd3428 100644 --- a/lib-lua/madmutt.c +++ b/lib-lua/madmutt.c @@ -75,7 +75,11 @@ static int madmutt_assign(lua_State *L) case LTK_SENDMAIL: case LTK_SHELL: _mutt_expand_path(buf, sizeof(buf), val, 0); - mlua_regsets(tk, buf); + val = buf; + /* FALLTHROUGH */ + + case LTK_EDITOR: + mlua_regsets(tk, val); return 0; } } @@ -196,6 +200,12 @@ static const struct { /* {{{ madmutt magic properties */ +static void madmutt_init_editor(char *buf, ssize_t len) +{ + m_strcpy(buf, len, getenv("VISUAL") ?: getenv("EDITOR") ?: "vi"); + fprintf("%s\n", buf); +} + static void madmutt_init_shell(char *buf, ssize_t len) { struct passwd *pw = getpwuid(getuid()); @@ -219,6 +229,13 @@ static const struct { ** Contains the path of the \fTmadmutt_dotlock(1)\fP binary to be used by ** Madmutt. */ + {"editor", madmutt_init_editor, NULL }, + /* + ** .pp + ** This variable specifies which editor is used by Madmutt. + ** It defaults to the value of the \fT$$$VISUAL\fP, or \fT$$$EDITOR\fP, environment + ** variable, or to the string "\fTvi\fP" if neither of those are set. + */ { "sendmail", NULL, SENDMAIL " -oem -oi" }, /* ** .pp