[PATCH] emacs: drop use of message-default-charset

2019-04-22 Thread Daniel Kahn Gillmor
Apparently, message-default-charset is deprecated, which causes the
following warning messages during the build:

  In notmuch-maildir-setup-message-for-saving:
  emacs/notmuch-maildir-fcc.el:172:31:Warning: ‘message-default-charset’ is an
  obsolete variable (as of 26.1); The default charset comes from the
  language environment

In discussion with emacs upstream over on
https://debbugs.gnu.org/35370, it appears that we can just drop this
entirely and things should still work with emacs 25.
---
 emacs/notmuch-maildir-fcc.el | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/emacs/notmuch-maildir-fcc.el b/emacs/notmuch-maildir-fcc.el
index 1551e8b6..ae56bacd 100644
--- a/emacs/notmuch-maildir-fcc.el
+++ b/emacs/notmuch-maildir-fcc.el
@@ -169,8 +169,7 @@ This is taken from the function message-do-fcc."
   (message-encode-message-body)
   (save-restriction
 (message-narrow-to-headers)
-(let ((mail-parse-charset message-default-charset))
-  (mail-encode-encoded-word-buffer)))
+(mail-encode-encoded-word-buffer))
   (goto-char (point-min))
   (when (re-search-forward
 (concat "^" (regexp-quote mail-header-separator) "$")
-- 
2.20.1

___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: subsequent rebuilds of notmuch always re-build sphinx and ruby

2019-04-22 Thread David Bremner
Daniel Kahn Gillmor  writes:

> On Sun 2019-04-21 16:29:02 -0300, David Bremner wrote:
>> the html rebuild is much faster than the texinfo + info rebuilds.
>
> agreed, in the runs that i've been doing as well.  I was concerned that
> the html rebuild itself may have been *triggering* the rebuild of the
> texinfo stuff, though.  Sounds like you don't think that's the case.
>
>> I've posted some patches for the sphinx-doc issues a couple of hours ago
>> (id:20190421171245.19729-1-da...@tethera.net). 
>
> thanks!  your own commentary on that series seems to acknowledge that
> there are problems with it (though i don't understand the tradeoffs
> well).

There was a problem with the first patch, which I replaced with two more.


> Is there no way to give make itself full visibility into the specific
> generated files so it can do its comparisons directly?  I'm obviously
> not asking you to rewrite the entire native sphinx build system, i'm
> just observing that at present it seems suboptimal, though i don't know
> how to fix it either :/

I'm open to ideas, but keep in mind we want to support parallel make,
which means we have to be careful not to trigger multiple invocations of
sphinx-build in parallel.
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH v2 1/3] emacs: test notmuch-show during message decryption

2019-04-22 Thread Daniel Kahn Gillmor
We did not have a test showing what message decryption looks like
within notmuch-emacs.  This change gives us a baseline for future work
on the notmuch-emacs interface.
---

The difference between this and the prior version of the patch is that
it updates T357-index-decryption.sh as well, to ensure all tests pass.

 test/T357-index-decryption.sh |  3 +-
 test/T450-emacs-show.sh   | 15 ++
 test/corpora/crypto/basic-encrypted.eml   | 28 +++
 .../notmuch-show-decrypted-message| 11 
 .../notmuch-show-undecryptable-message| 10 +++
 5 files changed, 66 insertions(+), 1 deletion(-)
 create mode 100644 test/corpora/crypto/basic-encrypted.eml
 create mode 100644 
test/emacs-show.expected-output/notmuch-show-decrypted-message
 create mode 100644 
test/emacs-show.expected-output/notmuch-show-undecryptable-message

diff --git a/test/T357-index-decryption.sh b/test/T357-index-decryption.sh
index c5435f4f..e191f6ff 100755
--- a/test/T357-index-decryption.sh
+++ b/test/T357-index-decryption.sh
@@ -236,7 +236,8 @@ notmuch reindex --decrypt=true 
id:simple-encryp...@crypto.notmuchmail.org
 output=$(notmuch dump )
 expected='#notmuch-dump batch-tag:3 config,properties,tags
 +encrypted +inbox +unread -- id:simple-encryp...@crypto.notmuchmail.org
-#= simple-encryp...@crypto.notmuchmail.org index.decryption=failure'
+#= simple-encryp...@crypto.notmuchmail.org index.decryption=failure
++encrypted +inbox +unread -- id:basic-encryp...@crypto.notmuchmail.org'
 test_expect_equal \
 "$output" \
 "$expected"
diff --git a/test/T450-emacs-show.sh b/test/T450-emacs-show.sh
index 3555a939..5d4df443 100755
--- a/test/T450-emacs-show.sh
+++ b/test/T450-emacs-show.sh
@@ -208,4 +208,19 @@ test_emacs '(notmuch-show "id:'$gen_msg_id'")
 output=$(head -1 OUTPUT.raw|cut -f1-4 -d' ')
 test_expect_equal "$output" "Notmuch Test Suite "
 
+
+# switching to the crypto corpus, using gpg from here on:
+add_gnupg_home
+add_email_corpus crypto
+
+test_begin_subtest "show decrypted message"
+test_emacs '(notmuch-show "id:basic-encryp...@crypto.notmuchmail.org")
+(test-visible-output)'
+test_expect_equal_file $EXPECTED/notmuch-show-decrypted-message OUTPUT
+
+test_begin_subtest "show undecryptable message"
+test_emacs '(notmuch-show "id:simple-encryp...@crypto.notmuchmail.org")
+(test-visible-output)'
+test_expect_equal_file $EXPECTED/notmuch-show-undecryptable-message OUTPUT
+
 test_done
diff --git a/test/corpora/crypto/basic-encrypted.eml 
b/test/corpora/crypto/basic-encrypted.eml
new file mode 100644
index ..1ba4698a
--- /dev/null
+++ b/test/corpora/crypto/basic-encrypted.eml
@@ -0,0 +1,28 @@
+From: test_su...@notmuchmail.org
+To: test_su...@notmuchmail.org
+Subject: Here is the password
+Date: Sat, 01 Jan 2000 12:00:00 +
+Message-ID: 
+MIME-Version: 1.0
+Content-Type: multipart/encrypted; boundary="=-=-=";
+   protocol="application/pgp-encrypted"
+
+--=-=-=
+Content-Type: application/pgp-encrypted
+
+Version: 1
+
+--=-=-=
+Content-Type: application/octet-stream
+
+-BEGIN PGP MESSAGE-
+
+hIwDxE023q1UqxYBBACp70e7KPy9OYaheIrkLzmhq1lRqmy51aL1jBL0K/qN7rfK
+BZEG1cR8jeLjTFdPKPLVKJI80r7FgKI0ywvWvl6R1aE1Ty5BnVXT9XzCrEH7fqCl
+SKK82EvolXTohAZHUrh6K66eQQTTIAC1n7B0A8hErzkgaM4+seN3LlvezT6TLNKM
+ATpqsEbM2MVrGgw0b3oUsGGAPEt2MmjNEYsriKnqwt6dJDZc//XyhjgMQayiD8da
+N1gT3oqgu/gKCpBZDYzHf9OtVi2UnlFDWy6rrMZLjWDnIv4ve9Pn/qolwHVjzdJ1
+ZfjNC5t0z3XADKGrjN9wutr4qm7STW1rHAXHP68TQTxI0qgJKjPXNKWEw6g=
+=pJG4
+-END PGP MESSAGE-
+--=-=-=--
diff --git a/test/emacs-show.expected-output/notmuch-show-decrypted-message 
b/test/emacs-show.expected-output/notmuch-show-decrypted-message
new file mode 100644
index ..08a9e4f6
--- /dev/null
+++ b/test/emacs-show.expected-output/notmuch-show-decrypted-message
@@ -0,0 +1,11 @@
+test_su...@notmuchmail.org (2000-01-01) (encrypted inbox)
+Subject: Here is the password
+To: test_su...@notmuchmail.org
+Date: Sat, 01 Jan 2000 12:00:00 +
+
+[ multipart/encrypted ]
+[ Decryption successful ]
+[ Unknown signature status ]
+[ application/pgp-encrypted ]
+[ text/plain ]
+The password is "abcd1234!", please do not tell anyone.
diff --git a/test/emacs-show.expected-output/notmuch-show-undecryptable-message 
b/test/emacs-show.expected-output/notmuch-show-undecryptable-message
new file mode 100644
index ..530ff286
--- /dev/null
+++ b/test/emacs-show.expected-output/notmuch-show-undecryptable-message
@@ -0,0 +1,10 @@
+Daniel Kahn Gillmor  (2016-12-22) (encrypted inbox)
+Subject: encrypted message
+To: d...@fifthhorseman.net
+Date: Thu, 22 Dec 2016 08:34:56 -0400
+
+[ multipart/encrypted ]
+[ Decryption error ]
+[ Unknown signature status ]
+[ application/pgp-encrypted ]
+[ application/octet-stream ]
-- 
2.20.1

___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] emacs: drop use of message-default-charset

