[Patch v3 2/2] emacs: postpone/resume support

David Bremner david at tethera.net
Sun Nov 6 03:28:30 PST 2016


Mark Walters <markwalters1009 at 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




More information about the notmuch mailing list