Re: Looking for help re: inbox/thread/tree slowdown; misconfiguration?

2020-07-27 Thread David Bremner
jonat...@teamwilner.com writes:

> I've got about 52K items with the tag "inbox". Should be "notmuch"
> right? :-) Here's the problem - if I want to view that in tree view,
> it can take multiple minutes for notmuch to return a result.

In general there should be some results right away, with the rest of the
buffer being filled asynchronously. Unfortunately notmuch-emacs only
handles the one asynchronous query, so if there is already a long
running query, you will indeed have to wait for the whole tree/list of
headers to be read into emacs.


> More critically, if I choose an item in the inbox that has even two
> messages in a thread-selecting it and wanting to see it in a tree
> appears to wind up with all messages getting re-indexed. I can't see
> the two messages for a good 2-4 minutes, unless I kill the notmuch
> process that's running in the background. The process indicates that
> notmuch is running through the whole inbox.

Hmm. I can't completely follow this. Are you talking about using Z from
notmuch-show-mode, or something else?
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH v2] configure: check for pytest with python -m pytest

2020-07-27 Thread Đoàn Trần Công Danh
On 2020-07-27 20:37:10+0300, Tomi Ollila  wrote:
> On Mon, Jul 27 2020, Đoàn Trần Công Danh wrote:
> 
> > On different distro, pytest is suffixed with different patterns.
> > Try to account for them, now.
> >
> > Signed-off-by: Đoàn Trần Công Danh 
> > ---
> >  configure | 13 +
> >  1 file changed, 9 insertions(+), 4 deletions(-)
> >
> > diff --git a/configure b/configure
> > index db3538b3..90bc9182 100755
> > --- a/configure
> > +++ b/configure
> > @@ -814,10 +814,15 @@ if [ $have_python3 -eq 1 ]; then
> >  printf "Checking for python3 pytest (>= 3.0)... "
> >  conf=$(mktemp)
> >  printf "[pytest]\nminversion=3.0\n" > $conf
> > -if pytest-3 -c $conf --version >/dev/null 2>&1; then
> > -printf "Yes.\n"
> > -have_python3_pytest=1
> > -else
> > +for _pytest_cmd in pytest-3 pytest3; do
> 
> We use `${NOTMUCH_PYTHON} -m pytest` in tests to run the python
> tests. IMO it would be better to change this check to do the
> same with already resolved python3 command.

Yes, that's definitely better option, I also use that command in other
code base, but forgot to take it here.

This is the updated patch:
---8<--
From c6d8681d467bef9fe43c039ed1e2e467b99b6c56 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 
Date: Mon, 27 Jul 2020 16:42:02 +0700
Subject: [PATCH v2] configure: check for pytest with python -m pytest
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

On different distro, pytest is suffixed with different patterns.

On the other hand, `python3-pytest' could be invoked correctly,
via `python3 -m pytest', the latter is used by our tests, now.

Switch to `$python -m pytest` to fix address all incompatible naming.

Signed-off-by: Đoàn Trần Công Danh 
---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index db3538b3..f7c1c095 100755
--- a/configure
+++ b/configure
@@ -814,7 +814,7 @@ if [ $have_python3 -eq 1 ]; then
 printf "Checking for python3 pytest (>= 3.0)... "
 conf=$(mktemp)
 printf "[pytest]\nminversion=3.0\n" > $conf
-if pytest-3 -c $conf --version >/dev/null 2>&1; then
+if "$python" -m pytest -c $conf --version >/dev/null 2>&1; then
 printf "Yes.\n"
 have_python3_pytest=1
 else
-- 
2.28.0.rc2.21.g5c06d60fc5
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH] configure: detect version by compiler for build

2020-07-27 Thread Đoàn Trần Công Danh
On 2020-07-27 20:31:59+0300, Tomi Ollila  wrote:
> On Mon, Jul 27 2020, Đoàn Trần Công Danh wrote:
> 
> > We'll need to run the compiled binary to report our current version.
> >
> > With the same code base, we should have the same version information
> > regardless of compiler and architecture.
> >
> > Let's use the compiler for building architecture to build the reporting
> > binary. Which is usually reported under variable CC_FOR_BUILD,
> > a convention established by GNU Autotools, and fall back to CC if it's
> > not defined.
> 
> We'd probably need to change quite a few other compiled and run binaries
> in configure... otherwise this would be incomplete change (and thus just
> adds confusion ?)

Other compile and try run linked with libraries in (autotools') host
architecture.

Linking with build's libraries doesn't make sense, hence I ignored it.
And patched downstream.

I don't mind dropping this change and carry it downstream.

> 
> >
> > Signed-off-by: Đoàn Trần Công Danh 
> > ---
> >  configure | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/configure b/configure
> > index 98f5f1ea..db3538b3 100755
> > --- a/configure
> > +++ b/configure
> > @@ -85,8 +85,10 @@ fi
> >  BASHCMD=${BASHCMD:-bash}
> >  PERL=${PERL:-perl}
> >  CC=${CC:-cc}
> > +CC_FOR_BUILD=${CC_FOR_BUILD:-$CC}
> >  CXX=${CXX:-c++}
> >  CFLAGS=${CFLAGS:--g -O2}
> > +CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD:-$CFLAGS}
> >  CPPFLAGS=${CPPFLAGS:-}
> >  CXXFLAGS_for_sh=${CXXFLAGS:-${CFLAGS}}
> >  CXXFLAGS=${CXXFLAGS:-\$(CFLAGS)}
> > @@ -410,7 +412,7 @@ int main(void) {
> >  return 0;
> >  }
> >  EOF
> > -if ${CC} ${CFLAGS} -I"$srcdir" _libversion.c -o _libversion > /dev/null 
> > 2>&1 \
> > +if ${CC_FOR_BUILD} ${CFLAGS_FOR_BUILD} -I"$srcdir" _libversion.c -o 
> > _libversion > /dev/null 2>&1 \
> > && ./_libversion > _libversion.sh && . ./_libversion.sh
> >  then
> >  printf "OK.\n"
> > -- 
> > 2.28.0.rc2.21.g5c06d60fc5
> > ___
> > notmuch mailing list -- notmuch@notmuchmail.org
> > To unsubscribe send an email to notmuch-le...@notmuchmail.org

-- 
Danh
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH] T355: specify hash algorithm explicitly

