[PATCH] test-lib.sh: colors to test output when parallel(1) is run on tty

2019-05-08 Thread Tomi Ollila
Done via $COLORS_WITHOUT_TTY environment variable as passing options
to commands through parallel(1) does not look trivial.

Reorganized color checking in test-lib.sh a bit for this (perhaps
were not fully necessary but rest still an improvement):

  - color checking commands in subshell are not run before arg parsing
(args may disable colors with --no-color)

  - [ -t 1 ] is checked before forking subshell
---
 test/notmuch-test |  1 +
 test/test-lib.sh  | 25 -
 2 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/test/notmuch-test b/test/notmuch-test
index bd3e080af01e..df10ccf22b04 100755
--- a/test/notmuch-test
+++ b/test/notmuch-test
@@ -41,6 +41,7 @@ fi
 trap 'e=$?; kill $!; exit $e' HUP INT TERM
 # Run the tests
 if test -z "$NOTMUCH_TEST_SERIALIZE" && command -v parallel >/dev/null ; then
+test -t 1 && export COLORS_WITHOUT_TTY=t || :
 if parallel -h | grep -q GNU ; then
 echo "INFO: running tests with GNU parallel"
 printf '%s\n' $TESTS | $TEST_TIMEOUT_CMD parallel
diff --git a/test/test-lib.sh b/test/test-lib.sh
index f5d367aae2d7..0a0004a5c7a3 100644
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -131,15 +131,7 @@ add_gnupg_home ()
 # '
 # . ./test-lib.sh || exit 1
 
-[ "x$ORIGINAL_TERM" != "xdumb" ] && (
-   TERM=$ORIGINAL_TERM &&
-   export TERM &&
-   [ -t 1 ] &&
-   tput bold >/dev/null 2>&1 &&
-   tput setaf 1 >/dev/null 2>&1 &&
-   tput sgr0 >/dev/null 2>&1
-   ) &&
-   color=t
+color=maybe
 
 while test "$#" -ne 0
 do
@@ -180,6 +172,21 @@ else
 }
 fi
 
+test -n "$COLORS_WITHOUT_TTY" || [ -t 1 ] || color=
+
+if [ -n "$color" ] && [ "$ORIGINAL_TERM" != 'dumb' ] && (
+   TERM=$ORIGINAL_TERM &&
+   export TERM &&
+   tput bold
+   tput setaf
+   tput sgr0
+   ) >/dev/null 2>&1
+then
+   color=t
+else
+   color=
+fi
+
 if test -n "$color"; then