2019-04-22 Thread Tomi Ollila
On Mon, Apr 22 2019, Daniel Kahn Gillmor wrote:

> Apparently, message-default-charset is deprecated, which causes the
> following warning messages during the build:
>
>   In notmuch-maildir-setup-message-for-saving:
>   emacs/notmuch-maildir-fcc.el:172:31:Warning: ‘message-default-charset’ is an
>   obsolete variable (as of 26.1); The default charset comes from the
>   language environment
>
> In discussion with emacs upstream over on
> https://debbugs.gnu.org/35370, it appears that we can just drop this
> entirely and things should still work with emacs 25.

I looked this a bit (well, quite a few minutes, rfc2047.el in emacs 24.3,
25.2 and 26.1), and while it is impossible to gain any real knowledge
with such a shallow peek, I'd guess the following might be true:

Since `mail-parse-charset` and `message-default-charset` are (were) both
`nil` by default, this change does have any effect for users that never
customized message-default-charset. If anyone did, now there is small
chance that the line:

"If nil, you might be asked to input the charset."

(from message-default-charset docstring) can happen.

In this context the change is IMO even more unlikely.

So this change LGTM.

Tomi

> ---
>  emacs/notmuch-maildir-fcc.el | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/emacs/notmuch-maildir-fcc.el b/emacs/notmuch-maildir-fcc.el
> index 1551e8b6..ae56bacd 100644
> --- a/emacs/notmuch-maildir-fcc.el
> +++ b/emacs/notmuch-maildir-fcc.el
> @@ -169,8 +169,7 @@ This is taken from the function message-do-fcc."
>(message-encode-message-body)
>(save-restriction
>  (message-narrow-to-headers)
> -(let ((mail-parse-charset message-default-charset))
> -  (mail-encode-encoded-word-buffer)))
> +(mail-encode-encoded-word-buffer))
>(goto-char (point-min))
>(when (re-search-forward
>(concat "^" (regexp-quote mail-header-separator) "$")
> -- 
> 2.20.1
>
> ___
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: subsequent rebuilds of notmuch always re-build sphinx and ruby

2019-04-22 Thread Daniel Kahn Gillmor
On Sun 2019-04-21 16:29:02 -0300, David Bremner wrote:
> the html rebuild is much faster than the texinfo + info rebuilds.

agreed, in the runs that i've been doing as well.  I was concerned that
the html rebuild itself may have been *triggering* the rebuild of the
texinfo stuff, though.  Sounds like you don't think that's the case.

> I've posted some patches for the sphinx-doc issues a couple of hours ago
> (id:20190421171245.19729-1-da...@tethera.net). 

thanks!  your own commentary on that series seems to acknowledge that
there are problems with it (though i don't understand the tradeoffs
well).  i'm not super comfortable with make-style "stamping": my
experience with it is that it creates a synchronization problem, and
it's easy for the "sync" between the stamp and the generated artifacts
to break, at which point the safest thing is to "make clean" and start
fully over.

Is there no way to give make itself full visibility into the specific
generated files so it can do its comparisons directly?  I'm obviously
not asking you to rewrite the entire native sphinx build system, i'm
just observing that at present it seems suboptimal, though i don't know
how to fix it either :/

> Currently the ruby rebuild doesn't seem to be slowing things down much
> for me.
>
> ╭─ convex:~/software/upstream/notmuch 
> ╰─ (git)-[wip/make-docs]-% /usr/bin/time make ruby-bindings 1>/dev/null
> 0.13user 0.02system 0:00.15elapsed 101%CPU (0avgtext+0avgdata 
> 11504maxresident)k
> 0inputs+208outputs (0major+6523minor)pagefaults 0swaps
>
> That's with an SSD, so maybe there's more of hit for other environments.

I agree, this one isn't particularly slow, and it appears to be a leaf
dependency (for now), so it's not the worst thing.  But it's still
pretty clearly a bug that this thing loops.

   --dkg


signature.asc
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: bug#35370: notmuch-emacs: avoiding deprecated message-default-charset

2019-04-22 Thread Eli Zaretskii
> From: Daniel Kahn Gillmor 
> Date: Sun, 21 Apr 2019 21:55:38 -0400
> Cc: da...@tethera.net, notmuch@notmuchmail.org, 35...@debbugs.gnu.org
> 
> Do you have any recommendation for how an external emacs module (which
> aims to work with at emacs 25 as well at least) should handle this?

Just remove any uses of it.  Why are you using it now?
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] emacs: hint that notmuch-mua-attachment-regexp is a regular expression

2019-04-22 Thread Örjan Ekeberg
This addresses the same issue, and therefore overlaps with the patch
I submitted a week ago.
(id:20190415133519.4532-1-ekeb...@kth.se)

/Örjan


Daniel Kahn Gillmor  writes:

> Without this change, we see the following warnings during the build:
>
> ```
> In toplevel form:
> emacs/notmuch-mua.el:119:1:Warning: defcustom for
> ‘notmuch-mua-attachment-regexp’ fails to specify type
> emacs/notmuch-mua.el:119:1:Warning: defcustom for
> ‘notmuch-mua-attachment-regexp’ fails to specify type
> EMACS emacs/notmuch-show.elc
> ```
> ---
>  emacs/notmuch-mua.el | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
> index 94fa19d7..b1a31034 100644
> --- a/emacs/notmuch-mua.el
> +++ b/emacs/notmuch-mua.el
> @@ -121,7 +121,8 @@ multiple parts get a header."
>"Message body text indicating that an attachment is expected.
>  
>  This is not used unless `notmuch-mua-attachment-check' is added
> -to `notmuch-mua-send-hook'.")
> +to `notmuch-mua-send-hook'."
> +  :type '(regexp))
>  
>  ;;
>  
> -- 
> 2.20.1
>
> ___
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: bug#35370: notmuch-emacs: avoiding deprecated message-default-charset

2019-04-22 Thread Noam Postavsky
Daniel Kahn Gillmor  writes:

>>> In notmuch-maildir-setup-message-for-saving:
>>> emacs/notmuch-maildir-fcc.el:172:31:Warning: ‘message-default-charset’ is an
>>> obsolete variable (as of 26.1); The default charset comes from the
>>> language environment
>>>
>>> I'm not enough of an emacs guru to know the right way to avoid this
>>> warning, but i'm hoping that someonen else can take a stab at it, since
>>> extraneous warnings make it easier to ignore real problems.
>>
>> Good question. I looked at message.el in emacs master and it
>>
>>  1) Obsoletes message-default-charset as in 26.1
>>  2) Still uses it in exactly the construction we do.
>
> interesting, thanks for digging that up.
>
>> I'm not sure if it's exactly a reportable bug in emacs, but it is a bit
>> annoying.
>
> seems reportable, if not exactly high-severity.  what does upstream
> expect downstream users of message-default-charset to do?  I'm
> (trying to) forward this to the emacs upstream bugtracker; maybe we can
> get guidance from them on what to do.

The commit which marks this variable as obsolete, has a couple hunks
that just remove uses of it.  Not clear why other uses were left in.
Oversight?

[1: 66d9ef95c0]: 2016-02-14 17:07:48 +1100
  Remove compat code for older Emacsen
  
https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=66d9ef95c0f9407d2a6d26bcd7ed84a303294b53

--- a/lisp/gnus/gnus-int.el
+++ b/lisp/gnus/gnus-int.el
@@ -777,8 +777,7 @@ (defun gnus-request-accept-article (group  
gnus-command-method last
   (message-options-set-recipient)
   (save-restriction
(message-narrow-to-head)
-   (let ((mail-parse-charset message-default-charset))
- (mail-encode-encoded-word-buffer)))
+   (mail-encode-encoded-word-buffer))
   (message-encode-message-body)))
   (let ((gnus-command-method (or gnus-command-method
 (gnus-find-method-for-group group)))
@@ -800,8 +799,7 @@ (defun gnus-request-replace-article (article group buffer 
 no-encode)
   (message-options-set-recipient)
   (save-restriction
(message-narrow-to-head)
-   (let ((mail-parse-charset message-default-charset))
- (mail-encode-encoded-word-buffer)))
+   (mail-encode-encoded-word-buffer))
   (message-encode-message-body)))
   (let* ((func (car (gnus-group-name-to-method group)))
  (result (funcall (intern (format "%s-request-replace-article" func))
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: bug#35370: notmuch-emacs: avoiding deprecated message-default-charset

2019-04-22 Thread Eli Zaretskii
> From: Daniel Kahn Gillmor 
> Cc: npost...@gmail.com, da...@tethera.net, notmuch@notmuchmail.org, 
> 35...@debbugs.gnu.org
> Date: Mon, 22 Apr 2019 10:21:25 -0400
> 
> > Just remove any uses of it.  Why are you using it now?
> 
> in notmuch's emacs/notmuch-maildir-fcc.el, as mentioned at the beginning
> of this thread:
> 
> https://git.notmuchmail.org/git?p=notmuch;a=blob;f=emacs/notmuch-maildir-fcc.el;h=1551e8b649102ccdfecad9a2ef278949bfb3d702;hb=HEAD#l172
> 
> If we remove that entry from the (let) block, what are the implications
> for users of notmuch who are still using emacs 25?

Nothing, I think.  But if you don't want to risk problems, you can use
it dependent on the Emacs version.
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] tests: move FINGERPRINT definition to add_gnupg_home

2019-04-22 Thread Tomi Ollila
On Sat, Apr 20 2019, Daniel Kahn Gillmor wrote:

> If a test has added a GnuPG homedir, it may well want to know the
> fingerprint.  This saves us from having to redefine this magic string
> in multiple places when more tests evenutally use the GnuPG homedir.

This change looks good (s/evenutally/eventually/)

> ---
>  test/T350-crypto.sh | 2 --
>  test/test-lib.sh| 3 +++
>  2 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/test/T350-crypto.sh b/test/T350-crypto.sh
> index 73aa58de..7b10f434 100755
> --- a/test/T350-crypto.sh
> +++ b/test/T350-crypto.sh
> @@ -10,8 +10,6 @@ test_description='PGP/MIME signature verification and 
> decryption'
>  ##
>  
>  add_gnupg_home
> -# Change this if we ship a new test key
> -FINGERPRINT="5AEAB11F5E33DCE875DDB75B6D92612D94E46381"
>  
>  test_begin_subtest "emacs delivery of signed message"
>  test_expect_success \
> diff --git a/test/test-lib.sh b/test/test-lib.sh
> index fca5277d..58909ee7 100644
> --- a/test/test-lib.sh
> +++ b/test/test-lib.sh
> @@ -117,6 +117,9 @@ add_gnupg_home ()
>   echo debug-quick-random >> "$GNUPGHOME"/gpg.conf
>  fi
>  echo no-emit-version >> "$GNUPGHOME"/gpg.conf
> +
> +# Change this if we ship a new test key
> +FINGERPRINT="5AEAB11F5E33DCE875DDB75B6D92612D94E46381"
>  }
>  
>  # Each test should start with something like this, after copyright notices:
> -- 
> 2.20.1
>
> ___
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] cli/show: pass the siglist directly to the sigstatus sprinter

2019-04-22 Thread Tomi Ollila
On Sat, Apr 20 2019, Daniel Kahn Gillmor wrote:

> This makes it easier to reuse format_part_sigstatus_sprinter() when we
> have other places that we want to display a signature status.

Change looks trivial enough (and reduces the "scope" function sees which is
always good if it is enough -- I trust it is)

Tomi

> ---
>  notmuch-show.c | 6 ++
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/notmuch-show.c b/notmuch-show.c
> index 07e9a5db..88699e90 100644
> --- a/notmuch-show.c
> +++ b/notmuch-show.c
> @@ -429,13 +429,11 @@ format_signature_errors (sprinter_t *sp, GMimeSignature 
> *signature)
>  
>  /* Signature status sprinter (GMime 2.6) */
>  static void
> -format_part_sigstatus_sprinter (sprinter_t *sp, mime_node_t *node)
> +format_part_sigstatus_sprinter (sprinter_t *sp, GMimeSignatureList *siglist)
>  {
>  /* Any changes to the JSON or S-Expression format should be
>   * reflected in the file devel/schemata. */
>  
> -GMimeSignatureList *siglist = node->sig_list;
> -
>  sp->begin_list (sp);
>  
>  if (!siglist) {
> @@ -684,7 +682,7 @@ format_part_sprinter (const void *ctx, sprinter_t *sp, 
> mime_node_t *node,
>  
>  if (node->verify_attempted) {
>   sp->map_key (sp, "sigstatus");
> - format_part_sigstatus_sprinter (sp, node);
> + format_part_sigstatus_sprinter (sp, node->sig_list);
>  }
>  
>  sp->map_key (sp, "content-type");
> -- 
> 2.20.1
>
> ___
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] emacs: hint that notmuch-mua-attachment-regexp is a regular expression

2019-04-22 Thread Tomi Ollila
On Sat, Apr 20 2019, Daniel Kahn Gillmor wrote:

> Without this change, we see the following warnings during the build:
>
> ```
> In toplevel form:
> emacs/notmuch-mua.el:119:1:Warning: defcustom for
> ‘notmuch-mua-attachment-regexp’ fails to specify type
> emacs/notmuch-mua.el:119:1:Warning: defcustom for
> ‘notmuch-mua-attachment-regexp’ fails to specify type
> EMACS emacs/notmuch-show.elc
> ```

LGTM. works as advertised.

Tomi

> ---
>  emacs/notmuch-mua.el | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
> index 94fa19d7..b1a31034 100644
> --- a/emacs/notmuch-mua.el
> +++ b/emacs/notmuch-mua.el
> @@ -121,7 +121,8 @@ multiple parts get a header."
>"Message body text indicating that an attachment is expected.
>  
>  This is not used unless `notmuch-mua-attachment-check' is added
> -to `notmuch-mua-send-hook'.")
> +to `notmuch-mua-send-hook'."
> +  :type '(regexp))
>  
>  ;;
>  
> -- 
> 2.20.1
>
> ___
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH 2/3] test: show what emacs sees of an encrypted message when crypto is disabled