2020-07-27 Thread Đoàn Trần Công Danh
On 2020-07-27 20:40:39+0300, Tomi Ollila  wrote:
> On Mon, Jul 27 2020, Đoàn Trần Công Danh wrote:
> 
> > On some systems (notably, the one shipped with LibreSSL),
> > default fingerprint digest algorithm is SHA256.
> >
> > On other systems, users can change default digest algorithm by changing
> > default_md in /etc/ssl/default_md.
> >
> > Let's ask openssl to provide us specific algorithm to make the test
> > more deterministic.
> >
> > Signed-off-by: Đoàn Trần Công Danh 
> > ---
> >  test/T355-smime.sh | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/test/T355-smime.sh b/test/T355-smime.sh
> > index f8cec62c..8b2b52be 100755
> > --- a/test/T355-smime.sh
> > +++ b/test/T355-smime.sh
> > @@ -6,7 +6,7 @@ test_description='S/MIME signature verification and 
> > decryption'
> >  test_require_external_prereq openssl
> >  test_require_external_prereq gpgsm
> >  
> > -FINGERPRINT=$(openssl x509 -fingerprint -in 
> > "$NOTMUCH_SRCDIR/test/smime/key+cert.pem" -noout | sed -e 's/^.*=//' -e 
> > s/://g)
> > +FINGERPRINT=$(openssl x509 -sha1 -fingerprint -in 
> > "$NOTMUCH_SRCDIR/test/smime/key+cert.pem" -noout | sed -e 's/^.*=//' -e 
> > s/://g)
> 
> Looks good to me -- provided that this `-sha1` option is known by all
> openssl(1) commmands we expect to be supported...

If you meant commands as is version and clone, it should be good.
Since -sha1 has been known to openssl as far as 
9868232ae1 (Initial trust code: allow setting of trust checking
functions in a table. Doesn't do too much yet., 1999-11-27), [1]

And it's still available in OpenSSL 3.0.0 alpha 5.

LibreSSL is forked from OpenSSL 1.0.1g and the current version also
supported that option.

So, I think we should be fine.

[1]: 
https://github.com/openssl/openssl/commit/9868232ae1#diff-f48b02166abaa1faa6c10358046a8fb2R125

-- 
Danh
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Looking for help re: inbox/thread/tree slowdown; misconfiguration?

2020-07-27 Thread jonathan
Hi all,

I'm recently returning to notmuch after a few years of using mu4e. I'm thrilled 
to be back - the tag based workflow is fantastic!

However, I'm hitting a problem with tree-mode/threading that I can't seem to 
solve. I am hoping the folks on this list might have some suggestions.

I've got about 52K items with the tag "inbox". Should be "notmuch" right? :-)  
Here's the problem - if I want to view that in tree view, it can take multiple 
minutes for
notmuch to return a result.

More critically, if I choose an item in the inbox that has even two messages in 
a thread-selecting it and wanting to see it in a tree appears to wind up with 
all messages
getting re-indexed. I can't see the two messages for a good 2-4 minutes, unless 
I kill the notmuch process that's running in the background. The process 
indicates that
notmuch is running through the whole inbox.

I accept that I am not doing a great job describing the bug (if it is one!) - 
but I am hoping someone on this list can minimally point me in right area to 
either provide
more debug info or how to optimize my config.

Thanks!
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH 07/23] emacs: Use 'and' instead of 'when' when the return value matters

2020-07-27 Thread Jonas Bernoulli
Sean Whitton  writes:

> Hello,
>
> On Mon 27 Jul 2020 at 12:02AM +02, Jonas Bernoulli wrote:
>
>> Sean Whitton  writes:
>>
>>> On Sun 26 Jul 2020 at 06:58PM +02, Jonas Bernoulli wrote:
>>>
 Also do so for some 'if' forms that lack an ELSE part.
 Even go as far as using 'and' and 'not' instead of 'unless'.
>>>
>>> I don't follow "when the return value matters", could you explain?
>>
>> As in "when the caller consumes the returned value".  The alternative
>> would be for the caller to not care about the value returned by the
>> callee and to instead call it for the side-effects only.
>>
>> By using `and' we can signal that care about the return value and by
>> using `when' that we care about the side-effects instead.
>
> Thank you for your reply.  Just to confirm, this is just a convention,
> right?  I hadn't come across it yet.

Yes, just a convention.

Here's one place that talks about this convention:
https://emacs.stackexchange.com/questions/14195/and-vs-when-for-conditionals
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH 02/23] emacs: Remove excess empty lines

2020-07-27 Thread Jonas Bernoulli
Tomi Ollila  writes:

> On Sun, Jul 26 2020, Jonas Bernoulli wrote:
>>  ;; Outer single and double quotes, which might be nested.
>>  (cl-loop with start-of-loop
>> - do (setq start-of-loop p-name)
>> -
>> + do   (setq start-of-loop p-name)
>>   when (string-match "^\"\\(.*\\)\"$" p-name)
>> - do (setq p-name (match-string 1 p-name))
>> -
>> + do   (setq p-name (match-string 1 p-name))
>>   when (string-match "^'\\(.*\\)'$" p-name)
>> - do (setq p-name (match-string 1 p-name))
>> -
>> + do   (setq p-name (match-string 1 p-name))
>>   until (string= start-of-loop p-name)))

> These changes in spaces after `do` I don't understand...

IMO it looks a bit better when aligned with the `when' lines.  Since
these lines alternate with the lines that I modified because of the
stated reason of this commit, I felt that it was appropriate to make
this change as well.

But the alignment is an improvement is subjective and I would be happy
to change this.  I don't feel strongly about it.
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH 01/23] emacs: Shorten long lines

2020-07-27 Thread Jonas Bernoulli
Tomi Ollila  writes:

> On Sun, Jul 26 2020, Jonas Bernoulli wrote:

>>  (defun notmuch-maildir-add-file-style-fcc-header (subdir)
>> @@ -249,9 +250,8 @@ (defun notmuch-maildir-fcc-with-notmuch-insert 
>> (fcc-header  create)
>>;; typo, or just the user want a new folder, let the user decide
>>;; how to deal with it.
>>(error
>> -   (let ((response (notmuch-read-char-choice
>> -"Insert failed: (r)etry, (c)reate folder, (i)gnore, or 
>> (e)dit the header? "
>> -'(?r ?c ?i ?e
>> +   (let ((response (notmuch-read-char-choice "Insert failed: \
>> +\(r)etry, (c)reate folder, (i)gnore, or (e)dit the header? " '(?r ?c ?i 
>> ?e
>
> Otherwise looks good, but what are these backslashes before (:s in line
> above

This is necessary because `outline-minor-mode' (and I believe also
commands that move by s-expression) for performance reasons just assume
that any parenthesis at the beginning of a line marks the beginning of
a top-level expression.  To signal that that is not the case one has to
quote the paren.
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH 1/3] gitignore: Ignore generated sphinx.config

2020-07-27 Thread Jonas Bernoulli
Tomi Ollila  writes:

> On Sun, Jul 26 2020, Jonas Bernoulli wrote:
>
>> ---
>>  .gitignore | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/.gitignore b/.gitignore
>> index 1c8705ec..8f3ebec0 100644
>> --- a/.gitignore
>> +++ b/.gitignore
>> @@ -17,3 +17,4 @@ tags
>>  /.stamps
>>  *.stamp
>>  /bindings/python-cffi/build/
>> +/sphinx.config
>
> This could have been listed after sh.config...

I was unable to detect any order in the existing data so I placed it
at the end.  I'd be happy to place it somewhere else but I think the
existing data should just be sorted consistently.  If that happens
before or after this commit doesn't really matter.

 Jonas
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH] notmuch-mutt: replace shell pipeline with internal pipe processing

2020-07-27 Thread Tomi Ollila
The shell pipeline used to symlink files based in search results
to "cache" directory for mutt(1) to use was prone to portability
problems (due to /bin/sh differences).

The replacement executes `notmuch search` without intermediate shell
(so shell_quote was removed in this case), reads the filenames from
piped output and symlinks files internally.
---

Now also tested a bit by me (remoteusage provides stale symlinks ;)

 contrib/notmuch-mutt/notmuch-mutt | 18 ++
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/contrib/notmuch-mutt/notmuch-mutt 
b/contrib/notmuch-mutt/notmuch-mutt
index d33223bd..d1e2c084 100755
--- a/contrib/notmuch-mutt/notmuch-mutt
+++ b/contrib/notmuch-mutt/notmuch-mutt
@@ -12,6 +12,7 @@ use strict;
 use warnings;
 
 use File::Path;
+use File::Basename;
 use Getopt::Long qw(:config no_getopt_compat);
 use Mail::Header;
 use Mail::Box::Maildir;
@@ -41,16 +42,17 @@ sub search($$$) {
 my ($maildir, $remove_dups, $query) = @_;
 my $dup_option = "";
 
-$query = shell_quote($query);
-
-if ($remove_dups) {
-  $dup_option = "--duplicate=1";
-}
+my @args = qw/notmuch search --output=files/;
+push @args, "--duplicate=1" if $remove_dups;
+push @args, $query;
 
 empty_maildir($maildir);
-system("notmuch search --output=files $dup_option $query"
-  . " | sed -e 's: : :g'"
-  . " | while IFS= read -r searchoutput; do ln -s \$searchoutput 
$maildir/cur/; done");
+open my $pipe, '-|', @args or die "Running @args failed: $!\n";
+while (<$pipe>) {
+   chomp;
+   my $ln = "$maildir/cur/" . basename $_;
+   symlink $_, "$ln" or warn "Failed to symlink '$_', '$ln': $!\n";
+}
 }
 
 sub prompt($$) {
-- 
2.25.1
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH 1/3] gitignore: Ignore generated sphinx.config

2020-07-27 Thread Tomi Ollila
On Sun, Jul 26 2020, Jonas Bernoulli wrote:

> ---
>  .gitignore | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/.gitignore b/.gitignore
> index 1c8705ec..8f3ebec0 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -17,3 +17,4 @@ tags
>  /.stamps
>  *.stamp
>  /bindings/python-cffi/build/
> +/sphinx.config

This could have been listed after sh.config...

Tomi

> -- 
> 2.26.0
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH 02/23] emacs: Remove excess empty lines

2020-07-27 Thread Tomi Ollila
On Sun, Jul 26 2020, Jonas Bernoulli wrote:

> Most people who write lots of lisp tend to only sparsely use empty
> "separator" lines within forms.  In lisp they feel unnecessary and
> since most files stick to this convention we get a bit confused
> when there are extra empty lines.  It feels like the s-expressions
> are falling into pieces.
>
> All of this is especially true between a function's doc-string and
> body because the doc-string is colored differently, which visually
> already separates it quite sufficiently from the code that follows.
> ---
>  emacs/make-deps.el   |  2 -
>  emacs/notmuch-address.el |  2 -
>  emacs/notmuch-crypto.el  |  4 --
>  emacs/notmuch-hello.el   | 18 -
>  emacs/notmuch-jump.el|  5 ---
>  emacs/notmuch-lib.el | 10 -
>  emacs/notmuch-maildir-fcc.el |  7 
>  emacs/notmuch-mua.el | 26 -
>  emacs/notmuch-parser.el  |  5 ---
>  emacs/notmuch-show.el| 75 ++--
>  emacs/notmuch-tag.el |  3 --
>  emacs/notmuch-tree.el|  9 -
>  emacs/notmuch-wash.el| 18 +
>  emacs/notmuch.el |  7 
>  14 files changed, 5 insertions(+), 186 deletions(-)
>
> diff --git a/emacs/make-deps.el b/emacs/make-deps.el
> index 5b6db698..dcac319c 100644
> --- a/emacs/make-deps.el
> +++ b/emacs/make-deps.el
> @@ -23,7 +23,6 @@
>  
>  (defun batch-make-deps ()
>"Invoke `make-deps' for each file on the command line."
> -
>(setq debug-on-error t)
>(dolist (file command-line-args-left)
>  (let ((default-directory command-line-default-directory))
> @@ -37,7 +36,6 @@ (defun make-deps ( dir)
>  This prints make dependencies to `standard-output' based on the
>  top-level `require' expressions in the current buffer.  Paths in
>  rules will be given relative to DIR, or `default-directory'."
> -
>(setq dir (or dir default-directory))
>(save-excursion
>  (goto-char (point-min))
> diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el
> index 2a9c411a..ca4da3f3 100644
> --- a/emacs/notmuch-address.el
> +++ b/emacs/notmuch-address.el
> @@ -302,7 +302,6 @@ (defun notmuch-address-harvest ( addr-prefix 
> synchronous callback)
>  Address harvesting may take some time so the address collection runs
>  asynchronously unless SYNCHRONOUS is t. In case of asynchronous
>  execution, CALLBACK is called when harvesting finishes."
> -
>(let* ((sent (eq (car notmuch-address-internal-completion) 'sent))
>(config-query (cadr notmuch-address-internal-completion))
>(prefix-query (when addr-prefix
> @@ -335,7 +334,6 @@ (defun notmuch-address-harvest ( addr-prefix 
> synchronous callback)
>   ;; Kill any existing process
>   (when current-proc
> (kill-buffer (process-buffer current-proc))) ; this also kills the 
> process
> -
>   (setq current-proc
> (apply 'notmuch-start-notmuch proc-name proc-buf
>callback   ; process sentinel
> diff --git a/emacs/notmuch-crypto.el b/emacs/notmuch-crypto.el
> index 2327ff1f..58947a20 100644
> --- a/emacs/notmuch-crypto.el
> +++ b/emacs/notmuch-crypto.el
> @@ -123,17 +123,14 @@ (defun notmuch-crypto-insert-sigstatus-button 
> (sigstatus from)
>   face 'notmuch-crypto-signature-good-key))
>   (setq button-action 'notmuch-crypto-sigstatus-good-callback
> help-msg (concat "Click to list key ID 0x" fingerprint "."
> -
>   ((string= status "error")
>(setq label (concat "Unknown key ID " keyid " or unsupported 
> algorithm")
>   button-action 'notmuch-crypto-sigstatus-error-callback
>   help-msg (concat "Click to retrieve key ID " keyid
>" from keyserver.")))
> -
>   ((string= status "bad")
>(setq label (concat "Bad signature (claimed key ID " keyid ")")
>   face 'notmuch-crypto-signature-bad))
> -
>   (status
>(setq label (concat "Unknown signature status: " status)))
>   (t
> @@ -232,7 +229,6 @@ (defun notmuch-crypto-sigstatus-error-callback (button)
>   (process-put p :notmuch-show-buffer (current-buffer))
>   (process-put p :notmuch-show-point (point))
>   (message "Getting the GPG key %s asynchronously..." keyid)))
> -
>(let ((window (display-buffer buffer)))
>   (with-selected-window window
> (with-current-buffer buffer
> diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
> index 11c625ea..e71e55f3 100644
> --- a/emacs/notmuch-hello.el
> +++ b/emacs/notmuch-hello.el
> @@ -150,7 +150,6 @@ (defcustom notmuch-saved-searches
>  ;; The saved-search format is also used by the all-tags notmuch-hello
>  ;; section. This section generates its own saved-search list in one of
>  ;; the latter two forms.
> -
>:get 'notmuch-hello--saved-searches-to-plist
>:type '(repeat notmuch-saved-search-plist)
>:tag "List of Saved Searches"
> @@ 

Re: [PATCH 01/23] emacs: Shorten long lines

2020-07-27 Thread Tomi Ollila
On Sun, Jul 26 2020, Jonas Bernoulli wrote:

> ---
>  emacs/coolj.el   |   2 +-
>  emacs/notmuch-address.el |  38 +++--
>  emacs/notmuch-company.el |  17 --
>  emacs/notmuch-crypto.el  |  16 +++---
>  emacs/notmuch-draft.el   |  12 ++--
>  emacs/notmuch-hello.el   |  43 ++-
>  emacs/notmuch-jump.el|   7 ++-
>  emacs/notmuch-lib.el |  62 +
>  emacs/notmuch-maildir-fcc.el |  14 ++---
>  emacs/notmuch-message.el |   3 +-
>  emacs/notmuch-mua.el |  78 +++---
>  emacs/notmuch-show.el| 103 +++
>  emacs/notmuch-tag.el |  14 +++--
>  emacs/notmuch-tree.el|  55 +--
>  emacs/notmuch-wash.el|  19 +--
>  emacs/notmuch.el |  27 ++---
>  emacs/rstdoc.el  |   3 +-
>  17 files changed, 326 insertions(+), 187 deletions(-)
>
> diff --git a/emacs/coolj.el b/emacs/coolj.el
> index 350d537f..5d311170 100644
> --- a/emacs/coolj.el
> +++ b/emacs/coolj.el
> @@ -1,6 +1,6 @@
>  ;;; coolj.el --- automatically wrap long lines  -*- coding:utf-8 -*-
>  
> -;; Copyright (C) 2000, 2001, 2004, 2005, 2006, 2007, 2008, 2009 Free 
> Software Foundation, Inc.
> +;; Copyright (C) 2000, 2001, 2004-2009 Free Software Foundation, Inc.
>  
>  ;; Authors:Kai Grossjohann 
>  ;; Alex Schroeder 
> diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el
> index 0d56fba7..2a9c411a 100644
> --- a/emacs/notmuch-address.el
> +++ b/emacs/notmuch-address.el
> @@ -195,10 +195,11 @@ (defun notmuch-address-options (original)
> ((eq notmuch-address-command 'internal)
>  (unless (notmuch-address--harvest-ready)
>;; First, run quick synchronous harvest based on what the user
> -  ;; entered so far
> +  ;; entered so far.
>(notmuch-address-harvest original t))
>  (prog1 (notmuch-address-matching original)
> -  ;; Then start the (potentially long-running) full asynchronous harvest 
> if necessary
> +  ;; Then start the (potentially long-running) full asynchronous
> +  ;; harvest if necessary.
>(notmuch-address-harvest-trigger)))
> (t
>  (process-lines notmuch-address-command original
> @@ -241,7 +242,8 @@ (defun notmuch-address-expand-name ()
>   (push chosen notmuch-address-history)
>   (delete-region beg end)
>   (insert chosen)
> - (run-hook-with-args 'notmuch-address-post-completion-functions 
> chosen))
> + (run-hook-with-args 'notmuch-address-post-completion-functions
> + chosen))
>   (message "No matches.")
>   (ding
> (t nil)))
> @@ -393,10 +395,11 @@ (defun notmuch-address--save-address-hash ()
> ;; The file exists, check it is a file we saved
>   (notmuch-address--get-address-hash))
>   (with-temp-file notmuch-address-save-filename
> -   (let ((save-plist (list :version notmuch-address--save-hash-version
> -   :completion-settings 
> notmuch-address-internal-completion
> -   :last-harvest notmuch-address-last-harvest
> -   :completions notmuch-address-completions)))
> +   (let ((save-plist
> +  (list :version notmuch-address--save-hash-version
> +:completion-settings notmuch-address-internal-completion
> +:last-harvest notmuch-address-last-harvest
> +:completions notmuch-address-completions)))
>   (print "notmuch-address-hash" (current-buffer))
>   (print save-plist (current-buffer
>(message "\
> @@ -408,16 +411,17 @@ (defun notmuch-address-harvest-trigger ()
>(let ((now (float-time)))
>  (when (> (- now notmuch-address-last-harvest) 86400)
>(setq notmuch-address-last-harvest now)
> -  (notmuch-address-harvest nil nil
> -(lambda (proc event)
> -  ;; If harvest fails, we want to try
> -  ;; again when the trigger is next
> -  ;; called
> -  (if (string= event "finished\n")
> -  (progn
> -(notmuch-address--save-address-hash)
> -(setq 
> notmuch-address-full-harvest-finished t))
> -(setq notmuch-address-last-harvest 0)))
> +  (notmuch-address-harvest
> +   nil nil
> +   (lambda (proc event)
> +  ;; If harvest fails, we want to try
> +  ;; again when the trigger is next
> +  ;; called
> +  (if (string= event "finished\n")
> +  (progn
> +(notmuch-address--save-address-hash)
> +(setq notmuch-address-full-harvest-finished t))
> +(setq notmuch-address-last-harvest 0)))
>  
>  ;;
>  

Re: [PATCH] T355: specify hash algorithm explicitly

2020-07-27 Thread Tomi Ollila
On Mon, Jul 27 2020, Đoàn Trần Công Danh wrote:

> On some systems (notably, the one shipped with LibreSSL),
> default fingerprint digest algorithm is SHA256.
>
> On other systems, users can change default digest algorithm by changing
> default_md in /etc/ssl/default_md.
>
> Let's ask openssl to provide us specific algorithm to make the test
> more deterministic.
>
> Signed-off-by: Đoàn Trần Công Danh 
> ---
>  test/T355-smime.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/test/T355-smime.sh b/test/T355-smime.sh
> index f8cec62c..8b2b52be 100755
> --- a/test/T355-smime.sh
> +++ b/test/T355-smime.sh
> @@ -6,7 +6,7 @@ test_description='S/MIME signature verification and 
> decryption'
>  test_require_external_prereq openssl
>  test_require_external_prereq gpgsm
>  
> -FINGERPRINT=$(openssl x509 -fingerprint -in 
> "$NOTMUCH_SRCDIR/test/smime/key+cert.pem" -noout | sed -e 's/^.*=//' -e 
> s/://g)
> +FINGERPRINT=$(openssl x509 -sha1 -fingerprint -in 
> "$NOTMUCH_SRCDIR/test/smime/key+cert.pem" -noout | sed -e 's/^.*=//' -e 
> s/://g)

Looks good to me -- provided that this `-sha1` option is known by all
openssl(1) commmands we expect to be supported...

Tomi


>  
>  add_gpgsm_home
>  
> -- 
> 2.28.0.rc2.21.g5c06d60fc5
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH] configure: account for various name of pytest-3

2020-07-27 Thread Tomi Ollila
On Mon, Jul 27 2020, Đoàn Trần Công Danh wrote:

> On different distro, pytest is suffixed with different patterns.
> Try to account for them, now.
>
> Signed-off-by: Đoàn Trần Công Danh 
> ---
>  configure | 13 +
>  1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/configure b/configure
> index db3538b3..90bc9182 100755
> --- a/configure
> +++ b/configure
> @@ -814,10 +814,15 @@ if [ $have_python3 -eq 1 ]; then
>  printf "Checking for python3 pytest (>= 3.0)... "
>  conf=$(mktemp)
>  printf "[pytest]\nminversion=3.0\n" > $conf
> -if pytest-3 -c $conf --version >/dev/null 2>&1; then
> -printf "Yes.\n"
> -have_python3_pytest=1
> -else
> +for _pytest_cmd in pytest-3 pytest3; do

We use `${NOTMUCH_PYTHON} -m pytest` in tests to run the python
tests. IMO it would be better to change this check to do the
same with already resolved python3 command.

Tomi

> +if command -v $_pytest_cmd >/dev/null 2>&1 &&
> +$_pytest_cmd -c $conf --version >/dev/null 2>&1; then
> +printf "Yes.\n"
> +have_python3_pytest=1
> +break
> +fi
> +done
> +if [ "have_python3_pytest" = "0" ]; then
>  printf "No (will not test CFFI-based python bindings).\n"
>  fi
>  rm -f $conf
> -- 
> 2.28.0.rc2.21.g5c06d60fc5
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH] configure: detect version by compiler for build

2020-07-27 Thread Tomi Ollila
On Mon, Jul 27 2020, Đoàn Trần Công Danh wrote:

> We'll need to run the compiled binary to report our current version.
>
> With the same code base, we should have the same version information
> regardless of compiler and architecture.
>
> Let's use the compiler for building architecture to build the reporting
> binary. Which is usually reported under variable CC_FOR_BUILD,
> a convention established by GNU Autotools, and fall back to CC if it's
> not defined.

We'd probably need to change quite a few other compiled and run binaries
in configure... otherwise this would be incomplete change (and thus just
adds confusion ?)

>
> Signed-off-by: Đoàn Trần Công Danh 
> ---
>  configure | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/configure b/configure
> index 98f5f1ea..db3538b3 100755
> --- a/configure
> +++ b/configure
> @@ -85,8 +85,10 @@ fi
>  BASHCMD=${BASHCMD:-bash}
>  PERL=${PERL:-perl}
>  CC=${CC:-cc}
> +CC_FOR_BUILD=${CC_FOR_BUILD:-$CC}
>  CXX=${CXX:-c++}
>  CFLAGS=${CFLAGS:--g -O2}
> +CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD:-$CFLAGS}
>  CPPFLAGS=${CPPFLAGS:-}
>  CXXFLAGS_for_sh=${CXXFLAGS:-${CFLAGS}}
>  CXXFLAGS=${CXXFLAGS:-\$(CFLAGS)}
> @@ -410,7 +412,7 @@ int main(void) {
>  return 0;
>  }
>  EOF
> -if ${CC} ${CFLAGS} -I"$srcdir" _libversion.c -o _libversion > /dev/null 2>&1 
> \
> +if ${CC_FOR_BUILD} ${CFLAGS_FOR_BUILD} -I"$srcdir" _libversion.c -o 
> _libversion > /dev/null 2>&1 \
> && ./_libversion > _libversion.sh && . ./_libversion.sh
>  then
>  printf "OK.\n"
> -- 
> 2.28.0.rc2.21.g5c06d60fc5
> ___
> notmuch mailing list -- notmuch@notmuchmail.org
> To unsubscribe send an email to notmuch-le...@notmuchmail.org
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH] T355: specify hash algorithm explicitly

2020-07-27 Thread Đoàn Trần Công Danh
On 2020-07-27 22:41:08+0700, Đoàn Trần Công Danh  wrote:
> On some systems (notably, the one shipped with LibreSSL),
> default fingerprint digest algorithm is SHA256.
> 
> On other systems, users can change default digest algorithm by changing
> default_md in /etc/ssl/default_md.

s/default_md[.]/openssl.cnf/

Sorry for the noise, but I failed to proof read my commit message.

> 
> Let's ask openssl to provide us specific algorithm to make the test
> more deterministic.
> 
> Signed-off-by: Đoàn Trần Công Danh 
> ---
>  test/T355-smime.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/test/T355-smime.sh b/test/T355-smime.sh
> index f8cec62c..8b2b52be 100755
> --- a/test/T355-smime.sh
> +++ b/test/T355-smime.sh
> @@ -6,7 +6,7 @@ test_description='S/MIME signature verification and 
> decryption'
>  test_require_external_prereq openssl
>  test_require_external_prereq gpgsm
>  
> -FINGERPRINT=$(openssl x509 -fingerprint -in 
> "$NOTMUCH_SRCDIR/test/smime/key+cert.pem" -noout | sed -e 's/^.*=//' -e 
> s/://g)
> +FINGERPRINT=$(openssl x509 -sha1 -fingerprint -in 
> "$NOTMUCH_SRCDIR/test/smime/key+cert.pem" -noout | sed -e 's/^.*=//' -e 
> s/://g)
>  
>  add_gpgsm_home
>  
> -- 
> 2.28.0.rc2.21.g5c06d60fc5
> 

-- 
Danh
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: simplify handling of writable database modes

2020-07-27 Thread Tomi Ollila
On Sun, Jul 26 2020, David Bremner wrote:

> As the last commit message mentions, it is a bit hard to be sure one
> is using static_cast correctly, so this series eliminates
> the use of static_cast for Xapian database objects.
>
> As a bonus, it deletes more code than it adds.
>
> Based on a suggestion from Olly Betts.


Series LGTM.

Tomi
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH 07/23] emacs: Use 'and' instead of 'when' when the return value matters

2020-07-27 Thread Sean Whitton
Hello,

On Mon 27 Jul 2020 at 12:02AM +02, Jonas Bernoulli wrote:

> Sean Whitton  writes:
>
>> On Sun 26 Jul 2020 at 06:58PM +02, Jonas Bernoulli wrote:
>>
>>> Also do so for some 'if' forms that lack an ELSE part.
>>> Even go as far as using 'and' and 'not' instead of 'unless'.
>>
>> I don't follow "when the return value matters", could you explain?
>
> As in "when the caller consumes the returned value".  The alternative
> would be for the caller to not care about the value returned by the
> callee and to instead call it for the side-effects only.
>
> By using `and' we can signal that care about the return value and by
> using `when' that we care about the side-effects instead.

Thank you for your reply.  Just to confirm, this is just a convention,
right?  I hadn't come across it yet.

-- 
Sean Whitton
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH] configure: account for various name of pytest-3

2020-07-27 Thread Đoàn Trần Công Danh
On different distro, pytest is suffixed with different patterns.
Try to account for them, now.

Signed-off-by: Đoàn Trần Công Danh 
---
 configure | 13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/configure b/configure
index db3538b3..90bc9182 100755
--- a/configure
+++ b/configure
@@ -814,10 +814,15 @@ if [ $have_python3 -eq 1 ]; then
 printf "Checking for python3 pytest (>= 3.0)... "
 conf=$(mktemp)
 printf "[pytest]\nminversion=3.0\n" > $conf
-if pytest-3 -c $conf --version >/dev/null 2>&1; then
-printf "Yes.\n"
-have_python3_pytest=1
-else
+for _pytest_cmd in pytest-3 pytest3; do
+if command -v $_pytest_cmd >/dev/null 2>&1 &&
+$_pytest_cmd -c $conf --version >/dev/null 2>&1; then
+printf "Yes.\n"
+have_python3_pytest=1
+break
+fi
+done
+if [ "have_python3_pytest" = "0" ]; then
 printf "No (will not test CFFI-based python bindings).\n"
 fi
 rm -f $conf
-- 
2.28.0.rc2.21.g5c06d60fc5
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH] T355: specify hash algorithm explicitly

2020-07-27 Thread Đoàn Trần Công Danh
On some systems (notably, the one shipped with LibreSSL),
default fingerprint digest algorithm is SHA256.

On other systems, users can change default digest algorithm by changing
default_md in /etc/ssl/default_md.

Let's ask openssl to provide us specific algorithm to make the test
more deterministic.

Signed-off-by: Đoàn Trần Công Danh 
---
 test/T355-smime.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/T355-smime.sh b/test/T355-smime.sh
index f8cec62c..8b2b52be 100755
--- a/test/T355-smime.sh
+++ b/test/T355-smime.sh
@@ -6,7 +6,7 @@ test_description='S/MIME signature verification and decryption'
 test_require_external_prereq openssl
 test_require_external_prereq gpgsm
 
-FINGERPRINT=$(openssl x509 -fingerprint -in 
"$NOTMUCH_SRCDIR/test/smime/key+cert.pem" -noout | sed -e 's/^.*=//' -e s/://g)
+FINGERPRINT=$(openssl x509 -sha1 -fingerprint -in 
"$NOTMUCH_SRCDIR/test/smime/key+cert.pem" -noout | sed -e 's/^.*=//' -e s/://g)
 
 add_gpgsm_home
 
-- 
2.28.0.rc2.21.g5c06d60fc5
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH] configure: detect version by compiler for build

2020-07-27 Thread Đoàn Trần Công Danh
We'll need to run the compiled binary to report our current version.

With the same code base, we should have the same version information
regardless of compiler and architecture.

Let's use the compiler for building architecture to build the reporting
binary. Which is usually reported under variable CC_FOR_BUILD,
a convention established by GNU Autotools, and fall back to CC if it's
not defined.

Signed-off-by: Đoàn Trần Công Danh 
---
 configure | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index 98f5f1ea..db3538b3 100755
--- a/configure
+++ b/configure
@@ -85,8 +85,10 @@ fi
 BASHCMD=${BASHCMD:-bash}
 PERL=${PERL:-perl}
 CC=${CC:-cc}
+CC_FOR_BUILD=${CC_FOR_BUILD:-$CC}
 CXX=${CXX:-c++}
 CFLAGS=${CFLAGS:--g -O2}
+CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD:-$CFLAGS}
 CPPFLAGS=${CPPFLAGS:-}
 CXXFLAGS_for_sh=${CXXFLAGS:-${CFLAGS}}
 CXXFLAGS=${CXXFLAGS:-\$(CFLAGS)}
@@ -410,7 +412,7 @@ int main(void) {
 return 0;
 }
 EOF
-if ${CC} ${CFLAGS} -I"$srcdir" _libversion.c -o _libversion > /dev/null 2>&1 \
+if ${CC_FOR_BUILD} ${CFLAGS_FOR_BUILD} -I"$srcdir" _libversion.c -o 
_libversion > /dev/null 2>&1 \
&& ./_libversion > _libversion.sh && . ./_libversion.sh
 then
 printf "OK.\n"
-- 
2.28.0.rc2.21.g5c06d60fc5
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH] configure: drop check for default xapian backend

2020-07-27 Thread Đoàn Trần Công Danh
Starting from xapian 1.3.5, xapian switched default backend to glass.

From 00cdfe10 (build: drop support for xapian versions less than 1.4,
2020-04-22), we only support xapian 1.4.0+. Effectively, we don't need
to check for default xapian backend anymore.

Let's drop it.

Signed-off-by: Đoàn Trần Công Danh 
---
 configure  | 23 ---
 test/T360-symbol-hiding.sh |  4 ++--
 test/test-lib.sh   | 11 +--
 3 files changed, 3 insertions(+), 35 deletions(-)

diff --git a/configure b/configure
index 90bc9182..bb17054a 100755
--- a/configure
+++ b/configure
@@ -457,26 +457,6 @@ if [ ${have_xapian} = "0" ]; then
 errors=$((errors + 1))
 fi
 
-if [ ${have_xapian} = "1" ]; then
-default_xapian_backend=""
-printf "Testing default Xapian backend... "
-cat >_default_backend.cc <
-int main(int argc, char** argv) {
-   Xapian::WritableDatabase db("test.db",Xapian::DB_CREATE_OR_OPEN);
-}
-EOF
-${CXX} ${CXXFLAGS_for_sh} ${xapian_cxxflags} _default_backend.cc -o 
_default_backend ${xapian_ldflags}
-./_default_backend
-if [ -f test.db/iamglass ]; then
-   default_xapian_backend=glass
-else
-   default_xapian_backend=chert
-fi
-printf "%s\n" "${default_xapian_backend}";
-rm -rf test.db _default_backend _default_backend.cc
-fi
-
 GMIME_MINVER=3.0.3
 
 printf "Checking for GMime development files (>= $GMIME_MINVER)... "
@@ -1515,9 +1495,6 @@ NOTMUCH_SRCDIR='${NOTMUCH_SRCDIR}'
 # Whether to have Xapian retry lock
 NOTMUCH_HAVE_XAPIAN_DB_RETRY_LOCK=${WITH_RETRY_LOCK}
 
-# Which backend will Xapian use by default?
-NOTMUCH_DEFAULT_XAPIAN_BACKEND=${default_xapian_backend}
-
 # Whether GMime can verify X.509 certificate validity
 NOTMUCH_GMIME_X509_CERT_VALIDITY=${gmime_x509_cert_validity}
 
diff --git a/test/T360-symbol-hiding.sh b/test/T360-symbol-hiding.sh
index 43921cb4..eb438a7a 100755
--- a/test/T360-symbol-hiding.sh
+++ b/test/T360-symbol-hiding.sh
@@ -14,11 +14,11 @@ test_description='exception symbol hiding'
 test_begin_subtest 'running test' run_test
 mkdir -p ${PWD}/fakedb/.notmuch
 $TEST_DIRECTORY/symbol-test ${PWD}/fakedb ${PWD}/nonexistent 2>&1 \
-   | notmuch_dir_sanitize | sed -e "s,\`,\',g" -e 
"s,${NOTMUCH_DEFAULT_XAPIAN_BACKEND},backend,g" > OUTPUT
+   | notmuch_dir_sanitize | sed -e "s,\`,\',g" > OUTPUT
 
 cat < EXPECTED
 A Xapian exception occurred opening database: Couldn't stat 
'CWD/fakedb/.notmuch/xapian'
-caught No backend database found at path 'CWD/nonexistent'
+caught No glass database found at path 'CWD/nonexistent'
 EOF
 test_expect_equal_file EXPECTED OUTPUT
 
diff --git a/test/test-lib.sh b/test/test-lib.sh
index 8c331b88..9142f6b2 100644
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -1260,16 +1260,7 @@ ln -s x y 2>/dev/null && test -h y 2>/dev/null && 
test_set_prereq SYMLINKS
 rm -f y
 
 # convert variable from configure to more convenient form
-case "$NOTMUCH_DEFAULT_XAPIAN_BACKEND" in
-glass)
-   db_ending=glass
-;;
-chert)
-   db_ending=DB
-;;
-*)
-   error "Unknown Xapian backend $NOTMUCH_DEFAULT_XAPIAN_BACKEND"
-esac
+db_ending=glass
 # declare prerequisites for external binaries used in tests
 test_declare_external_prereq dtach
 test_declare_external_prereq emacs
-- 
2.28.0.rc2.21.g5c06d60fc5
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH v3 4/4] test: Explicitly state that we want to sign with sender

2020-07-27 Thread Jonas Bernoulli
Since Emacs 27 'mml-secure-epg-sign' errors out if we don't opt-in to
signing as the sender using 'mml-secure-openpgp-sign-with-sender'.
---
 test/test-lib.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/test/test-lib.sh b/test/test-lib.sh
index 8c331b88..31c858d1 100644
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -414,7 +414,9 @@ emacs_fcc_message ()
   (message-goto-body)
   (insert \"${body}\")
   $*
-  (notmuch-mua-send-and-exit))" || return 1
+  (let ((mml-secure-smime-sign-with-sender t)
+(mml-secure-openpgp-sign-with-sender t))
+(notmuch-mua-send-and-exit)))" || return 1
 notmuch new $nmn_args >/dev/null
 }
 
-- 
2.26.0
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH v3 0/4] Adjust test for changes in Emacs 27

2020-07-27 Thread Jonas Bernoulli
This reroll explains why the variable's default value is -100.
It also adds an additional commit, which removes a misguided
abstraction that is related to those very same variables.

Jonas Bernoulli (4):
  gitignore: Ignore generated sphinx.config
  test: Deal with Emacs 27 switching to lexical scope by default
  test: Remove misguided emacs testing utilities
  test: Explicitly state that we want to sign with sender

 .gitignore   |  1 +
 test/test-lib.el | 27 ++-
 test/test-lib.sh |  4 +++-
 3 files changed, 18 insertions(+), 14 deletions(-)

-- 
2.26.0
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH v3 2/4] test: Deal with Emacs 27 switching to lexical scope by default

2020-07-27 Thread Jonas Bernoulli
Starting with Emacs 27 undeclared variables in evaluated interactive
code uses lexical scope.  This includes code passed with '--eval' as
we do in the Emacs tests, which also happen to assume dynamic scope.

- This can affect variables defined by libraries that we use.  We
  let-bind such variables to change the behavior of functions which we
  then call with these bindings in effect.  If these libraries are not
  loaded beforehand, then the bindings are lexical and fail to have
  the effect we intended.

  At this time only 'smtpmail' has to be loaded explicitly (for the
  variables let-bound in emacs_deliver_message and emacs_fcc_message).

  'message' doesn't have to be loaded explicitly, because loading
  'notmuch' (in 'run_emacs') already takes care of that, indirectly.

- Our own testing-only variables also have to be declared explicitly.
  We should have done that anyway, but because of how and where these
  variables are used it was very easy to overlook that (i.e. it isn't
  something the byte-compiler ever looks at).  Not so in Emacs 27
  anymore; here this oversight caused four tests to fail.

  The numeric values of these variables get incremented by functions
  that we add to hooks that are run by many tests, not just the tests
  where we actually inspect the value and therefore take care to let-
  bind the values to 0 before we begin.  The global values therefore
  have to be numeric values as well.  I have chosen -100 instead of 0
  as the default in case someone writes a test that inspects the value
  but forgets to let-bind the value.  I hope that the unusual negative
  value that one is going to see in such a case will help debugging
  the issue.
---
 test/test-lib.el | 12 
 1 file changed, 12 insertions(+)

diff --git a/test/test-lib.el b/test/test-lib.el
index b47b388e..15271b02 100644
--- a/test/test-lib.el
+++ b/test/test-lib.el
@@ -22,6 +22,12 @@
 
 (require 'cl-lib)
 
+;; Ensure that the dynamic variables that are defined by this library
+;; are defined by the time that we let-bind them.  This is needed
+;; because starting with Emacs 27 undeclared variables in evaluated
+;; interactive code (such as our tests) use lexical scope.
+(require 'smtpmail)
+
 ;; `read-file-name' by default uses `completing-read' function to read
 ;; user input.  It does not respect `standard-input' variable which we
 ;; use in tests to provide user input.  So replace it with a plain
@@ -113,6 +119,12 @@ (defun add-hook-counter (hook)
 (add-hook-counter 'notmuch-hello-mode-hook)
 (add-hook-counter 'notmuch-hello-refresh-hook)
 
+(defvar notmuch-hello-mode-hook-counter -100
+  "Tests that care about this counter must let-bind it to 0.")
+
+(defvar notmuch-hello-refresh-hook-counter -100
+  "Tests that care about this counter must let-bind it to 0.")
+
 (defadvice notmuch-search-process-filter (around pessimal activate disable)
   "Feed notmuch-search-process-filter one character at a time."
   (let ((string (ad-get-arg 1)))
-- 
2.26.0
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH v3 3/4] test: Remove misguided emacs testing utilities

2020-07-27 Thread Jonas Bernoulli
The goal of this abstraction was to save space.  But that failed as
the result actually was that four trivial lines got replace with 15
fairly complicated lines.  The opposite of what it was supposed to
do.

Also it made it harder to come up with the fix in the previous commit;
simply grepping for the relevant symbols did not work because they get
constructed at run-time instead of appearing in the source file.
---
 test/test-lib.el | 19 ---
 1 file changed, 4 insertions(+), 15 deletions(-)

diff --git a/test/test-lib.el b/test/test-lib.el
index 15271b02..aae9e833 100644
--- a/test/test-lib.el
+++ b/test/test-lib.el
@@ -104,26 +104,15 @@ (defun orphan-watchdog (pid)
   "Initiate orphan watchdog check."
   (run-at-time 60 60 'orphan-watchdog-check pid))
 
-(defun hook-counter (hook)
-  "Count how many times a hook is called.  Increments
-`hook'-counter variable value if it is bound, otherwise does
-nothing."
-  (let ((counter (intern (concat (symbol-name hook) "-counter"
-(if (boundp counter)
-   (set counter (1+ (symbol-value counter))
-
-(defun add-hook-counter (hook)
-  "Add hook to count how many times `hook' is called."
-  (add-hook hook (apply-partially 'hook-counter hook)))
-
-(add-hook-counter 'notmuch-hello-mode-hook)
-(add-hook-counter 'notmuch-hello-refresh-hook)
-
 (defvar notmuch-hello-mode-hook-counter -100
   "Tests that care about this counter must let-bind it to 0.")
+(add-hook 'notmuch-hello-mode-hook
+ (lambda () (cl-incf notmuch-hello-mode-hook-counter)))
 
 (defvar notmuch-hello-refresh-hook-counter -100
   "Tests that care about this counter must let-bind it to 0.")
+(add-hook 'notmuch-hello-refresh-hook
+ (lambda () (cl-incf notmuch-hello-refresh-hook-counter)))
 
 (defadvice notmuch-search-process-filter (around pessimal activate disable)
   "Feed notmuch-search-process-filter one character at a time."
-- 
2.26.0
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH v3 1/4] gitignore: Ignore generated sphinx.config

2020-07-27 Thread Jonas Bernoulli
---
 .gitignore | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.gitignore b/.gitignore
index 1c8705ec..8f3ebec0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,3 +17,4 @@ tags
 /.stamps
 *.stamp
 /bindings/python-cffi/build/
+/sphinx.config
-- 
2.26.0
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH 08/13] test: regression test for n_directory_delete with closed db.

2020-07-27 Thread David Bremner
David Bremner  writes:

> To the best of my current understanding, it's a bug in Xapian that no
> exception is thrown here. The test should pass in either case.
> ---
>  test/T563-lib-directory.sh | 19 ++-
>  1 file changed, 18 insertions(+), 1 deletion(-)
>
> diff --git a/test/T563-lib-directory.sh b/test/T563-lib-directory.sh
> index 739469a6..4de31078 100755
> --- a/test/T563-lib-directory.sh
> +++ b/test/T563-lib-directory.sh
> @@ -26,7 +26,7 @@ int main (int argc, char** argv)
>   exit (1);
> }
>  
> -   EXPECT0(notmuch_database_get_directory (db, "", ));
> +   EXPECT0(notmuch_database_get_directory (db, "bar", ));
> EXPECT0(notmuch_database_close (db));
>  EOF
note to self. That change should be in the earlier commit that
introduces this particular bit of test scaffolding.
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH 2/3] test: Deal with Emacs 27 switching to lexical scope by default

2020-07-27 Thread David Bremner
Jonas Bernoulli  writes:

>  
> +(defvar notmuch-hello-mode-hook-counter -100)
> +(defvar notmuch-hello-refresh-hook-counter -100)
> +
>  (defadvice notmuch-search-process-filter (around pessimal activate disable)
>"Feed notmuch-search-process-filter one character at a time."
>(let ((string (ad-get-arg 1)))

This is overall fine, but if you were going to respin the series anyway
for something else, then a comment on the unusual initialization values
would not go amiss. Out of curiousity, why not nil?

d
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: batch 7, API exception handline cleanup.

2020-07-27 Thread David Bremner
David Bremner  writes:

> These follow the series
>
>   id:20200718150751.4106125-1-da...@tethera.net
>
> Probably the most interesting change is
>
>  [PATCH 7/8] lib: fix error return bug with n_d_set_config.
>

batch applied to master.

d
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org