Threaded view would do annoying scroll
Hi, I'm using Emacs 26.2 and Notmuch 0.28.2 and I noticed that after updating Emacs to 26.2, notmuch would start doing annoying (auto)scroll inside thraded view opened message, probably trying to center the message. The search is done calling `notmuch-search`. Anyone got similar behavior or knows how to mitigate it? Notmuch would work fine in Emacs 24.3.1. Please CC me with reply, I'm not member of this list. Thanks in advance. Best, Sanel PS: Appologies if you got duplicate of this mail; I wasn't been able to access notmuchmail.org domain and I presume previous version wasn't delivered. ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
Threaded view would do annoying scroll
Hi, I'm using Emacs 26.2 and Notmuch 0.28.2 and I noticed that after updating Emacs to 26.2, notmuch would start doing annoying (auto)scroll inside thraded view opened message, probably trying to center the message. The search is done calling `notmuch-search`. Anyone got similar behavior or knows how to mitigate it? Notmuch would work fine in Emacs 24.3.1. Please CC me with reply, I'm not member of this list. Thanks in advance. Best, Sanel ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
Re: segfault using python bindings
On Tue 2019-08-20 19:20:30 +0200, Floris Bruynooghe wrote: > Sounds reasonable, just a quick note that I'm on holiday at the moment > and generally won't be too quick. But I guess there's no rush. I was > also trying to improve the docs but got sidetracked at some point. > There should be already reasonable good docstrings though. thanks for having done all this work already! > For path series what did you have in mind? One single patch with the > whole lot? The original history at https:://github/flub/notdb? > Something in between? I would be happy with a series of patches, but the cited github history has only one commit in the first place :P > I also recall some comments about the naming not being liked much > (notdb). I'm open to some bikeshedding on the naming if it bothers > people. I was only aiming for something short but under a different > import name, which are probably still useful features to keep. fwiw, "notdb" doesn't really resonate with me, but i wouldn't block you if you decided to stick with it. I'd generally prefer something like "notmuch2" because it makes it much clearer that it is associated with notmuch, and that it is the successor to the original notmuch bindings. (i also find "notmuch2" rather unsatisfying, but python doesn't have a meaningful versioning system for backwards-incompatible API changes for its modules, so this kind of name augmentation is the only strategy i'm aware of). --dkg signature.asc Description: PGP signature ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
Re: regex [X-Z] with non-ascii char returns different results from (X|Y|Z)
"yury.t" writes: > Some regular expression returns incorrect results if the pattern > contains multibyte characters in square brackets. The following > bracket expression matches subjects not starting with `[1-9]` and > returns more results than the parenthesis expression. We rely on POSIX.2 regex functions (regcomp, regexec). I would be interested to know if the searches you are interested in work in a standalone C program using regcomp and regexec. d ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
regex [X-Z] with non-ascii char returns different results from (X|Y|Z)
Some regular expression returns incorrect results if the pattern contains multibyte characters in square brackets. The following bracket expression matches subjects not starting with `[1-9]` and returns more results than the parenthesis expression. (Please note that digits are full width, unicode characters.) notmuch count -- 'subject:"/^[1-9]/"' # 961 notmuch count -- 'subject:"/^(1|2|3|4|5|6|7|8|9)/"' # 32 Somehow non-ascii characters in brackets match with any characters start with same hex code point. For example: - [1] (U+FF11) is treated as [\x{F000}-\x{}] - ^[倀] (U+5000), ^[啕] (U+) and ^[忿] (U+5fff) return same results since they are all "U+5xxx". Without ^, their results are vary but still contain unrelated subjects. And curly brackets for repetition also have weird behavior. If there are two emails whose subject is (A) "1人" and (B) "12人": - ^(1|2...|9)人 - match A, unmatch B (expected) - ^(1|2...|9){2}人 - unmatch A, match B (expected) - ^[1-9]人 and ^[1-9]{2}人 - unmatch both - ^[1-9]{3}人, {4} and {5} - match A, unmatch B - ^[1-9]{6}人, {7} and {8} - unmatch A, match B As noted in manpage of notmuch-search-terms, I surely wrap regular expression with double quotes and entire query with single quotes. I also increase/decrease $XAPIAN_CJK_NGRAM and rebuild index, but the situation won't change. ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
[PATCH 1/3] test: add known broken tests for from: and subject:
Given we want 'a b' to parse as 'a AND b', then for any probabilistic (free text) prefix foo:, we should also get 'foo:a foo:b' expanding to 'foo:a AND foo:b'. Currently this is not true due to the implimentation of regex fields. --- test/T760-implicit-operators.sh | 28 1 file changed, 28 insertions(+) create mode 100755 test/T760-implicit-operators.sh diff --git a/test/T760-implicit-operators.sh b/test/T760-implicit-operators.sh new file mode 100755 index ..b79673df --- /dev/null +++ b/test/T760-implicit-operators.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +test_description='implicit operators in query parser' +. $(dirname "$0")/test-lib.sh || exit 1 + +test_AND() { +add_message "[$1]=a@b" +add_message "[$1]=b@c" + +test_begin_subtest "$1: implicitly joined by AND" +$2 +notmuch count $1:a@b > OUTPUT +notmuch count $1:a $1:b >> OUTPUT +notmuch count $1:a@b OR $1:b@c >> OUTPUT +notmuch count $1:a@b $1:b@c >> OUTPUT +cat < EXPECTED +1 +1 +2 +0 +EOF +test_expect_equal_file EXPECTED OUTPUT +} + +test_AND from test_subtest_known_broken +test_AND subject test_subtest_known_broken +test_AND to + +test_done -- 2.23.0.rc1 ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
[PATCH 2/3] lib: introduce N_F_GROUP and use it to fix implicit AND for from:
This needs tests for every prefix and documentation --- lib/database-private.h | 1 + lib/database.cc | 23 +-- test/T760-implicit-operators.sh | 4 ++-- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/lib/database-private.h b/lib/database-private.h index 87ae1bdf..a5eb83cb 100644 --- a/lib/database-private.h +++ b/lib/database-private.h @@ -159,6 +159,7 @@ typedef enum notmuch_field_flags { NOTMUCH_FIELD_EXTERNAL = 1 << 0, NOTMUCH_FIELD_PROBABILISTIC = 1 << 1, NOTMUCH_FIELD_PROCESSOR= 1 << 2, +NOTMUCH_FIELD_GROUP= 1 << 3, } notmuch_field_flag_t; /* diff --git a/lib/database.cc b/lib/database.cc index 24b7ec43..5d6c4ee6 100644 --- a/lib/database.cc +++ b/lib/database.cc @@ -272,16 +272,21 @@ prefix_t prefix_table[] = { { "body", "", NOTMUCH_FIELD_EXTERNAL | NOTMUCH_FIELD_PROBABILISTIC }, { "thread", "G",NOTMUCH_FIELD_EXTERNAL | - NOTMUCH_FIELD_PROCESSOR }, + NOTMUCH_FIELD_PROCESSOR | + NOTMUCH_FIELD_GROUP +}, { "tag","K",NOTMUCH_FIELD_EXTERNAL | NOTMUCH_FIELD_PROCESSOR }, { "is", "K",NOTMUCH_FIELD_EXTERNAL | NOTMUCH_FIELD_PROCESSOR }, -{ "id", "Q",NOTMUCH_FIELD_EXTERNAL }, +{ "id", "Q",NOTMUCH_FIELD_EXTERNAL | + NOTMUCH_FIELD_GROUP }, { "mid","Q",NOTMUCH_FIELD_EXTERNAL | NOTMUCH_FIELD_PROCESSOR }, { "path", "P",NOTMUCH_FIELD_EXTERNAL | - NOTMUCH_FIELD_PROCESSOR }, + NOTMUCH_FIELD_PROCESSOR | + NOTMUCH_FIELD_GROUP +}, { "property", "XPROPERTY",NOTMUCH_FIELD_EXTERNAL }, /* * Unconditionally add ':' to reduce potential ambiguity with @@ -290,10 +295,14 @@ prefix_t prefix_table[] = { * discussion. */ { "folder", "XFOLDER:", NOTMUCH_FIELD_EXTERNAL | - NOTMUCH_FIELD_PROCESSOR }, + NOTMUCH_FIELD_PROCESSOR | + NOTMUCH_FIELD_GROUP +}, #if HAVE_XAPIAN_FIELD_PROCESSOR { "date", NULL, NOTMUCH_FIELD_EXTERNAL | - NOTMUCH_FIELD_PROCESSOR }, + NOTMUCH_FIELD_PROCESSOR | + NOTMUCH_FIELD_GROUP +}, { "query", NULL, NOTMUCH_FIELD_EXTERNAL | NOTMUCH_FIELD_PROCESSOR }, #endif @@ -400,7 +409,9 @@ _setup_query_field (const prefix_t *prefix, notmuch_database_t *notmuch) /* we treat all field-processor fields as boolean in order to get the raw input */ if (prefix->prefix) notmuch->query_parser->add_prefix ("", prefix->prefix); - notmuch->query_parser->add_boolean_prefix (prefix->name, fp); + notmuch->query_parser->add_boolean_prefix (prefix->name, fp, + !(prefix->flags & NOTMUCH_FIELD_PROBABILISTIC) && + (prefix->flags & NOTMUCH_FIELD_GROUP)); } else { _setup_query_field_default (prefix, notmuch); } diff --git a/test/T760-implicit-operators.sh b/test/T760-implicit-operators.sh index b79673df..1a6ba61f 100755 --- a/test/T760-implicit-operators.sh +++ b/test/T760-implicit-operators.sh @@ -21,8 +21,8 @@ EOF test_expect_equal_file EXPECTED OUTPUT } -test_AND from test_subtest_known_broken -test_AND subject test_subtest_known_broken +test_AND from +test_AND subject test_AND to test_done -- 2.23.0.rc1 ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
[PATCH 3/3] WIP/test: extend field grouping tests
--- test/T760-implicit-operators.sh | 60 +++-- 1 file changed, 49 insertions(+), 11 deletions(-) diff --git a/test/T760-implicit-operators.sh b/test/T760-implicit-operators.sh index 1a6ba61f..438f766f 100755 --- a/test/T760-implicit-operators.sh +++ b/test/T760-implicit-operators.sh @@ -2,16 +2,16 @@ test_description='implicit operators in query parser' . $(dirname "$0")/test-lib.sh || exit 1 -test_AND() { -add_message "[$1]=a@b" -add_message "[$1]=b@c" +test_prob_AND() { +add_message "[$1]=alpha@beta" +add_message "[$1]=beta@gamma" -test_begin_subtest "$1: implicitly joined by AND" +test_begin_subtest "probabilistic field '$1:' implicitly joined by AND" $2 -notmuch count $1:a@b > OUTPUT -notmuch count $1:a $1:b >> OUTPUT -notmuch count $1:a@b OR $1:b@c >> OUTPUT -notmuch count $1:a@b $1:b@c >> OUTPUT +notmuch count $1:alpha@beta > OUTPUT +notmuch count $1:alpha $1:beta >> OUTPUT +notmuch count $1:alpha@beta OR $1:beta@gamma >> OUTPUT +notmuch count $1:alpha@beta $1:beta@gamma >> OUTPUT cat < EXPECTED 1 1 @@ -21,8 +21,46 @@ EOF test_expect_equal_file EXPECTED OUTPUT } -test_AND from -test_AND subject -test_AND to +test_regex_AND() { +test_begin_subtest "regex field '$1:' implicitly joined by AND" +$2 +notmuch count $1:alpha@beta > OUTPUT +notmuch count $1:/alpha/ $1:/beta/ >> OUTPUT +notmuch count $1:alpha@beta OR $1:beta@gamma >> OUTPUT +notmuch count $1:alpha@beta $1:beta@gamma >> OUTPUT +cat < EXPECTED +1 +1 +2 +0 +EOF +test_expect_equal_file EXPECTED OUTPUT +} + +test_prob_AND from +test_prob_AND subject +test_prob_AND to + + +add_message "[id]=alpha@beta" +add_message "[id]=beta@gamma" + +test_regex_AND mid + +test_begin_subtest "'id:' implicitly joined by OR" +notmuch count id:alpha@beta > OUTPUT +notmuch count id:alpha@beta OR id:beta@gamma >> OUTPUT +notmuch count id:alpha@beta id:beta@gamma >> OUTPUT +cat < EXPECTED +1 +2 +2 +EOF +test_expect_equal_file EXPECTED OUTPUT + +notmuch tag +alpha@beta id:alpha@beta +notmuch tag +beta@gamma id:beta@gamma + +test_regex_AND tag test_done -- 2.23.0.rc1 ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
WIP: fix implicit operators
I'm posting this for feedback. I did all the tests that were easy, but things like threads and attachments will take more effort to test. for probabilistic prefixes, we are basically stuck with AND. For boolean prefixes, we have the choice. Generally I tried to follow the Xapian convention that if a field/prefix is "exclusive" (one per message), then we group with OR. Regexp fields like mid:// are tricky since even if the underlying data is exclusive it makes sense to use multiple instances to match one piece of data, e.g. mid:/david/ mid:/tethera/ should probably behave roughly like mid:/david.*tethera/ ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch