Re: list-new
On Sun, Nov 16 2003 at 06:03:31PM BRST, Rodrigo Bernardo Pimentel
<rbp@xxxxxxxxxxxx> wrote:
> On Sat, Nov 15 2003 at 01:57:01AM BRST, John Iverson <johni@xxxxxxxxx> wrote:
> > > Is there a "list-new" command? Similar to "list-reply"... only
> > > instead of replying to a message, it uh, well, prepares a _new_
> > > message to the specified list?
> So I've just put together a patch (attached) that creates a new
> function, "list-mail". It's (supposed to be) a merger of "mail" and
> "list-reply": if called on a message recognized as a list message, it starts
> a new mail to that list. I then put a folder-hook to rebind my "mail" key to
> "list-mail" if I'm in a list folder, something like
>
> folder-hook . bind index c mail
> folder-hook '/lists/' bind index c list-mail
(...)
> (I just noticed it skips checking for postponed messages, I'll deal
> with that later, just think of it as a known bug for now :)
There, this new version fixes that.
rbp
--
Rodrigo Bernardo Pimentel <rbp@xxxxxxxxxxxx>
http://isnomore.net GPG KeyId: <0x0DB14978>
This sentence has cabbage six words.
diff -Naur mutt-1.5.4.orig/OPS mutt-1.5.4/OPS
--- mutt-1.5.4.orig/OPS 2002-12-17 07:50:26.000000000 -0200
+++ mutt-1.5.4/OPS 2003-11-16 19:03:36.000000000 -0200
@@ -93,6 +93,7 @@
OP_JUMP "jump to an index number"
OP_LAST_ENTRY "move to the last entry"
OP_LIST_REPLY "reply to specified mailing list"
+OP_LIST_MAIL "compose a new mail message to specified mailing list"
OP_MACRO "execute a macro"
OP_MAIL "compose a new mail message"
OP_MAIN_CHANGE_FOLDER "open a different folder"
diff -Naur mutt-1.5.4.orig/curs_main.c mutt-1.5.4/curs_main.c
--- mutt-1.5.4.orig/curs_main.c 2003-01-23 20:04:28.000000000 -0200
+++ mutt-1.5.4/curs_main.c 2003-11-16 19:03:36.000000000 -0200
@@ -1801,6 +1801,15 @@
menu->redraw = REDRAW_FULL;
break;
+ case OP_LIST_MAIL:
+
+ CHECK_ATTACH;
+ CHECK_MSGCOUNT;
+ CHECK_VISIBLE;
+ ci_send_message (SENDLISTMAIL, NULL, NULL, Context, tag ? NULL :
CURHDR);
+ menu->redraw = REDRAW_FULL;
+ break;
+
case OP_MAIL:
CHECK_ATTACH;
diff -Naur mutt-1.5.4.orig/functions.h mutt-1.5.4/functions.h
--- mutt-1.5.4.orig/functions.h 2003-01-06 08:25:34.000000000 -0200
+++ mutt-1.5.4/functions.h 2003-11-16 19:03:36.000000000 -0200
@@ -94,6 +94,7 @@
{ "previous-undeleted", OP_MAIN_PREV_UNDELETED, "k" },
{ "limit", OP_MAIN_LIMIT, "l" },
{ "list-reply", OP_LIST_REPLY, "L" },
+ { "list-mail", OP_LIST_MAIL, NULL },
{ "mail", OP_MAIL, "m" },
{ "toggle-new", OP_TOGGLE_NEW, "N" },
{ "toggle-write", OP_TOGGLE_WRITE, "%" },
@@ -174,6 +175,7 @@
{ "previous-undeleted",OP_MAIN_PREV_UNDELETED, "k" },
{ "previous-entry", OP_PREV_ENTRY, "K" },
{ "list-reply", OP_LIST_REPLY, "L" },
+ { "list-mail", OP_LIST_MAIL, NULL },
{ "redraw-screen", OP_REDRAW, "\014" },
{ "mail", OP_MAIL, "m" },
{ "mark-as-new", OP_TOGGLE_NEW, "N" },
@@ -256,6 +258,7 @@
{ "resend-message", OP_RESEND, "\033e" },
{ "group-reply", OP_GROUP_REPLY, "g" },
{ "list-reply", OP_LIST_REPLY, "L" },
+ { "list-mail", OP_LIST_MAIL, NULL },
{ "forward-message", OP_FORWARD_MESSAGE, "f" },
{ "view-text", OP_ATTACH_VIEW_TEXT, "T" },
{ "view-attach", OP_VIEW_ATTACH, M_ENTER_S },
diff -Naur mutt-1.5.4.orig/mutt.h mutt-1.5.4/mutt.h
--- mutt-1.5.4.orig/mutt.h 2003-03-04 04:49:48.000000000 -0300
+++ mutt-1.5.4/mutt.h 2003-11-16 19:03:36.000000000 -0200
@@ -302,6 +302,7 @@
#define SENDMAILX (1<<6)
#define SENDKEY (1<<7)
#define SENDRESEND (1<<8)
+#define SENDLISTMAIL (1<<9)
/* flags to _mutt_select_file() */
#define M_SEL_BUFFY (1<<0)
diff -Naur mutt-1.5.4.orig/pager.c mutt-1.5.4/pager.c
--- mutt-1.5.4.orig/pager.c 2003-01-23 20:04:28.000000000 -0200
+++ mutt-1.5.4/pager.c 2003-11-16 19:03:36.000000000 -0200
@@ -2417,6 +2417,13 @@
redraw = REDRAW_FULL;
break;
+ case OP_LIST_MAIL:
+ CHECK_MODE(IsHeader (extra) && !IsAttach (extra));
+ CHECK_ATTACH;
+ ci_send_message (SENDLISTMAIL, NULL, NULL, extra->ctx, extra->hdr);
+ redraw = REDRAW_FULL;
+ break;
+
case OP_FORWARD_MESSAGE:
CHECK_MODE(IsHeader (extra) || IsMsgAttach (extra));
CHECK_ATTACH;
diff -Naur mutt-1.5.4.orig/send.c mutt-1.5.4/send.c
--- mutt-1.5.4.orig/send.c 2003-03-06 18:21:32.000000000 -0300
+++ mutt-1.5.4/send.c 2003-11-16 19:03:49.000000000 -0200
@@ -456,7 +456,7 @@
/* Exit now if we're setting up the default Cc list for list-reply
* (only set if Mail-Followup-To is present and honoured).
*/
- if (flags & SENDLISTREPLY)
+ if (flags & (SENDLISTREPLY | SENDLISTMAIL))
return 0;
if (!option(OPTREPLYSELF) && mutt_addr_is_user (env->from))
@@ -520,14 +520,14 @@
int mutt_fetch_recips (ENVELOPE *out, ENVELOPE *in, int flags)
{
ADDRESS *tmp;
- if (flags & SENDLISTREPLY)
+ if (flags & (SENDLISTREPLY | SENDLISTMAIL))
{
tmp = find_mailing_lists (in->to, in->cc);
rfc822_append (&out->to, tmp);
rfc822_free_address (&tmp);
if (in->mail_followup_to &&
- default_to (&out->cc, in, flags & SENDLISTREPLY) == -1)
+ default_to (&out->cc, in, flags & (SENDLISTREPLY | SENDLISTMAIL)) ==
-1)
return (-1); /* abort */
}
else
@@ -684,7 +684,7 @@
else
curenv = cur->env;
- if (flags & SENDREPLY)
+ if (flags & (SENDREPLY | SENDLISTMAIL))
{
if (tag)
{
@@ -706,8 +706,11 @@
return (-1);
}
- mutt_make_misc_reply_headers (env, ctx, cur, curenv);
- mutt_make_reference_headers (tag ? NULL : curenv, env, ctx);
+ if (! (flags & SENDLISTMAIL))
+ {
+ mutt_make_misc_reply_headers (env, ctx, cur, curenv);
+ mutt_make_reference_headers (tag ? NULL : curenv, env, ctx);
+ }
}
else if (flags & SENDFORWARD)
mutt_make_forward_subject (env, ctx, cur);
@@ -1049,8 +1052,8 @@
int rv = -1;
- if (!flags && !msg && quadoption (OPT_RECALL) != M_NO &&
- mutt_num_postponed (1))
+ if ((!flags || (flags == SENDLISTMAIL)) && !msg &&
+ quadoption (OPT_RECALL) != M_NO && mutt_num_postponed (1))
{
/* If the user is composing a new message, check to see if there
* are any postponed messages first.
@@ -1059,7 +1062,7 @@
return rv;
if(i == M_YES)
- flags |= SENDPOSTPONED;
+ flags = SENDPOSTPONED;
}
@@ -1160,7 +1163,7 @@
}
else if (! (flags & (SENDPOSTPONED|SENDRESEND)))
{
- if ((flags & (SENDREPLY | SENDFORWARD)) && ctx &&
+ if ((flags & (SENDREPLY | SENDFORWARD | SENDLISTMAIL)) && ctx &&
envelope_defaults (msg->env, ctx, cur, flags) == -1)
goto cleanup;
@@ -1172,7 +1175,7 @@
if (! (flags & SENDMAILX) &&
! (option (OPTAUTOEDIT) && option (OPTEDITHDRS)) &&
- ! ((flags & SENDREPLY) && option (OPTFASTREPLY)))
+ ! ((flags & (SENDREPLY | SENDLISTMAIL)) && option (OPTFASTREPLY)))
{
if (edit_envelope (msg->env) == -1)
goto cleanup;