Re: [PATCH 2/2] emacs: postpone/resume support

Subject: Re: [PATCH 2/2] emacs: postpone/resume support

Date: Sat, 01 Oct 2016 11:20:10 -0300

To: Mark Walters,


From: David Bremner

Mark Walters <> writes:

> This provides preliminary support for postponing and resuming in the
> emacs frontend. On postponing it uses notmuch insert to put the
> message in the notmuch database; resume gets the raw file from notmuch
> and using the emacs function mime-to-mml reconstructs the message
> (including attachments).

I was thinking about this a bit more, in the context of your other patch
to scan for #secure, and it occured to me one option would be would be
to add a header to the draft being written with the secure (and other
relevant info). As a proof of concept I added a constant header to all
drafts [1].  An outline of the approach would be

- scan for #secure tags, error if they are not in the right place
- if found at the top of the document, extract the contents, remove the
  mml tag and put in a header like

  X-Notmuch-Emacs-Secure: method=pgpmime mode=sign

- on reading back, check for, remove that header, add the corresponding
  #secure tag.

It might be possible to re-use functions e.g. mml-secure-message and
mml-unsecure-message from mml-sec.el

Compared to the other approach we discussed (using message-properties to
store the data), this has the advantage of not requiring new features in
the CLI. Also, it would probably be a potential source of user error to
sync drafts between machines via some imap/rsync mechanism, without
syncing message metadata.

Our usual distaste for writing headers is that we don't want to modify
delivered mail; this seems a non-issue here to me since there is no
delivered mail. Others might disagree, of course.

diff --git a/emacs/notmuch-maildir-fcc.el b/emacs/notmuch-maildir-fcc.el
index 95e5650..412da94 100644
--- a/emacs/notmuch-maildir-fcc.el
+++ b/emacs/notmuch-maildir-fcc.el
@@ -163,6 +163,7 @@ by notmuch-mua-mail"
   "Setup message for saving. Should be called on a temporary copy.
 This is taken from the function message-do-fcc."
+  (message-add-header "X-Notmuch-Emacs-Draft: true")

signature.asc (application/pgp-signature)