say_color () {
(
-- 
2.13.3

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


[BUG] emacs: notmuch-mua-attachment-check finds triggering string inside forwarded messages

2019-05-08 Thread Örjan Ekeberg
Hi all,

I have found what seems to be a bug, or at least a misbehaviour of the
"missing attachment warning" implemented by the otherwise so nice
notmuch-mua-attachment-check.

It works fine to detect the regexp for attachments in simple messages.
The problem is that it also triggers the warning if a matching string is
present inside a forwarded message.  This is particularly annoying when
forwarding messages originating from MS-Exchange since those seem to
always include a hidden header "X-MS-Has-Attach" where the word "Attach"
constantly leads to false missing-attachment warnings.

Would it be possible to somehow restrict the regexp search to the part
of the message actually being authored?  Would it be too simplistic to
end the search at the first occurrence of "\n\n<#" ?

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


[WIP PATCH] test: make test-serially to run test serially

2019-05-08 Thread Tomi Ollila
This is easier and less error prone than mistyping NOTMUCH_TEST_SERIALIZE
manually from command line (mistype make test-serially and it just doesn't
work)
---

quick first version. this works, but someone(tm) w/ native english experience
could say how the naming sounds like...

 test/Makefile.local | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/test/Makefile.local b/test/Makefile.local
index 47244e8f0956..3c5e7e9cf33b 100644
--- a/test/Makefile.local
+++ b/test/Makefile.local
@@ -76,6 +76,9 @@ else
 endif
 endif
 
+test-serially: export NOTMUCH_TEST_SERIALIZE=t
+test-serially: test
+
 check: test
 
 SRCS := $(SRCS) $(test_srcs)
-- 
2.13.3

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


Re: [PATCH] test: let the OS choose a port for smtp-dummy

2019-05-08 Thread Tomi Ollila
On Tue, May 07 2019, Daniel Kahn Gillmor wrote:

> On Tue 2019-05-07 07:20:49 -0300, David Bremner wrote:
>> This should avoid potential collisions if we start running multiple
>> smtp-dummy processes in parallel.
>
> This is excellent, simple, and clearly the right thing to do.  I've
> reviewed it, and am running it on my own development branch with no
> problems.  Thanks, Bremner!
>
> please merge.

i second that, please do!

Tomi


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


Re: [PATCH] test: avoid unnecessary extraction of the test fingerprint

2019-05-08 Thread Tomi Ollila
On Tue, May 07 2019, Daniel Kahn Gillmor wrote:

> FINGERPRINT is already exported by add_gnupg_home, so this is
> unnecessary.  This change also happens to get rid of the superfluous
> check-trustdb spew from the test suite that looked like this:
>
> gpg: checking the trustdb
> gpg: marginals needed: 3  completes needed: 1  trust model: pgp
> gpg: depth: 0  valid:   1  signed:   0  trust: 0-, 0q, 0n, 0m, 0f, 1u
>
> Signed-off-by: Daniel Kahn Gillmor 

LGTM (just quick glance -- but code removal is always good thing when
possible ! ;)

(I trust dkg knows what he is doing in this matter)

Tomi

> ---
>  test/T357-index-decryption.sh | 2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/test/T357-index-decryption.sh b/test/T357-index-decryption.sh
> index c9cd5e30..8a2d4c02 100755
> --- a/test/T357-index-decryption.sh
> +++ b/test/T357-index-decryption.sh
> @@ -8,8 +8,6 @@ test_description='indexing decrypted mail'
>  ##
>  
>  add_gnupg_home
> -# get key fingerprint
> -FINGERPRINT=$(gpg --no-tty --list-secret-keys --with-colons --fingerprint | 
> grep '^fpr:' | cut -d: -f10)
>  
>  # create a test encrypted message
>  test_begin_subtest 'emacs delivery of encrypted message'
> -- 
> 2.20.1
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


notmuch vim failing to show rfc822 attachments

2019-05-08 Thread Kay
Dear notmuchers,

I've recently switched to using notmuch for mail management and I like
it so far. The only thing stopping me from full joy is that neither alot
nor the notmuch vim frontend can display message/rfc822 attachments.

When I open the mails containing rfc822 attachments in alot, their
content is shown, but their metadata is lost. When I try to open the
messages in the notmuch vim frontend, I get the following error

Error detected while processing function
20_search_show_thread[10]..20_show:
line   39:
NoMethodError: undefined method `mime_type' for nil:NilClass

After pressing enter thereafter, I see the mail but none of the rfc822
attachments. Mutt shows the attachments plus their headers flawlessly.

I'm using the current notmuch-vim version I pulled today alongside
notmuch 0.21. I tested the same thing using notmuch and alot with
current packages in the Arch repositories of both and alot did not
show the message headers, as mentioned above.

Thank you in advance,
Kay
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


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

2019-05-08 Thread Noam Postavsky
Eli Zaretskii  writes:

>> 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?

Should we remove the remaining uses of it from Emacs too?

>From a3dca9511e1639ccfdf06bced16af5babb5078de Mon Sep 17 00:00:00 2001
From: Noam Postavsky 
Date: Tue, 7 May 2019 08:18:49 -0400
Subject: [PATCH] Stop using message-default-charset (Bug#35370)

In 2016-02-14 "Remove compat code for older Emacsen",
message-default-charset was obsoleted, and a couple of uses were
removed, but others were left behind.
* lisp/gnus/message.el (message-send-mail)
(message-send-news, message-do-fcc)
(message-encode-message-body):
* lisp/gnus/mml.el (mml-to-mime): Stop using message-default-charset.
---
 lisp/gnus/message.el | 13 -
 lisp/gnus/mml.el |  4 +---
 2 files changed, 5 insertions(+), 12 deletions(-)

diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el
index c8b6f0ee68..2c2122d89a 100644
--- a/lisp/gnus/message.el
+++ b/lisp/gnus/message.el
@@ -4588,8 +4588,7 @@ (defun message-send-mail ( _)
  (message-generate-headers '(Lines)))
;; Remove some headers.
(message-remove-header message-ignored-mail-headers t)
-   (let ((mail-parse-charset message-default-charset))
- (mail-encode-encoded-word-buffer)))
+(mail-encode-encoded-word-buffer))
  (goto-char (point-max))
  ;; require one newline at the end.
  (or (= (preceding-char) ?\n)
@@ -4962,8 +4961,7 @@ (defun message-send-news ( arg)
  (message-generate-headers '(Lines)))
;; Remove some headers.
(message-remove-header message-ignored-news-headers t)
-   (let ((mail-parse-charset message-default-charset))
- (mail-encode-encoded-word-buffer)))
+(mail-encode-encoded-word-buffer))
  (goto-char (point-max))
  ;; require one newline at the end.
  (or (= (preceding-char) ?\n)
@@ -5441,8 +5439,7 @@ (defun message-do-fcc ()
  (while (setq file (message-fetch-field "fcc" t))
(push file list)
(message-remove-header "fcc" nil t))
- (let ((mail-parse-charset message-default-charset)
-   (rfc2047-header-encoding-alist
+  (let ((rfc2047-header-encoding-alist
 (cons '("Newsgroups" . default)
   rfc2047-header-encoding-alist)))
(mail-encode-encoded-word-buffer)))
@@ -8101,9 +8098,7 @@ (defun message-clone-locals (buffer  varstr)
 
 (defun message-encode-message-body ()
   (unless message-inhibit-body-encoding
-(let ((mail-parse-charset (or mail-parse-charset
- message-default-charset))
- (case-fold-search t)
+(let ((case-fold-search t)
  lines content-type-p)
   (message-goto-body)
   (save-restriction
diff --git a/lisp/gnus/mml.el b/lisp/gnus/mml.el
index f6d358dfc0..7a99a0dc46 100644
--- a/lisp/gnus/mml.el
+++ b/lisp/gnus/mml.el
@@ -48,7 +48,6 @@ (autoload 'message-mail-p "message")
 
 (defvar gnus-article-mime-handles)
 (defvar gnus-newsrc-hashtb)
-(defvar message-default-charset)
 (defvar message-deletable-headers)
 (defvar message-options)
 (defvar message-posting-charset)
@@ -1015,8 +1014,7 @@ (defun mml-to-mime ()
 ;; Skip past any From_ headers.
 (while (looking-at "From ")
   (forward-line 1))
-(let ((mail-parse-charset message-default-charset))
-  (mail-encode-encoded-word-buffer)))
+(mail-encode-encoded-word-buffer))
   (message-encode-message-body))
 
 (defun mml-insert-mime (handle  no-markup)
-- 
2.11.0

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


Re: [PATCH 2/2] emacs: Allow tagging regions in notmuch-tree

2019-05-08 Thread David Bremner


Thanks for contributing to Notmuch. Some generic comments:

1) Please consider a more comprehensive commit message [1].  The "why"
   here is maybe obvious, but consider pointing out whether this makes
   it more consistent with other parts of the UI (or not). Also, a (bit
   more extended) of the changes is always helpful, both to help read
   the diff and to warn of any potential breaking changes.

2) Please update doc/notmuch-emacs.rst.  You can re-use docstrings; let
   me know if you need help doing that. We haven't been strict about
   this is in the past, but the emacs docs are really lagging.

3) We generally want at least one test for a new
   feature. test/T460-emacs-tree.sh has the existing tree related
   tests. Again, if you need help with the test suite, let us know.

4) Please use notmuch-tree-- as a prefix for new private symbols that
   users should not rely on. I'm not sure about which symbols that applies
   to here.

[1] https://notmuchmail.org/contributing/#index5h2

Pierre Neidhardt  writes:

> +(defun notmuch-tree-foreach-result (beg end fn)

> +  (lexical-let ((pos (notmuch-tree-result-beginning beg))

As an aside, I'm curious if we can profitably start to use
file level lexical-binding for parts of notmuch-emacs.

> +  (notmuch-tree-foreach-result beg end
> +(lambda (pos)
> +  (save-mark-and-excursion

I did wonder if notmuch-tree-foreach-result should be a macro. I'm not
sure if the small gain in code compactness from just passing a "body" in
the style of notmuch-show--with-currently-shown-message is worth it.

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