2019-04-22 Thread Daniel Kahn Gillmor
Some users may set notmuch-crypto-process-mime to nil, disabling all
crypto use.  We should have a baseline for what that looks like.
---
 test/T450-emacs-show.sh|  6 ++
 .../notmuch-show-decrypted-message-no-crypto   | 10 ++
 2 files changed, 16 insertions(+)
 create mode 100644 
test/emacs-show.expected-output/notmuch-show-decrypted-message-no-crypto

diff --git a/test/T450-emacs-show.sh b/test/T450-emacs-show.sh
index 5d4df443..de1755d2 100755
--- a/test/T450-emacs-show.sh
+++ b/test/T450-emacs-show.sh
@@ -223,4 +223,10 @@ test_emacs '(notmuch-show 
"id:simple-encryp...@crypto.notmuchmail.org")
 (test-visible-output)'
 test_expect_equal_file $EXPECTED/notmuch-show-undecryptable-message OUTPUT
 
+test_begin_subtest "show encrypted message when not processing crypto"
+test_emacs '(let ((notmuch-crypto-process-mime nil))
+ (notmuch-show "id:basic-encryp...@crypto.notmuchmail.org")
+ (test-visible-output))'
+test_expect_equal_file $EXPECTED/notmuch-show-decrypted-message-no-crypto 
OUTPUT
+
 test_done
