diff options
authorSergey Poznyakoff <>2021-07-19 11:27:40 +0300
committerSergey Poznyakoff <>2021-07-19 11:27:40 +0300
commit4befcfd015256c568121653038accbd84820198f (patch)
parent38120666ac530343aec094c60ca3643910102d18 (diff)
mail: disable compose escapes in non-interctive mode.
* NEWS: Document changes. * doc/texinfo/programs/mail.texi: Document changes. * mail/send.c (mail_compose_send): Recognize escapes only in interactive mode.
3 files changed, 18 insertions, 9 deletions
diff --git a/NEWS b/NEWS
index 480740b0b..0bded9304 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,4 @@
-GNU mailutils NEWS -- history of user-visible changes. 2021-06-10
+GNU mailutils NEWS -- history of user-visible changes. 2021-07-19
See the end of file for copying conditions.
Please send mailutils bug reports to <>.
@@ -31,13 +31,19 @@ issued along with a suggestion on what statement to use instead:
The 'retry-timeout' statement is a misnomer and is therefore
deprecated. Use 'retry-sleep' instead.
-* mail: fix semantics of mail sending and saving commands
+* mail utility
-* mail: fix the -F option
+** Fix semantics of mail sending and saving commands
-* mail: improve POSIX mailx compatible mode
+** Fix the -F option
-* New mail variables
+** Improve POSIX mailx compatible mode
+** Compose escapes are recognized only in interactive mode
+This fixes
+** New mail variables
- fullnames
Controls whether personal parts of emails are preserved in
diff --git a/doc/texinfo/programs/mail.texi b/doc/texinfo/programs/mail.texi
index 569d78034..d392ca452 100644
--- a/doc/texinfo/programs/mail.texi
+++ b/doc/texinfo/programs/mail.texi
@@ -1262,8 +1262,10 @@ capabilities through @dfn{compose escapes}. The @dfn{compose escapes}
are single-character commands, preceded by special @dfn{escape character},
which defaults to @samp{~}. The combination @code{escape character + command}
is recognized as a compose escape only if it occurs at the beginning of
-a line. If the escape character must appear at the beginning of a
-line, enter it twice.
+a line and the standard input is connected to a terminal. If the
+escape character must appear at the beginning of a line, enter it
The actual escape character may be changed by setting the value of
@code{escape} mail variable (@pxref{Mail Variables}).
diff --git a/mail/send.c b/mail/send.c
index 1bdfe1134..098374dab 100644
--- a/mail/send.c
+++ b/mail/send.c
@@ -1324,8 +1324,9 @@ mail_compose_send (compose_env_t *env, int save_to)
if (strcmp (buf, ".") == 0 && mailvar_is_true (mailvar_name_dot))
done = 1;
- else if (mailvar_get (&escape, mailvar_name_escape,
- mailvar_type_string, 0) == 0
+ else if (interactive
+ && mailvar_get (&escape, mailvar_name_escape,
+ mailvar_type_string, 0) == 0
&& buf[0] == escape[0])
if (buf[1] == buf[0])

Return to:

Send suggestions and report system problems to the System administrator.