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 v5 3/4] emacs: check drafts for encryption tags before saving
Date: Sat, 12 Nov 2016 08:48:05 -0400	[thread overview]
Message-ID: <87mvh4g8ze.fsf@tethera.net> (raw)
In-Reply-To: <87lgwv3wde.fsf@qmul.ac.uk>

Mark Walters <markwalters1009@gmail.com> writes:

>> @@ -109,6 +140,15 @@ This saves the current message in the database with tags
>>  `notmuch-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 t)
>> +       (error "Save aborted")))
>> +    ((t)
>> +     (ignore))
>> +    ((nil)
>> +     (unless (notmuch-draft--check-encryption-tag nil)
>> +       (error "Refusing to save draft with encryption tags (see `notmuch-draft-save-plaintext')"))))
>
> What would you think of rejigging the logic here? I would prefer that
> the first check was "is there an encryption tag" and then if there is
> such a tag decide what to do. The reason I prefer that is that it makes
> the common case clear.
>
> I realise there are downsides too -- eg in your code you don't even
> check for secure tags if they are going to  be ignored anyway.

OK, I was mainly concerned with not prompting the user uneccesarily, but
the following seems to be equivalent:


-  (case notmuch-draft-save-plaintext
-    ((ask)
-     (unless (notmuch-draft--check-encryption-tag t)
-       (error "Save aborted")))
-    ((t)
-     (ignore))
-    ((nil)
-     (unless (notmuch-draft--check-encryption-tag nil)
+  (unless (notmuch-draft--check-encryption-tag
+          (eq notmuch-draft-save-plaintext 'ask))
+    (case notmuch-draft-save-plaintext
+      ((ask)
+       (error "Save aborted"))
+      ((t)
+       (ignore))
+      ((nil)
        (error "Refusing to save draft with encryption tags (see `notmuch-draft-save-plaintext')"))))

  reply	other threads:[~2016-11-12 12:48 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-07 12:52 v5 emacs postpone/resume patches David Bremner
2016-11-07 12:52 ` [Patch v5 1/4] emacs: tree: remove binding for pressing button in message pane David Bremner
2016-11-07 12:52 ` [Patch v5 2/4] emacs: postpone a message David Bremner
2016-11-12 12:30   ` David Bremner
2016-11-13  9:36     ` Mark Walters
2016-11-07 12:52 ` [Patch v5 3/4] emacs: check drafts for encryption tags before saving David Bremner
2016-11-07 19:47   ` Mark Walters
2016-11-12 12:48     ` David Bremner [this message]
2016-11-07 12:52 ` [Patch v5 4/4] emacs: resume messages David Bremner
2016-11-12 13:10   ` David Bremner
2016-11-13  9:41     ` Mark Walters
2016-11-13 13:13       ` 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=87mvh4g8ze.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).