unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: David Bremner <david@tethera.net>
To: Mark Walters <markwalters1009@gmail.com>, notmuch@notmuchmail.org
Subject: Re: [Patch v3 2/2] emacs: postpone/resume support
Date: Sun, 06 Nov 2016 07:28:30 -0400	[thread overview]
Message-ID: <87wpggetk1.fsf@tethera.net> (raw)
In-Reply-To: <87eg2o6gvk.fsf@qmul.ac.uk>

Mark Walters <markwalters1009@gmail.com> writes:

>> +(defun notmuch-draft--check-encryption-tag ()
>> +  "Query user if there an mml tag that looks like it might indicate encryption.
>> +
>> +Returns t if there is no such tag, or the user confirms they mean
>> +it."
>> +  (save-excursion
>> +    (message-goto-body)
>> +      (or
>> +       ;; We are fine if no relevant tag is found, or
>> +       (not (re-search-forward notmuch-draft-encryption-tag-regex nil 't))
>> +       ;; The user confirms they means it.
>> +       (yes-or-no-p "(Customize `notmuch-draft-save-plaintext' to avoid this warning)
>> +This message contains mml tags that suggest it is intended to be encrypted.
>> +Really save and index an unencrypted copy? "))))
>> +
>> +(defun notmuch-draft-save ()
>> +  "Save the current draft message in the notmuch database.
>> +
>> +This saves the current message in the database with tags
>> +`notmuch-draft-draft-tags` (in addition to any default tags
>> +applied to newly inserted messages)."
>> +  (interactive)
>> +  (case notmuch-draft-save-plaintext
>> +    ((ask)
>> +     (unless (notmuch-draft--check-encryption-tag)
>> +       (error "Save aborted")))
>> +    ((t)
>> +     (ignore))
>> +    ((nil)
>> +     (error "Refusing to save draft with encryption tags (see `notmuch-draft-save-plaintext')")))
>
> Hi
>
> Did you mean for the case when notmuch-draft-save-plaintext is nil to
> abort in all cases, not just when there is an mml secure tag? (I haven't
> tested but it looks like that is what happens above)

Oh, that's definitely a bug, thanks.

BTW, I was thinking this big of a new feature sure should probably have
some tests, at least 1 for saving, 1 for resuming, and one for checking
of encryption tags; maybe you have other ideas about tests. It would
also provide a natural way to break things up into smaller commits. 

d

  reply	other threads:[~2016-11-06 11:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-06  1:36 v3 of postpone patches David Bremner
2016-11-06  1:36 ` [Patch v3 1/2] emacs: tree: remove binding for pressing button in message pane David Bremner
2016-11-06  1:36 ` [Patch v3 2/2] emacs: postpone/resume support David Bremner
2016-11-06 10:18   ` Mark Walters
2016-11-06 10:29   ` Mark Walters
2016-11-06 11:28     ` David Bremner [this message]
2016-11-06 11:51   ` David Bremner
2016-11-06 12:14     ` v4 postpone patches David Bremner
2016-11-06 12:15       ` [Patch v4 1/2] emacs: tree: remove binding for pressing button in message pane David Bremner
2016-11-06 12:15       ` [Patch v4 2/2] emacs: postpone/resume support David Bremner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wpggetk1.fsf@tethera.net \
    --to=david@tethera.net \
    --cc=markwalters1009@gmail.com \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).