summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Elkins <me@sigpipe.org>2002-07-24 08:40:06 +0000
committerMichael Elkins <me@sigpipe.org>2002-07-24 08:40:06 +0000
commit2abf5d64b3440bb12698264c1a7ac1dfdb97706f (patch)
treea6b6e2b576b489cccba03d51332ccc5e94363bde
parentd2b73e6e95b761521e2942c30b5a43d1752f2838 (diff)
Fix $editor and $visual. Based on an earlier patch from Edmund
Grimley Evans.
-rw-r--r--attach.c3
-rw-r--r--compose.c7
-rw-r--r--doc/mutt.man4
-rw-r--r--editmsg.c3
-rw-r--r--init.c12
-rw-r--r--init.h4
6 files changed, 19 insertions, 14 deletions
diff --git a/attach.c b/attach.c
index 5921ddf2..da5a3cc6 100644
--- a/attach.c
+++ b/attach.c
@@ -264,8 +264,7 @@ int mutt_edit_attachment (BODY *a)
else if (a->type == TYPETEXT)
{
/* On text, default to editor */
- mutt_edit_file ((!Editor || mutt_strcmp ("builtin", Editor) == 0) ?
- NONULL(Visual) : NONULL(Editor), newfile);
+ mutt_edit_file (NONULL (Editor), newfile);
}
else
{
diff --git a/compose.c b/compose.c
index 96ee5dc1..3970981e 100644
--- a/compose.c
+++ b/compose.c
@@ -706,8 +706,8 @@ int mutt_compose_menu (HEADER *msg, /* structure for new message */
if (op == OP_COMPOSE_EDIT_HEADERS ||
(op == OP_COMPOSE_EDIT_MESSAGE && option (OPTEDITHDRS)))
{
- mutt_edit_headers ((!Editor || mutt_strcmp ("builtin", Editor) == 0) ? NONULL(Visual) : NONULL(Editor),
- msg->content->filename, msg, fcc, fcclen);
+ mutt_edit_headers (NONULL (Editor), msg->content->filename, msg,
+ fcc, fcclen);
}
else
{
@@ -1061,8 +1061,7 @@ int mutt_compose_menu (HEADER *msg, /* structure for new message */
case OP_COMPOSE_EDIT_FILE:
CHECK_COUNT;
- mutt_edit_file ((!Editor || mutt_strcmp ("builtin", Editor) == 0) ? NONULL(Visual) : NONULL(Editor),
- idx[menu->current]->content->filename);
+ mutt_edit_file (NONULL(Editor), idx[menu->current]->content->filename);
mutt_update_encoding (idx[menu->current]->content);
menu->redraw = REDRAW_CURRENT | REDRAW_STATUS;
break;
diff --git a/doc/mutt.man b/doc/mutt.man
index ef7fb038..4dc8b8bd 100644
--- a/doc/mutt.man
+++ b/doc/mutt.man
@@ -103,7 +103,7 @@ command which contains new mail.
.SH ENVIRONMENT
.PP
.IP "EDITOR"
-Editor to invoke when composing a message.
+Specifies the editor to use if VISUAL is unset.
.IP "EMAIL"
The user's e-mail address.
.IP "HOME"
@@ -126,7 +126,7 @@ Directory in which temporary files are created.
.IP "REPLYTO"
Default Reply-To address.
.IP "VISUAL"
-Editor to invoke when the ~v command is given in the builtin editor.
+Specifies the editor to use when composing messages.
.SH FILES
.PP
.IP "~/.muttrc or ~/.mutt/muttrc"
diff --git a/editmsg.c b/editmsg.c
index 5149bb45..bf9d17c4 100644
--- a/editmsg.c
+++ b/editmsg.c
@@ -88,8 +88,7 @@ static int edit_one_message (CONTEXT *ctx, HEADER *cur)
if (stat (tmp, &sb) == 0)
mtime = sb.st_mtime;
- mutt_edit_file ((!Editor || mutt_strcmp ("builtin", Editor) == 0) ?
- NONULL(Visual) : NONULL(Editor), tmp);
+ mutt_edit_file (NONULL(Editor), tmp);
if ((rc = stat (tmp, &sb)) == -1)
{
diff --git a/init.c b/init.c
index 6e8f1958..0490b0f5 100644
--- a/init.c
+++ b/init.c
@@ -1854,8 +1854,16 @@ void mutt_init (int skip_sys_rc, LIST *commands)
}
Tempdir = safe_strdup ((p = getenv ("TMPDIR")) ? p : "/tmp");
- Editor = safe_strdup ((p = getenv ("EDITOR")) ? p : "vi");
- Visual = safe_strdup ((p = getenv ("VISUAL")) ? p : Editor);
+
+ p = getenv ("VISUAL");
+ if (!p)
+ {
+ p = getenv ("EDITOR");
+ if (!p)
+ p = "vi";
+ }
+ Editor = safe_strdup (p);
+ Visual = safe_strdup (p);
if ((p = getenv ("REPLYTO")) != NULL)
{
diff --git a/init.h b/init.h
index f202d601..7aa0c053 100644
--- a/init.h
+++ b/init.h
@@ -463,8 +463,8 @@ struct option_t MuttVars[] = {
/*
** .pp
** This variable specifies which editor is used by mutt.
- ** It defaults to the value of the EDITOR or VISUAL environment
- ** variable, or to the string "vi".
+ ** It defaults to the value of the VISUAL, or EDITOR, environment
+ ** variable, or to the string "vi" if neither of those are set.
*/
{ "encode_from", DT_BOOL, R_NONE, OPTENCODEFROM, 0 },
/*