From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 0E39C6DE0946 for ; Sun, 6 Nov 2016 03:28:36 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.006 X-Spam-Level: X-Spam-Status: No, score=-0.006 tagged_above=-999 required=5 tests=[AWL=0.005, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id U7EmKuhvUIz6 for ; Sun, 6 Nov 2016 03:28:35 -0800 (PST) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by arlo.cworth.org (Postfix) with ESMTPS id 64D086DE02DD for ; Sun, 6 Nov 2016 03:28:34 -0800 (PST) Received: from remotemail by fethera.tethera.net with local (Exim 4.84_2) (envelope-from ) id 1c3LcT-0001Fi-PD; Sun, 06 Nov 2016 06:28:13 -0500 Received: (nullmailer pid 25901 invoked by uid 1000); Sun, 06 Nov 2016 11:28:30 -0000 From: David Bremner To: Mark Walters , notmuch@notmuchmail.org Subject: Re: [Patch v3 2/2] emacs: postpone/resume support In-Reply-To: <87eg2o6gvk.fsf@qmul.ac.uk> References: <20161106013609.8719-1-david@tethera.net> <20161106013609.8719-3-david@tethera.net> <87eg2o6gvk.fsf@qmul.ac.uk> Date: Sun, 06 Nov 2016 07:28:30 -0400 Message-ID: <87wpggetk1.fsf@tethera.net> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2016 11:28:36 -0000 Mark Walters 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