unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* Bug? notmuch-emacs: "All tags" in notmuch-hello does not show all tags
@ 2018-04-20 16:12 Gregor Zattler
  2018-04-21 17:38 ` Tomi Ollila
  0 siblings, 1 reply; 18+ messages in thread
From: Gregor Zattler @ 2018-04-20 16:12 UTC (permalink / raw)
  To: Notmuch Mail

Dear notmuch-emacs developers,

I use a certain tag which until now is only used with regards to
one single message which is also tagged "spam".  This certain tag
is among the output of notmuch search --output=tags '*'

The part of notmuch-hello which is supposed to show "All tags"
does not show this certain tag.  But it shows the certain tag with
count = 1 if I remove the tag "spam" from this message.  The same
happens if this message is tagged "deleted" instead of "spam".


My ~/.notmuch-config contains:

[search]
exclude_tags=deleted;spam;


The relevant section of my customzation.el contains:

 '(notmuch-hello-sections
   '(notmuch-hello-insert-search notmuch-hello-insert-saved-searches notmuch-hello-insert-recent-searches
                                 (notmuch-hello-insert-tags-section "All tags" :initially-hidden t nil nil)))


I can show the message in question with a search for
(is:spam OR NOT is:spam OR is:deleted OR NOT is:deleted) AND is:certaintag
notmuch-emacs then shows the single message and its tags.  Among
those is the certain tag.


I expected the certain tag to be shown in the notmuch-hello
section "All tags" and consider it a bug that this is not the case.

My guess is that somewhere in the code notmuch count is called
without --exclude=false.


Ciao; Gregor
-- 
 -... --- .-. . -.. ..--.. ...-.-

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Bug? notmuch-emacs: "All tags" in notmuch-hello does not show all tags
  2018-04-20 16:12 Bug? notmuch-emacs: "All tags" in notmuch-hello does not show all tags Gregor Zattler
@ 2018-04-21 17:38 ` Tomi Ollila
  2018-04-21 22:33   ` Gregor Zattler
  0 siblings, 1 reply; 18+ messages in thread
From: Tomi Ollila @ 2018-04-21 17:38 UTC (permalink / raw)
  To: Gregor Zattler, Notmuch Mail

On Fri, Apr 20 2018, Gregor Zattler wrote:

> Dear notmuch-emacs developers,
>
> I use a certain tag which until now is only used with regards to
> one single message which is also tagged "spam".  This certain tag
> is among the output of notmuch search --output=tags '*'
>
> The part of notmuch-hello which is supposed to show "All tags"
> does not show this certain tag.  But it shows the certain tag with
> count = 1 if I remove the tag "spam" from this message.  The same
> happens if this message is tagged "deleted" instead of "spam".
>
>
> My ~/.notmuch-config contains:
>
> [search]
> exclude_tags=deleted;spam;
>
>
> The relevant section of my customzation.el contains:
>
>  '(notmuch-hello-sections
>    '(notmuch-hello-insert-search notmuch-hello-insert-saved-searches notmuch-hello-insert-recent-searches
>                                  (notmuch-hello-insert-tags-section "All tags" :initially-hidden t nil nil)))
>
>
> I can show the message in question with a search for
> (is:spam OR NOT is:spam OR is:deleted OR NOT is:deleted) AND is:certaintag
> notmuch-emacs then shows the single message and its tags.  Among
> those is the certain tag.
>
>
> I expected the certain tag to be shown in the notmuch-hello
> section "All tags" and consider it a bug that this is not the case.
>
> My guess is that somewhere in the code notmuch count is called
> without --exclude=false.

Hmm.

Notmuch emacs client runs `notmuch search --output=tags '*'` 
and then `notmuch count --batch` for those. If that 'certain'
tag was in output of notmuch search --output=tags '*' then I
don't see a reason it not showing up (unless it somehow were
included in notmuch-hello-hide-tags, but I cannot see how it
could be there). 

I personally don't have any tags excluded and nothing related
to *hello* in my ~/.emacs.d/custom.el -- and now that I 
experimented with [search] exclude_tags I just could not get
it to work in any related way (the tag I try to exclude is
seen in search --output=tags '*' and in notmuch count --batch
outputs...

    $ notmuch config get search.exclude_tags
    tbd
    $
    $ notmuch count --batch
    tag:tbd
    1
    $
    $ notmuch search --output=tags '*' | grep tbd
    tbd

Finally, I tried adding another tag to the one message
with this 'tbd' -- and that another tag is shown in
"All tags:" output.

That doesn't mean there could not be a bug there, just
that I cannot reproduce it...

Tomi

>
>
> Ciao; Gregor
> -- 
>  -... --- .-. . -.. ..--.. ...-.-

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Bug? notmuch-emacs: "All tags" in notmuch-hello does not show all tags
  2018-04-21 17:38 ` Tomi Ollila
@ 2018-04-21 22:33   ` Gregor Zattler
  2018-04-22  8:52     ` Tomi Ollila
  0 siblings, 1 reply; 18+ messages in thread
From: Gregor Zattler @ 2018-04-21 22:33 UTC (permalink / raw)
  To: Tomi Ollila, Notmuch Mail

[-- Attachment #1: Type: text/plain, Size: 1003 bytes --]

Hi Tomi, notmuch-emacs developers,
* Tomi Ollila <tomi.ollila@iki.fi> [2018-04-21; 20:38]:
[...]
> That doesn't mean there could not be a bug there, just
> that I cannot reproduce it...

Thanks for your investigation.

I now prepared a minimal example, please extract the archive in
/tmp.  It contains a quite minmalistic .notmuch-config, a Maildir
with one email and a test script which runs notmuch new, notmuch
tag, starts emacs with no configuration and hopefully shows
notmuch-hello.[1] Please klick on "show", you'll see only one
tag: "spam", klick on "spam" you'll see this one email shown with
its four (!) tags: "inbox", "new" and "certaintag" are not shown
in "All tags".

At least this is what I see with emacs25 and emacs27 and current
notmuch.

Do you see the same?


Thanks for investing time in this issue.  Regards, gregor

[1] The script tries to guess your notmuch/emacs source path as
load-path for emacs.  If this fails please edit the emacs
invocation according to your local setup

[-- Attachment #2: minimal-example.tar --]
[-- Type: application/x-tar, Size: 10240 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Bug? notmuch-emacs: "All tags" in notmuch-hello does not show all tags
  2018-04-21 22:33   ` Gregor Zattler
@ 2018-04-22  8:52     ` Tomi Ollila
  2022-01-05  1:06       ` [PATCH 1/3] test/emacs: add known broken test for hidden tags David Bremner
  2022-01-20 19:51       ` Bug? notmuch-emacs: "All tags" in notmuch-hello does not show all tags David Bremner
  0 siblings, 2 replies; 18+ messages in thread
From: Tomi Ollila @ 2018-04-22  8:52 UTC (permalink / raw)
  To: Gregor Zattler, Notmuch Mail

On Sun, Apr 22 2018, Gregor Zattler wrote:

> Hi Tomi, notmuch-emacs developers,
> * Tomi Ollila <tomi.ollila@iki.fi> [2018-04-21; 20:38]:
> [...]
>> That doesn't mean there could not be a bug there, just
>> that I cannot reproduce it...
>
> Thanks for your investigation.
>
> I now prepared a minimal example, please extract the archive in
> /tmp.  It contains a quite minmalistic .notmuch-config, a Maildir
> with one email and a test script which runs notmuch new, notmuch
> tag, starts emacs with no configuration and hopefully shows
> notmuch-hello.[1] Please klick on "show", you'll see only one
> tag: "spam", klick on "spam" you'll see this one email shown with
> its four (!) tags: "inbox", "new" and "certaintag" are not shown
> in "All tags".
>
> At least this is what I see with emacs25 and emacs27 and current
> notmuch.
>
> Do you see the same?


Yes, I can reproduce -- only "spam" is seen

To look what happened I ran (in notmuch source dir):

$ NOTMUCH_CONFIG=/tmp/.notmuch-config strace -f -e trace=execve,read,write -o ttt ./devel/try-emacs-mua -Q

based on that output:

$ NOTMUCH_CONFIG=/tmp/.notmuch-config notmuch search --output=tags '*'
certaintag
inbox
new
spam

$ NOTMUCH_CONFIG=/tmp/.notmuch-config notmuch count --batch
tag:certaintag
0
tag:new
0
tag:spam
1
tag:inbox
0
tag:foobar
0

NOTMUCH_CONFIG=/tmp/.notmuch-config notmuch count --batch --exclude=false
tag:certaintag
1
tag:new
1
tag:spam
1
tag:inbox
1

1
tag:foobar
0

So, currently, whenever count is zero, the tag is now shown in all tags
listing (but we know we have the tag since queried earlier). But, at least
in this case we should get real count and have that '--exclude=false' there,
and then the count is always positive number.

At least some SMOP is required to get this fixed.

Tomi

>
>
> Thanks for investing time in this issue.  Regards, gregor
>
> [1] The script tries to guess your notmuch/emacs source path as
> load-path for emacs.  If this fails please edit the emacs
> invocation according to your local setup
> [database]
> path=/tmp/Mail
>
> [user]
> name=Test User
> primary_email=test@example.org
> other_email=
>
> [new]
> tags=new;unread;inbox;
>
> [search]
> exclude_tags=deleted;spam;
>
> [maildir]
> synchronize_flags=true
>
> From: test@example.org
> To: test@example.org
> Subject: test single tag and tag +spam
> Message-ID: <test23@example.com>
>
> Look an email!
> #!/bin/bash
>
> export NOTMUCH_CONFIG=/tmp/.notmuch-config
> notmuch new
> notmuch tag +spam +certaintag -- mid:test23@example.com
> emacs -L "$(locate notmuch/emacs/notmuch.el | head -n 1 | sed -e 's/notmuch.el//')" -Q --eval "(require 'notmuch)" -f notmuch-hello

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 1/3] test/emacs: add known broken test for hidden tags
  2018-04-22  8:52     ` Tomi Ollila
@ 2022-01-05  1:06       ` David Bremner
  2022-01-05  1:06         ` [PATCH 2/3] emacs: use --exclude=false when checking for empty searches David Bremner
                           ` (2 more replies)
  2022-01-20 19:51       ` Bug? notmuch-emacs: "All tags" in notmuch-hello does not show all tags David Bremner
  1 sibling, 3 replies; 18+ messages in thread
From: David Bremner @ 2022-01-05  1:06 UTC (permalink / raw)
  To: Tomi Ollila, Gregor Zattler, Notmuch Mail

Gregor Zattler observed that tags could be unintentionally hidden in
the "All tags" view, and Tomi Ollia worked out [2] that the issue was tags
that only occured on excluded messages. This test reproduces that bug.

[1]: id:87wox1vovj.fsf@len.workgroup
[2]: id:m28t9faaim.fsf@guru.guru-group.fi
---
 test/T440-emacs-hello.sh                          | 11 +++++++++++
 test/emacs.expected-output/notmuch-hello-all-tags | 15 +++++++++++++++
 2 files changed, 26 insertions(+)
 create mode 100644 test/emacs.expected-output/notmuch-hello-all-tags

diff --git a/test/T440-emacs-hello.sh b/test/T440-emacs-hello.sh
index a1ed1c2b..a890bee1 100755
--- a/test/T440-emacs-hello.sh
+++ b/test/T440-emacs-hello.sh
@@ -68,6 +68,17 @@ test_emacs '(notmuch-hello)
 notmuch tag -$tag '*'
 test_expect_equal_file $EXPECTED/notmuch-hello-long-names OUTPUT
 
+test_begin_subtest "All Tags show up"
+test_subtest_known_broken
+tag=exclude_me
+notmuch tag +$tag '*'
+notmuch config set search.exclude_tags $tag
+test_emacs '(notmuch-hello)
+            (test-output)'
+notmuch tag -$tag '*'
+test_expect_equal_file $EXPECTED/notmuch-hello-all-tags OUTPUT
+
+test_done
 test_begin_subtest "notmuch-hello with nonexistent CWD"
 test_emacs '
       (notmuch-hello)
diff --git a/test/emacs.expected-output/notmuch-hello-all-tags b/test/emacs.expected-output/notmuch-hello-all-tags
new file mode 100644
index 00000000..2802a708
--- /dev/null
+++ b/test/emacs.expected-output/notmuch-hello-all-tags
@@ -0,0 +1,15 @@
+   Welcome to notmuch. You have 52 messages.
+
+Saved searches: [edit]
+
+	  52 inbox           52 unread          52 all mail
+
+Search:                                                                     .
+
+All tags: [hide]
+
+	   4 attachment            52 inbox                 52 unread
+	  52 exclude_me             7 signed
+
+	 Hit `?' for context-sensitive help in any Notmuch screen.
+		      Customize Notmuch or this page.
-- 
2.34.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 2/3] emacs: use --exclude=false when checking for empty searches
  2022-01-05  1:06       ` [PATCH 1/3] test/emacs: add known broken test for hidden tags David Bremner
@ 2022-01-05  1:06         ` David Bremner
  2022-01-05  1:06         ` [PATCH 3/3] emacs: use --exclude=false when counting total messages David Bremner
  2022-01-20 19:49         ` [PATCH 1/3] test/emacs: add known broken test for hidden tags David Bremner
  2 siblings, 0 replies; 18+ messages in thread
From: David Bremner @ 2022-01-05  1:06 UTC (permalink / raw)
  To: Tomi Ollila, Gregor Zattler, Notmuch Mail

In particular tags that only occur on otherwise excluded messages do
not show up in "All tags" without this change. The reported numbers
_do_ take excludes into account, so it is possible that
searches (e.g. the aformentioned tags) will show up with a count of
zero.
---
 emacs/notmuch-hello.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index fc007c4c..fcf7a6aa 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -570,7 +570,7 @@ options will be handled as specified for
 					    (plist-get options :filter))))
 	 "\n")))
     (unless (= (notmuch--call-process-region (point-min) (point-max) notmuch-command
-				    t t nil "count" "--batch") 0)
+				    t t nil "count" "--exclude=false" "--batch") 0)
       (notmuch-logged-error
        "notmuch count --batch failed"
        "Please check that the notmuch CLI is new enough to support `count
-- 
2.34.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 3/3] emacs: use --exclude=false when counting total messages
  2022-01-05  1:06       ` [PATCH 1/3] test/emacs: add known broken test for hidden tags David Bremner
  2022-01-05  1:06         ` [PATCH 2/3] emacs: use --exclude=false when checking for empty searches David Bremner
@ 2022-01-05  1:06         ` David Bremner
  2022-01-05 11:41           ` David Bremner
  2022-01-20 19:49         ` [PATCH 1/3] test/emacs: add known broken test for hidden tags David Bremner
  2 siblings, 1 reply; 18+ messages in thread
From: David Bremner @ 2022-01-05  1:06 UTC (permalink / raw)
  To: Tomi Ollila, Gregor Zattler, Notmuch Mail

Even if a user excludes a large fraction of their messages, they still
nonetheless exist and are searchable.
---
 emacs/notmuch-hello.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index fcf7a6aa..cd7ac39c 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -785,7 +785,7 @@ Complete list of currently available key bindings:
 		   :help-echo "Refresh"
 		   (notmuch-hello-nice-number
 		    (string-to-number
-		     (car (notmuch--process-lines notmuch-command "count")))))
+		     (car (notmuch--process-lines notmuch-command "count" "--exclude=false")))))
     (widget-insert " messages.\n")))
 
 (defun notmuch-hello-insert-saved-searches ()
-- 
2.34.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH 3/3] emacs: use --exclude=false when counting total messages
  2022-01-05  1:06         ` [PATCH 3/3] emacs: use --exclude=false when counting total messages David Bremner
@ 2022-01-05 11:41           ` David Bremner
  0 siblings, 0 replies; 18+ messages in thread
From: David Bremner @ 2022-01-05 11:41 UTC (permalink / raw)
  To: Notmuch Mail

David Bremner <david@tethera.net> writes:

> Even if a user excludes a large fraction of their messages, they still
> nonetheless exist and are searchable.
> ---
>  emacs/notmuch-hello.el | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
> index fcf7a6aa..cd7ac39c 100644
> --- a/emacs/notmuch-hello.el
> +++ b/emacs/notmuch-hello.el
> @@ -785,7 +785,7 @@ Complete list of currently available key bindings:
>  		   :help-echo "Refresh"
>  		   (notmuch-hello-nice-number
>  		    (string-to-number
> -		     (car (notmuch--process-lines notmuch-command "count")))))
> +		     (car (notmuch--process-lines notmuch-command "count" "--exclude=false")))))
>      (widget-insert " messages.\n")))
>  
>  (defun notmuch-hello-insert-saved-searches ()
> -- 
> 2.34.1

Oops, I forgot to mark the new test as fixed in this last commit. Fixed
in git.

d

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 1/3] test/emacs: add known broken test for hidden tags
  2022-01-05  1:06       ` [PATCH 1/3] test/emacs: add known broken test for hidden tags David Bremner
  2022-01-05  1:06         ` [PATCH 2/3] emacs: use --exclude=false when checking for empty searches David Bremner
  2022-01-05  1:06         ` [PATCH 3/3] emacs: use --exclude=false when counting total messages David Bremner
@ 2022-01-20 19:49         ` David Bremner
  2 siblings, 0 replies; 18+ messages in thread
From: David Bremner @ 2022-01-20 19:49 UTC (permalink / raw)
  To: Tomi Ollila, Gregor Zattler, Notmuch Mail

David Bremner <david@tethera.net> writes:

> Gregor Zattler observed that tags could be unintentionally hidden in
> the "All tags" view, and Tomi Ollia worked out [2] that the issue was tags
> that only occured on excluded messages. This test reproduces that bug.
>
> [1]: id:87wox1vovj.fsf@len.workgroup
> [2]: id:m28t9faaim.fsf@guru.guru-group.fi

Applied the series to master, with two trivial changes: one to
indentation, one to capitalization.

Interdiff follows.

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index cd7ac39c..9ac52c11 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -570,7 +570,7 @@ options will be handled as specified for
 					    (plist-get options :filter))))
 	 "\n")))
     (unless (= (notmuch--call-process-region (point-min) (point-max) notmuch-command
-				    t t nil "count" "--exclude=false" "--batch") 0)
+					     t t nil "count" "--exclude=false" "--batch") 0)
       (notmuch-logged-error
        "notmuch count --batch failed"
        "Please check that the notmuch CLI is new enough to support `count
diff --git a/test/T440-emacs-hello.sh b/test/T440-emacs-hello.sh
index d9d28f8e..842781a4 100755
--- a/test/T440-emacs-hello.sh
+++ b/test/T440-emacs-hello.sh
@@ -68,7 +68,7 @@ test_emacs '(notmuch-hello)
 notmuch tag -$tag '*'
 test_expect_equal_file $EXPECTED/notmuch-hello-long-names OUTPUT
 
-test_begin_subtest "All Tags show up"
+test_begin_subtest "All tags show up"
 tag=exclude_me
 notmuch tag +$tag '*'
 notmuch config set search.exclude_tags $tag

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: Bug? notmuch-emacs: "All tags" in notmuch-hello does not show all tags
  2018-04-22  8:52     ` Tomi Ollila
  2022-01-05  1:06       ` [PATCH 1/3] test/emacs: add known broken test for hidden tags David Bremner
@ 2022-01-20 19:51       ` David Bremner
  2022-01-22 14:14         ` confirm bug fixed (was: Bug? notmuch-emacs: "All tags" in notmuch-hello does not show all tags) Gregor Zattler
  1 sibling, 1 reply; 18+ messages in thread
From: David Bremner @ 2022-01-20 19:51 UTC (permalink / raw)
  To: Tomi Ollila, Gregor Zattler, Notmuch Mail

Tomi Ollila <tomi.ollila@iki.fi> writes:

> On Sun, Apr 22 2018, Gregor Zattler wrote:
>
>> Hi Tomi, notmuch-emacs developers,
>> * Tomi Ollila <tomi.ollila@iki.fi> [2018-04-21; 20:38]:
>> [...]
>>> That doesn't mean there could not be a bug there, just
>>> that I cannot reproduce it...
>>
>> Thanks for your investigation.
>>
>> I now prepared a minimal example, please extract the archive in
>> /tmp.  It contains a quite minmalistic .notmuch-config, a Maildir
>> with one email and a test script which runs notmuch new, notmuch
>> tag, starts emacs with no configuration and hopefully shows
>> notmuch-hello.[1] Please klick on "show", you'll see only one
>> tag: "spam", klick on "spam" you'll see this one email shown with
>> its four (!) tags: "inbox", "new" and "certaintag" are not shown
>> in "All tags".
>>
>> At least this is what I see with emacs25 and emacs27 and current
>> notmuch.
>>
>> Do you see the same?
>
>
> Yes, I can reproduce -- only "spam" is seen
>
> To look what happened I ran (in notmuch source dir):
>
> $ NOTMUCH_CONFIG=/tmp/.notmuch-config strace -f -e trace=execve,read,write -o ttt ./devel/try-emacs-mua -Q
>
> based on that output:
>
> $ NOTMUCH_CONFIG=/tmp/.notmuch-config notmuch search --output=tags '*'
> certaintag
> inbox
> new
> spam
>
> $ NOTMUCH_CONFIG=/tmp/.notmuch-config notmuch count --batch
> tag:certaintag
> 0
> tag:new
> 0
> tag:spam
> 1
> tag:inbox
> 0
> tag:foobar
> 0
>
> NOTMUCH_CONFIG=/tmp/.notmuch-config notmuch count --batch --exclude=false
> tag:certaintag
> 1
> tag:new
> 1
> tag:spam
> 1
> tag:inbox
> 1
>
> 1
> tag:foobar
> 0
>
> So, currently, whenever count is zero, the tag is now shown in all tags
> listing (but we know we have the tag since queried earlier). But, at least
> in this case we should get real count and have that '--exclude=false' there,
> and then the count is always positive number.
>
> At least some SMOP is required to get this fixed.
>
> Tomi

This bug should be fixed in commit

     cc180507b03d9826c92d48ee91dbd9bb5f15cd56

d

^ permalink raw reply	[flat|nested] 18+ messages in thread

* confirm bug fixed (was: Bug? notmuch-emacs: "All tags" in notmuch-hello does not show all tags)
  2022-01-20 19:51       ` Bug? notmuch-emacs: "All tags" in notmuch-hello does not show all tags David Bremner
@ 2022-01-22 14:14         ` Gregor Zattler
  2022-01-22 15:25           ` David Bremner
  0 siblings, 1 reply; 18+ messages in thread
From: Gregor Zattler @ 2022-01-22 14:14 UTC (permalink / raw)
  To: notmuch

Hi David, Tomi, notmuch developers,
* David Bremner <david@tethera.net> [2022-01-20; 15:51]:
> Tomi Ollila <tomi.ollila@iki.fi> writes:
>> Yes, I can reproduce -- only "spam" is seen
>>
>> To look what happened I ran (in notmuch source dir):
>>
>> $ NOTMUCH_CONFIG=/tmp/.notmuch-config strace -f -e trace=execve,read,write -o ttt ./devel/try-emacs-mua -Q
>>
>> based on that output:
>>
>> $ NOTMUCH_CONFIG=/tmp/.notmuch-config notmuch search --output=tags '*'
>> certaintag
>> inbox
>> new
>> spam
>>
>> $ NOTMUCH_CONFIG=/tmp/.notmuch-config notmuch count --batch
>> tag:certaintag
>> 0
>> tag:new
>> 0
>> tag:spam
>> 1
>> tag:inbox
>> 0
>> tag:foobar
>> 0
>>
>> NOTMUCH_CONFIG=/tmp/.notmuch-config notmuch count --batch --exclude=false
>> tag:certaintag
>> 1
>> tag:new
>> 1
>> tag:spam
>> 1
>> tag:inbox
>> 1
>>
>> 1
>> tag:foobar
>> 0
>>
>> So, currently, whenever count is zero, the tag is now shown in all tags
>> listing (but we know we have the tag since queried earlier). But, at least
>> in this case we should get real count and have that '--exclude=false' there,
>> and then the count is always positive number.
>>
>> At least some SMOP is required to get this fixed.

> This bug should be fixed in commit
>
>      cc180507b03d9826c92d48ee91dbd9bb5f15cd56

I confirm, the bug does not show up in my test case from
message id:877ep0kx52.fsf@len.workgroup

Thanks for this bug fix and for notmuch in general, Gregor

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: confirm bug fixed (was: Bug? notmuch-emacs: "All tags" in notmuch-hello does not show all tags)
  2022-01-22 14:14         ` confirm bug fixed (was: Bug? notmuch-emacs: "All tags" in notmuch-hello does not show all tags) Gregor Zattler
@ 2022-01-22 15:25           ` David Bremner
  2022-01-22 17:44             ` Attempt 2 to fix the all-tags display with excludes David Bremner
  0 siblings, 1 reply; 18+ messages in thread
From: David Bremner @ 2022-01-22 15:25 UTC (permalink / raw)
  To: Gregor Zattler, notmuch

Gregor Zattler <telegraph@gmx.net> writes:
> I confirm, the bug does not show up in my test case from
> message id:877ep0kx52.fsf@len.workgroup
>
> Thanks for this bug fix and for notmuch in general, Gregor

Hey, thanks for checking. I think the fix may have broken something
else, since now the counts displayed have have excludes turned off
(which makes e.g. my inbox look much larger). I'll have to try to
understand this bit of code better.

d

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Attempt 2 to fix the all-tags display with excludes
  2022-01-22 15:25           ` David Bremner
@ 2022-01-22 17:44             ` David Bremner
  2022-01-22 17:44               ` [PATCH 1/2] Revert "emacs: use --exclude=false when checking for empty searches" David Bremner
  2022-01-22 17:44               ` [PATCH 2/2] emacs: define, use option :disable-excludes for n-h-query-counts David Bremner
  0 siblings, 2 replies; 18+ messages in thread
From: David Bremner @ 2022-01-22 17:44 UTC (permalink / raw)
  To: David Bremner, Gregor Zattler, notmuch

The previous fix applied to master was too broad, and turned of
excludes for all counts in notmuch hello. This made the message counts
potentially inflated compared to the searches that actually show up
for saved searches. This fix treats "all tags" as a special case, but
leaves the behaviour of user defined saved searches unaffected.


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 1/2] Revert "emacs: use --exclude=false when checking for empty searches"
  2022-01-22 17:44             ` Attempt 2 to fix the all-tags display with excludes David Bremner
@ 2022-01-22 17:44               ` David Bremner
  2022-01-22 17:44               ` [PATCH 2/2] emacs: define, use option :disable-excludes for n-h-query-counts David Bremner
  1 sibling, 0 replies; 18+ messages in thread
From: David Bremner @ 2022-01-22 17:44 UTC (permalink / raw)
  To: David Bremner, Gregor Zattler, notmuch

Revert commit 8370e3cfe2dd8a79323613c2bbf2f11db6134dac, and remark the
corresponding test as broken. Also update the expected output of the
broken test to show excludes active in the user defined saved searches.
---
 emacs/notmuch-hello.el                            | 2 +-
 test/T440-emacs-hello.sh                          | 1 +
 test/emacs.expected-output/notmuch-hello-all-tags | 4 ----
 3 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 9ac52c11..71e91093 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -570,7 +570,7 @@ options will be handled as specified for
 					    (plist-get options :filter))))
 	 "\n")))
     (unless (= (notmuch--call-process-region (point-min) (point-max) notmuch-command
-					     t t nil "count" "--exclude=false" "--batch") 0)
+				    t t nil "count" "--batch") 0)
       (notmuch-logged-error
        "notmuch count --batch failed"
        "Please check that the notmuch CLI is new enough to support `count
diff --git a/test/T440-emacs-hello.sh b/test/T440-emacs-hello.sh
index 842781a4..dc80cc75 100755
--- a/test/T440-emacs-hello.sh
+++ b/test/T440-emacs-hello.sh
@@ -69,6 +69,7 @@ notmuch tag -$tag '*'
 test_expect_equal_file $EXPECTED/notmuch-hello-long-names OUTPUT
 
 test_begin_subtest "All tags show up"
+test_subtest_known_broken
 tag=exclude_me
 notmuch tag +$tag '*'
 notmuch config set search.exclude_tags $tag
diff --git a/test/emacs.expected-output/notmuch-hello-all-tags b/test/emacs.expected-output/notmuch-hello-all-tags
index 2802a708..65e479fa 100644
--- a/test/emacs.expected-output/notmuch-hello-all-tags
+++ b/test/emacs.expected-output/notmuch-hello-all-tags
@@ -1,9 +1,5 @@
    Welcome to notmuch. You have 52 messages.
 
-Saved searches: [edit]
-
-	  52 inbox           52 unread          52 all mail
-
 Search:                                                                     .
 
 All tags: [hide]
-- 
2.34.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 2/2] emacs:  define, use option :disable-excludes for n-h-query-counts
  2022-01-22 17:44             ` Attempt 2 to fix the all-tags display with excludes David Bremner
  2022-01-22 17:44               ` [PATCH 1/2] Revert "emacs: use --exclude=false when checking for empty searches" David Bremner
@ 2022-01-22 17:44               ` David Bremner
  2022-01-23 19:00                 ` David Bremner
  1 sibling, 1 reply; 18+ messages in thread
From: David Bremner @ 2022-01-22 17:44 UTC (permalink / raw)
  To: David Bremner, Gregor Zattler, notmuch

Initially only use in notmuch-hello-insert-alltags. This is a more
narrow resolution of [1], which (unlike [2]) does not disable exclude
processing for regular saved searches.

[1]: id:87wox1vovj.fsf@len.workgroup
[2]: id:20220105010606.2034601-2-david@tethera.net
---
 emacs/notmuch-hello.el | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 71e91093..581e7f3a 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -557,7 +557,8 @@ with any properties in the original saved-search.
 
 The values :show-empty-searches, :filter and :filter-count from
 options will be handled as specified for
-`notmuch-hello-insert-searches'."
+`notmuch-hello-insert-searches'. :disable-includes can be used to
+turn off the default exclude processing in `notmuch-count(1)'"
   (with-temp-buffer
     (dolist (elem query-list nil)
       (let ((count-query (or (notmuch-saved-search-get elem :count-query)
@@ -570,7 +571,11 @@ options will be handled as specified for
 					    (plist-get options :filter))))
 	 "\n")))
     (unless (= (notmuch--call-process-region (point-min) (point-max) notmuch-command
-				    t t nil "count" "--batch") 0)
+					     t t nil "count"
+					     (if (plist-get options :disable-excludes)
+						 "--exclude=false"
+					       "--exclude=true")
+					     "--batch") 0)
       (notmuch-logged-error
        "notmuch count --batch failed"
        "Please check that the notmuch CLI is new enough to support `count
@@ -917,7 +922,8 @@ following:
    nil
    :initially-hidden (not notmuch-show-all-tags-list)
    :hide-tags notmuch-hello-hide-tags
-   :filter notmuch-hello-tag-list-make-query))
+   :filter notmuch-hello-tag-list-make-query
+   :disable-excludes t))
 
 (defun notmuch-hello-insert-footer ()
   "Insert the notmuch-hello footer."
-- 
2.34.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/2] emacs:  define, use option :disable-excludes for n-h-query-counts
  2022-01-22 17:44               ` [PATCH 2/2] emacs: define, use option :disable-excludes for n-h-query-counts David Bremner
@ 2022-01-23 19:00                 ` David Bremner
  2022-01-23 19:36                   ` Gregor Zattler
  0 siblings, 1 reply; 18+ messages in thread
From: David Bremner @ 2022-01-23 19:00 UTC (permalink / raw)
  To: Gregor Zattler, notmuch

David Bremner <david@tethera.net> writes:

> Initially only use in notmuch-hello-insert-alltags. This is a more
> narrow resolution of [1], which (unlike [2]) does not disable exclude
> processing for regular saved searches.

I applied this series to master.

d

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/2] emacs:  define, use option :disable-excludes for n-h-query-counts
  2022-01-23 19:00                 ` David Bremner
@ 2022-01-23 19:36                   ` Gregor Zattler
  2022-01-24  2:54                     ` David Bremner
  0 siblings, 1 reply; 18+ messages in thread
From: Gregor Zattler @ 2022-01-23 19:36 UTC (permalink / raw)
  To: notmuch

Hi David,
* David Bremner <david@tethera.net> [2022-01-23; 15:00]:
> David Bremner <david@tethera.net> writes:
>
>> Initially only use in notmuch-hello-insert-alltags. This is a more
>> narrow resolution of [1], which (unlike [2]) does not disable exclude
>> processing for regular saved searches.
>
> I applied this series to master.

I confirm again, the bug does not show up in my test case
from message id:877ep0kx52.fsf@len.workgroup.  The test case
mail corpus (n = 1) is definitely too small to uncover the
bug David found in the first attempt to fix the bug.

Thanks, Gregor

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/2] emacs:  define, use option :disable-excludes for n-h-query-counts
  2022-01-23 19:36                   ` Gregor Zattler
@ 2022-01-24  2:54                     ` David Bremner
  0 siblings, 0 replies; 18+ messages in thread
From: David Bremner @ 2022-01-24  2:54 UTC (permalink / raw)
  To: Gregor Zattler, notmuch

Gregor Zattler <telegraph@gmx.net> writes:

> Hi David,
> * David Bremner <david@tethera.net> [2022-01-23; 15:00]:
>> David Bremner <david@tethera.net> writes:
>>
>>> Initially only use in notmuch-hello-insert-alltags. This is a more
>>> narrow resolution of [1], which (unlike [2]) does not disable exclude
>>> processing for regular saved searches.
>>
>> I applied this series to master.
>
> I confirm again, the bug does not show up in my test case
> from message id:877ep0kx52.fsf@len.workgroup.  The test case
> mail corpus (n = 1) is definitely too small to uncover the
> bug David found in the first attempt to fix the bug.
>

Great, so hopefully I didn't break anything else this time :)

d

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2022-01-24  2:54 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-20 16:12 Bug? notmuch-emacs: "All tags" in notmuch-hello does not show all tags Gregor Zattler
2018-04-21 17:38 ` Tomi Ollila
2018-04-21 22:33   ` Gregor Zattler
2018-04-22  8:52     ` Tomi Ollila
2022-01-05  1:06       ` [PATCH 1/3] test/emacs: add known broken test for hidden tags David Bremner
2022-01-05  1:06         ` [PATCH 2/3] emacs: use --exclude=false when checking for empty searches David Bremner
2022-01-05  1:06         ` [PATCH 3/3] emacs: use --exclude=false when counting total messages David Bremner
2022-01-05 11:41           ` David Bremner
2022-01-20 19:49         ` [PATCH 1/3] test/emacs: add known broken test for hidden tags David Bremner
2022-01-20 19:51       ` Bug? notmuch-emacs: "All tags" in notmuch-hello does not show all tags David Bremner
2022-01-22 14:14         ` confirm bug fixed (was: Bug? notmuch-emacs: "All tags" in notmuch-hello does not show all tags) Gregor Zattler
2022-01-22 15:25           ` David Bremner
2022-01-22 17:44             ` Attempt 2 to fix the all-tags display with excludes David Bremner
2022-01-22 17:44               ` [PATCH 1/2] Revert "emacs: use --exclude=false when checking for empty searches" David Bremner
2022-01-22 17:44               ` [PATCH 2/2] emacs: define, use option :disable-excludes for n-h-query-counts David Bremner
2022-01-23 19:00                 ` David Bremner
2022-01-23 19:36                   ` Gregor Zattler
2022-01-24  2:54                     ` David Bremner

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).