diff --git 
a/test/emacs-show.expected-output/notmuch-show-decrypted-message-no-crypto 
b/test/emacs-show.expected-output/notmuch-show-decrypted-message-no-crypto
new file mode 100644
index ..e302e452
--- /dev/null
+++ b/test/emacs-show.expected-output/notmuch-show-decrypted-message-no-crypto
@@ -0,0 +1,10 @@
+test_su...@notmuchmail.org (2000-01-01) (encrypted inbox)
+Subject: Here is the password
+To: test_su...@notmuchmail.org
+Date: Sat, 01 Jan 2000 12:00:00 +
+
+[ multipart/encrypted ]
+[ Unknown encryption status ]
+[ Unknown signature status ]
+[ application/pgp-encrypted ]
+[ application/octet-stream ]
-- 
2.20.1

___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH 3/3] emacs: Drop content-free "Unknown signature status" button

2019-04-22 Thread Daniel Kahn Gillmor
When we have not been able to evaluate the signature status of a given
MIME part, showing a content-free (and interaction-free) "[ Unknown
signature status ]" button doesn't really help the user at all, and
takes up valuable screen real-estate.

A visual reminder that a given message is *not* signed isn't helpful
unless it is always present, in which case we'd want to see "[ Unknown
signature status ]" buttons on all messages, even ones that don't have
a signing structure, but i don't think we want that.
---
 emacs/notmuch-crypto.el   | 27 ++-
 .../notmuch-show-decrypted-message|  1 -
 .../notmuch-show-decrypted-message-no-crypto  |  1 -
 ...notmuch-show-process-crypto-mime-parts-off |  1 -
 .../notmuch-show-undecryptable-message|  1 -
 5 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/emacs/notmuch-crypto.el b/emacs/notmuch-crypto.el
