On Fri, Feb 19, 2016 at 04:45:26PM +0100, Vincent Lefevre wrote:
> On 2016-02-17 10:02:33 -0800, Kevin J. McCarthy wrote:
> > On Tue, Feb 16, 2016 at 03:58:56PM -0800, Kevin J. McCarthy wrote:
> > > It looks like the main steps that are skipped by postpone/resumed emails
> > > but done for draft files are:
> > >   1. user recipient headers.  e.g.  my_hdr "to/cc/bcc"
> > >   2. alias expansion
> > >   3. to/cc/bcc prompts
> > >   4. send_hook
> > >   5. all other user headers; (all other my_hdr lines)
> > >   6. append signature
> > > 
> > > I could remove steps 5 and 6 for draft files.  How do others feel about
> > > this?
> > 
> > What about a new option, e.g. $resume_draft_files, that when set skips
> > *all* the above steps 1-6.  The idea being that, when set, draft files
> > are treated more like postpone/resumed messages than as a starting
> > point to modify.
> > 
> > Would this be useful?
> 
> Perhaps. I wonder whether this should be done with a new option
> or a command-line switch (or both).

I'm attaching a patch for testing/feedback.  It adds $resume_draft_files
(default is unset).  Note that this can be enabled via '-e set
resume_draft_files' on the command line.  The patch is based on
d11b6776532f which I just pushed.

-- 
Kevin J. McCarthy
GPG Fingerprint: 8975 A9B3 3AA3 7910 385C  5308 ADEF 7684 8031 6BDA
http://www.8t8.us/configs/gpg-key-transition-statement.txt
# HG changeset patch
# User Kevin McCarthy <[email protected]>
# Date 1456717495 28800
#      Sun Feb 28 19:44:55 2016 -0800
# Node ID c6e2213ab0301528491a4ff8ce0a63c33d12e4b4
# Parent  d11b6776532f56603a832b50865147ebc9b3d32d
Add $resume_draft_files option.

When set, draft files are processed like when resuming postponed
messages.  One use of this option is to avoid multiple user-defined
headers and signatures being added to the message.  (e.g. when -E is
used repeatedly on the draft files).

diff --git a/init.h b/init.h
--- a/init.h
+++ b/init.h
@@ -2452,16 +2452,30 @@
   */
   { "resolve",         DT_BOOL, R_NONE, OPTRESOLVE, 1 },
   /*
   ** .pp
   ** When \fIset\fP, the cursor will be automatically advanced to the next
   ** (possibly undeleted) message whenever a command that modifies the
   ** current message is executed.
   */
+  { "resume_draft_files", DT_BOOL, R_NONE, OPTRESUMEDRAFTFILES, 0 },
+  /*
+  ** .pp
+  ** If \fIset\fP, draft files (specified by \fC-H\fP on the command
+  ** line) are processed similarly to when resuming a postponed
+  ** message.  Recipients are not prompted for; send-hooks are not
+  ** evaluated; no alias expansion takes place; user-defined headers
+  ** and signatures are not added to the message.
+  ** .pp
+  ** This option may be useful when the \fC-E\fP command line argument
+  ** is used, to avoid a signature and user-defined headers being
+  ** added to the message multiple times.  It can be enabled on the
+  ** command line using \fC-e 'set resume_draft_files'\fP.
+  */
   { "reverse_alias",   DT_BOOL, R_BOTH, OPTREVALIAS, 0 },
   /*
   ** .pp
   ** This variable controls whether or not Mutt will display the ``personal''
   ** name from your aliases in the index menu if it finds an alias that
   ** matches the message's sender.  For example, if you have the following
   ** alias:
   ** .ts
diff --git a/mutt.h b/mutt.h
--- a/mutt.h
+++ b/mutt.h
@@ -413,16 +413,17 @@
   OPTPRINTDECODE,
   OPTPRINTSPLIT,
   OPTPROMPTAFTER,
   OPTREADONLY,
   OPTREFLOWSPACEQUOTES,
   OPTREFLOWTEXT,
   OPTREPLYSELF,
   OPTRESOLVE,
+  OPTRESUMEDRAFTFILES,
   OPTREVALIAS,
   OPTREVNAME,
   OPTREVREAL,
   OPTRFC2047PARAMS,
   OPTSAVEADDRESS,
   OPTSAVEEMPTY,
   OPTSAVENAME,
   OPTSCORE,
diff --git a/send.c b/send.c
--- a/send.c
+++ b/send.c
@@ -1282,17 +1282,18 @@
      * should exist since the user has not had the opportunity to add
      * addresses to the list.  We just have to ensure the postponed messages
      * have their aliases expanded.
      */
 
     msg->env->from = set_reverse_name (cur->env);
   }
 
-  if (! (flags & (SENDPOSTPONED|SENDRESEND)))
+  if (! (flags & (SENDPOSTPONED|SENDRESEND)) &&
+      ! ((flags & SENDDRAFTFILE) && option (OPTRESUMEDRAFTFILES)))
   {
     if ((flags & (SENDREPLY | SENDFORWARD)) && ctx &&
        envelope_defaults (msg->env, ctx, cur, flags) == -1)
       goto cleanup;
 
     if (option (OPTHDRS))
       process_user_recips (msg->env);
 

Attachment: signature.asc
Description: PGP signature

Reply via email to