[PATCH 1/2] Vim: Respect excluded tags when showing a thread

classic Classic list List threaded Threaded
10 messages Options
Jules Aguillon Jules Aguillon
Reply | Threaded
Open this post in threaded view
|

[PATCH 1/2] Vim: Respect excluded tags when showing a thread

Other queries have exclude_tags taken into account but this one.
This is annoying when using an excluded tag to ignore past messages from a
thread (for example the 'deleted' tag), the entire thread is shown all the
time.
---
 NEWS            | 5 +++++
 vim/notmuch.vim | 3 +++
 2 files changed, 8 insertions(+)

diff --git a/NEWS b/NEWS
index 6484567e..325acf22 100644
--- a/NEWS
+++ b/NEWS
@@ -16,6 +16,11 @@ Library
 
 Fix for memory error in notmuch_database_get_config_list
 
+Vim
+---
+
+Respect excluded tags when showing a thread.
+
 Notmuch 0.31.2 (2020-11-08)
 ===========================
 
diff --git a/vim/notmuch.vim b/vim/notmuch.vim
index ad8b7c80..4c7add3b 100644
--- a/vim/notmuch.vim
+++ b/vim/notmuch.vim
@@ -317,6 +317,9 @@ ruby << EOF
  $curbuf.render do |b|
  q = $curbuf.query(get_cur_view)
  q.sort = Notmuch::SORT_OLDEST_FIRST
+ $exclude_tags.each { |t|
+ q.add_tag_exclude(t)
+ }
  msgs = q.search_messages
  msgs.each do |msg|
  m = Mail.read(msg.filename)
--
2.30.0
_______________________________________________
notmuch mailing list -- [hidden email]
To unsubscribe send an email to [hidden email]
Jules Aguillon Jules Aguillon
Reply | Threaded
Open this post in threaded view
|

[PATCH 2/2] Vim: Ensure that every queries respect excluded tags

This makes sure that the bug solved by the previous commit won't happen again
and remove some dupplication.
This shouldn't have any side effect.
---
 vim/notmuch.vim | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/vim/notmuch.vim b/vim/notmuch.vim
index 4c7add3b..d5f4f3a7 100644
--- a/vim/notmuch.vim
+++ b/vim/notmuch.vim
@@ -317,9 +317,6 @@ ruby << EOF
  $curbuf.render do |b|
  q = $curbuf.query(get_cur_view)
  q.sort = Notmuch::SORT_OLDEST_FIRST
- $exclude_tags.each { |t|
- q.add_tag_exclude(t)
- }
  msgs = q.search_messages
  msgs.each do |msg|
  m = Mail.read(msg.filename)
@@ -643,9 +640,6 @@ ruby << EOF
  $searches.clear
  folders.each do |name, search|
  q = $curbuf.query(search)
- $exclude_tags.each { |t|
- q.add_tag_exclude(t)
- }
  $searches << search
  count = count_threads ? q.count_threads : q.count_messages
  b << "%9d %-20s (%s)" % [count, name, search]
@@ -657,9 +651,6 @@ ruby << EOF
  date_fmt = VIM::evaluate('g:notmuch_date_format')
  q = $curbuf.query(search)
  q.sort = Notmuch::SORT_NEWEST_FIRST
- $exclude_tags.each { |t|
- q.add_tag_exclude(t)
- }
  $threads.clear
  t = q.search_threads
 
@@ -711,6 +702,9 @@ ruby << EOF
  def query(*args)
  q = @db.query(*args)
  @queries << q
+ $exclude_tags.each { |t|
+    q.add_tag_exclude(t)
+ }
  q
  end
 
--
2.30.0
_______________________________________________
notmuch mailing list -- [hidden email]
To unsubscribe send an email to [hidden email]
David Bremner-2 David Bremner-2
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 1/2] Vim: Respect excluded tags when showing a thread

In reply to this post by Jules Aguillon
Jules Aguillon <[hidden email]> writes:

> Other queries have exclude_tags taken into account but this one.
> This is annoying when using an excluded tag to ignore past messages from a
> thread (for example the 'deleted' tag), the entire thread is shown all the

Hi;

The two of you are the most recent submitters of patches [1] to the vim
frontend for notmuch. You might want to consider helping test and/or
review each other's patches.

d

[1]: https://nmbug.notmuchmail.org/nmweb/search/vim
_______________________________________________
notmuch mailing list -- [hidden email]
To unsubscribe send an email to [hidden email]
Felipe Contreras Felipe Contreras
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 1/2] Vim: Respect excluded tags when showing a thread

On Fri, Apr 23, 2021 at 7:23 AM David Bremner <[hidden email]> wrote:

>
> Jules Aguillon <[hidden email]> writes:
>
> > Other queries have exclude_tags taken into account but this one.
> > This is annoying when using an excluded tag to ignore past messages from a
> > thread (for example the 'deleted' tag), the entire thread is shown all the
>
> The two of you are the most recent submitters of patches [1] to the vim
> frontend for notmuch. You might want to consider helping test and/or
> review each other's patches.

I don't need to test it, the patch is obviously correct.

Reviewed-by: Felipe Contreras <[hidden email]>

--
Felipe Contreras
_______________________________________________
notmuch mailing list -- [hidden email]
To unsubscribe send an email to [hidden email]
David Bremner-2 David Bremner-2
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 1/2] Vim: Respect excluded tags when showing a thread

Felipe Contreras <[hidden email]> writes:
>
> I don't need to test it, the patch is obviously correct.
>
> Reviewed-by: Felipe Contreras <[hidden email]>

Famous last words ;). But OK, applied to master.

d
_______________________________________________
notmuch mailing list -- [hidden email]
To unsubscribe send an email to [hidden email]
Felipe Contreras Felipe Contreras
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 1/2] Vim: Respect excluded tags when showing a thread

On Mon, Apr 26, 2021 at 6:39 PM David Bremner <[hidden email]> wrote:
>
> Felipe Contreras <[hidden email]> writes:
> >
> > I don't need to test it, the patch is obviously correct.
> >
> > Reviewed-by: Felipe Contreras <[hidden email]>
>
> Famous last words ;). But OK, applied to master.

Er, I acked the first patch, not the second.

The second one will likely introduce issues.

--
Felipe Contreras
_______________________________________________
notmuch mailing list -- [hidden email]
To unsubscribe send an email to [hidden email]
David Bremner-2 David Bremner-2
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 1/2] Vim: Respect excluded tags when showing a thread

Felipe Contreras <[hidden email]> writes:

> On Mon, Apr 26, 2021 at 6:39 PM David Bremner <[hidden email]> wrote:
>>
>> Felipe Contreras <[hidden email]> writes:
>> >
>> > I don't need to test it, the patch is obviously correct.
>> >
>> > Reviewed-by: Felipe Contreras <[hidden email]>
>>
>> Famous last words ;). But OK, applied to master.
>
> Er, I acked the first patch, not the second.
>
> The second one will likely introduce issues.

OK, let me know if I should revert the second patch.

d
_______________________________________________
notmuch mailing list -- [hidden email]
To unsubscribe send an email to [hidden email]
Felipe Contreras Felipe Contreras
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 1/2] Vim: Respect excluded tags when showing a thread

On Tue, Apr 27, 2021 at 3:09 PM David Bremner <[hidden email]> wrote:

>
> Felipe Contreras <[hidden email]> writes:
>
> > On Mon, Apr 26, 2021 at 6:39 PM David Bremner <[hidden email]> wrote:
> >>
> >> Felipe Contreras <[hidden email]> writes:
> >> >
> >> > I don't need to test it, the patch is obviously correct.
> >> >
> >> > Reviewed-by: Felipe Contreras <[hidden email]>
> >>
> >> Famous last words ;). But OK, applied to master.
> >
> > Er, I acked the first patch, not the second.
> >
> > The second one will likely introduce issues.
>
> OK, let me know if I should revert the second patch.

Yes please.

--
Felipe Contreras
_______________________________________________
notmuch mailing list -- [hidden email]
To unsubscribe send an email to [hidden email]
Felipe Contreras Felipe Contreras
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 2/2] Vim: Ensure that every queries respect excluded tags

In reply to this post by Jules Aguillon
On Tue, Feb 16, 2021 at 5:43 PM Jules Aguillon <[hidden email]> wrote:
>
> This makes sure that the bug solved by the previous commit won't happen again
> and remove some dupplication.
> This shouldn't have any side effect.

At least Aaron D Borden did mention some issues with this approach [1].

From my cursory look at this patch this would cause the do_tag()
function to skip excluded tags, therefore you couldn't do for example
"-delete".

I think the query() helper could be extended to make it easier to pass
excluded_tags, but this is not the way.

Cheers.

[1] https://github.com/felipec/notmuch-vim/pull/7

--
Felipe Contreras
_______________________________________________
notmuch mailing list -- [hidden email]
To unsubscribe send an email to [hidden email]
David Bremner-2 David Bremner-2
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 1/2] Vim: Respect excluded tags when showing a thread

In reply to this post by Felipe Contreras
Felipe Contreras <[hidden email]> writes:

> On Tue, Apr 27, 2021 at 3:09 PM David Bremner <[hidden email]> wrote:
>>
>> Felipe Contreras <[hidden email]> writes:
>>
>> OK, let me know if I should revert the second patch.
>
> Yes please.
>
> --
> Felipe Contreras

reverted (on master; it was never on release).
_______________________________________________
notmuch mailing list -- [hidden email]
To unsubscribe send an email to [hidden email]