index 353f721e..68171153 100644
--- a/emacs/notmuch-crypto.el
+++ b/emacs/notmuch-crypto.el
@@ -93,6 +93,7 @@ mode."
 (defun notmuch-crypto-insert-sigstatus-button (sigstatus from)
   (let* ((status (plist-get sigstatus :status))
 (help-msg nil)
+(show-button t)
 (label "Signature not processed")
 (face 'notmuch-crypto-signature-unknown)
 (button-action (lambda (button) (message (button-get button 
'help-echo)
@@ -118,19 +119,21 @@ mode."
   (let ((keyid (concat "0x" (plist-get sigstatus :keyid
(setq label (concat "Bad signature (claimed key ID " keyid ")"))
(setq face 'notmuch-crypto-signature-bad)))
+ (status
+  (setq label (concat "Unknown signature status: " status)))
  (t
-  (setq label (concat "Unknown signature status"
- (if status (concat ": " status))
-(insert-button
- (concat "[ " label " ]")
- :type 'notmuch-crypto-status-button-type
- 'help-echo help-msg
- 'face face
- 'mouse-face face
- 'action button-action
- :notmuch-sigstatus sigstatus
- :notmuch-from from)
-(insert "\n")))
+  (setq show-button nil)))
+(when show-button
+  (insert-button
+   (concat "[ " label " ]")
+   :type 'notmuch-crypto-status-button-type
+   'help-echo help-msg
+   'face face
+   'mouse-face face
+   'action button-action
+   :notmuch-sigstatus sigstatus
+   :notmuch-from from)
+  (insert "\n"
 
 (declare-function notmuch-show-refresh-view "notmuch-show" ( 
reset-state))
 
diff --git a/test/emacs-show.expected-output/notmuch-show-decrypted-message 
b/test/emacs-show.expected-output/notmuch-show-decrypted-message
index 08a9e4f6..c4ec4b32 100644
--- a/test/emacs-show.expected-output/notmuch-show-decrypted-message
+++ b/test/emacs-show.expected-output/notmuch-show-decrypted-message
@@ -5,7 +5,6 @@ Date: Sat, 01 Jan 2000 12:00:00 +
 
 [ multipart/encrypted ]
 [ Decryption successful ]
-[ Unknown signature status ]
 [ application/pgp-encrypted ]
 [ text/plain ]
 The password is "abcd1234!", please do not tell anyone.
diff --git 
a/test/emacs-show.expected-output/notmuch-show-decrypted-message-no-crypto 
b/test/emacs-show.expected-output/notmuch-show-decrypted-message-no-crypto
index e302e452..49d85337 100644
--- a/test/emacs-show.expected-output/notmuch-show-decrypted-message-no-crypto
+++ b/test/emacs-show.expected-output/notmuch-show-decrypted-message-no-crypto
@@ -5,6 +5,5 @@ Date: Sat, 01 Jan 2000 12:00:00 +
 
 [ multipart/encrypted ]
 [ Unknown encryption status ]
-[ Unknown signature status ]
 [ application/pgp-encrypted ]
 [ application/octet-stream ]
diff --git 
a/test/emacs-show.expected-output/notmuch-show-process-crypto-mime-parts-off 
b/test/emacs-show.expected-output/notmuch-show-process-crypto-mime-parts-off
index ce2892a0..3282c7b1 100644
--- a/test/emacs-show.expected-output/notmuch-show-process-crypto-mime-parts-off
+++ b/test/emacs-show.expected-output/notmuch-show-process-crypto-mime-parts-off
@@ -9,7 +9,6 @@ Subject: [notmuch] Working with Maildir storage?
 
   [ multipart/mixed ]
   [ multipart/signed ]
-  [ Unknown signature status ]
   [ text/plain ]
   > See the patch just posted here.
 
diff --git a/test/emacs-show.expected-output/notmuch-show-undecryptable-message 
b/test/emacs-show.expected-output/notmuch-show-undecryptable-message
index 530ff286..95c1646b 100644
--- a/test/emacs-show.expected-output/notmuch-show-undecryptable-message
+++ b/test/emacs-show.expected-output/notmuch-show-undecryptable-message
@@ -5,6 +5,5 @@ Date: Thu, 22 Dec 2016 08:34:56 -0400
 
 [ multipart/encrypted ]
 [ Decryption error ]
-[ Unknown signature status ]
 [ application/pgp-encrypted ]
 [ application/octet-stream ]
-- 
2.20.1

___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH 1/3] emacs: test notmuch-show during message decryption

2019-04-22 Thread Daniel Kahn Gillmor
We did not have a test showing what message decryption looks like
within notmuch-emacs.  This change gives us a baseline for future work
on the notmuch-emacs interface.
---
 test/T450-emacs-show.sh   | 15 ++
 test/corpora/crypto/basic-encrypted.eml   | 28 +++
 .../notmuch-show-decrypted-message| 11 
 .../notmuch-show-undecryptable-message| 10 +++
 4 files changed, 64 insertions(+)
 create mode 100644 test/corpora/crypto/basic-encrypted.eml
 create mode 100644 
test/emacs-show.expected-output/notmuch-show-decrypted-message
 create mode 100644 
test/emacs-show.expected-output/notmuch-show-undecryptable-message

diff --git a/test/T450-emacs-show.sh b/test/T450-emacs-show.sh
index 3555a939..5d4df443 100755
--- a/test/T450-emacs-show.sh
+++ b/test/T450-emacs-show.sh
@@ -208,4 +208,19 @@ test_emacs '(notmuch-show "id:'$gen_msg_id'")
 output=$(head -1 OUTPUT.raw|cut -f1-4 -d' ')
 test_expect_equal "$output" "Notmuch Test Suite "
 
+
+# switching to the crypto corpus, using gpg from here on:
+add_gnupg_home
+add_email_corpus crypto
+
+test_begin_subtest "show decrypted message"
+test_emacs '(notmuch-show "id:basic-encryp...@crypto.notmuchmail.org")
+(test-visible-output)'
+test_expect_equal_file $EXPECTED/notmuch-show-decrypted-message OUTPUT
+
+test_begin_subtest "show undecryptable message"
+test_emacs '(notmuch-show "id:simple-encryp...@crypto.notmuchmail.org")
+(test-visible-output)'
+test_expect_equal_file $EXPECTED/notmuch-show-undecryptable-message OUTPUT
+
 test_done
diff --git a/test/corpora/crypto/basic-encrypted.eml 
b/test/corpora/crypto/basic-encrypted.eml
new file mode 100644
index ..1ba4698a
--- /dev/null
+++ b/test/corpora/crypto/basic-encrypted.eml
@@ -0,0 +1,28 @@
+From: test_su...@notmuchmail.org
+To: test_su...@notmuchmail.org
+Subject: Here is the password
+Date: Sat, 01 Jan 2000 12:00:00 +
+Message-ID: 
+MIME-Version: 1.0
+Content-Type: multipart/encrypted; boundary="=-=-=";
+   protocol="application/pgp-encrypted"
+
+--=-=-=
+Content-Type: application/pgp-encrypted
+
+Version: 1
+
+--=-=-=
+Content-Type: application/octet-stream
+
+-BEGIN PGP MESSAGE-
+
+hIwDxE023q1UqxYBBACp70e7KPy9OYaheIrkLzmhq1lRqmy51aL1jBL0K/qN7rfK
+BZEG1cR8jeLjTFdPKPLVKJI80r7FgKI0ywvWvl6R1aE1Ty5BnVXT9XzCrEH7fqCl
+SKK82EvolXTohAZHUrh6K66eQQTTIAC1n7B0A8hErzkgaM4+seN3LlvezT6TLNKM
+ATpqsEbM2MVrGgw0b3oUsGGAPEt2MmjNEYsriKnqwt6dJDZc//XyhjgMQayiD8da
+N1gT3oqgu/gKCpBZDYzHf9OtVi2UnlFDWy6rrMZLjWDnIv4ve9Pn/qolwHVjzdJ1
+ZfjNC5t0z3XADKGrjN9wutr4qm7STW1rHAXHP68TQTxI0qgJKjPXNKWEw6g=
+=pJG4
+-END PGP MESSAGE-
+--=-=-=--
diff --git a/test/emacs-show.expected-output/notmuch-show-decrypted-message 
b/test/emacs-show.expected-output/notmuch-show-decrypted-message
new file mode 100644
index ..08a9e4f6
--- /dev/null
+++ b/test/emacs-show.expected-output/notmuch-show-decrypted-message
@@ -0,0 +1,11 @@
+test_su...@notmuchmail.org (2000-01-01) (encrypted inbox)
+Subject: Here is the password
+To: test_su...@notmuchmail.org
+Date: Sat, 01 Jan 2000 12:00:00 +
+
+[ multipart/encrypted ]
+[ Decryption successful ]
+[ Unknown signature status ]
+[ application/pgp-encrypted ]
+[ text/plain ]
+The password is "abcd1234!", please do not tell anyone.
diff --git a/test/emacs-show.expected-output/notmuch-show-undecryptable-message 
b/test/emacs-show.expected-output/notmuch-show-undecryptable-message
new file mode 100644
index ..530ff286
--- /dev/null
+++ b/test/emacs-show.expected-output/notmuch-show-undecryptable-message
@@ -0,0 +1,10 @@
+Daniel Kahn Gillmor  (2016-12-22) (encrypted inbox)
+Subject: encrypted message
+To: d...@fifthhorseman.net
+Date: Thu, 22 Dec 2016 08:34:56 -0400
+
+[ multipart/encrypted ]
+[ Decryption error ]
+[ Unknown signature status ]
+[ application/pgp-encrypted ]
+[ application/octet-stream ]
-- 
2.20.1

___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 3/3] emacs: Drop content-free "Unknown signature status" button

2019-04-22 Thread Daniel Kahn Gillmor
The first two patches in this series should be uncontroversial (they're
just establishing a baseline), and i'd appreciate it if they could be
considered for merging regardless of whether anyone raises an objection
to this last patch of the series.

On Mon 2019-04-22 13:18:14 -0400, Daniel Kahn Gillmor wrote:
> When we have not been able to evaluate the signature status of a given
> MIME part, showing a content-free (and interaction-free) "[ Unknown
> signature status ]" button doesn't really help the user at all, and
> takes up valuable screen real-estate.
>
> A visual reminder that a given message is *not* signed isn't helpful
> unless it is always present, in which case we'd want to see "[ Unknown
> signature status ]" buttons on all messages, even ones that don't have
> a signing structure, but i don't think we want that.

This is a small step down the path of making notmuch-emacs friendlier
with regards to encrypted messages, but it's one that will have an
effect on future patch series that work with encrypted messages.  I'd be
happy to hear any concerns people have about this change, but i find
notmuch-emacs is more pleasant to use this way.

 --dkg


signature.asc
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: bug#35370: notmuch-emacs: avoiding deprecated message-default-charset

2019-04-22 Thread Daniel Kahn Gillmor
Hi Eli--

Thanks for the prompt followup!

On Mon 2019-04-22 09:33:26 +0300, Eli Zaretskii wrote:
> [dkg wrote:]
>> Do you have any recommendation for how an external emacs module (which
>> aims to work with at emacs 25 as well at least) should handle this?
>
> Just remove any uses of it.  Why are you using it now?

in notmuch's emacs/notmuch-maildir-fcc.el, as mentioned at the beginning
of this thread:

https://git.notmuchmail.org/git?p=notmuch;a=blob;f=emacs/notmuch-maildir-fcc.el;h=1551e8b649102ccdfecad9a2ef278949bfb3d702;hb=HEAD#l172

If we remove that entry from the (let) block, what are the implications
for users of notmuch who are still using emacs 25?

I don't have much knowledge in the way of deep emacs or message-mode
internals, so if there's answer that's obvious to you that you think i'm
missing, feel free to just point me to it.  Thanks!

   --dkg


signature.asc
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch