Re: [PATCH] Fix notmuch-mua.el notmuch-mua-mail

2022-05-23 Thread Damien Cassou
Here is a new version of the patch that takes into account the fact that notmuch-mua-mail can also be called interactively by notmuch and not only through the mail-user-agent variable. -- Damien Cassou "Success is the ability to go from one failure to another without losing enthusiasm."

RFC: drop notmuch_private_status_t, or use it better?

2022-05-23 Thread David Bremner
This is probably mostly my fault, but we have not really taken advantage of having a private set of status values, and defined only one private status value since 2010. Currently they are mainly a source of extra code (to coerce return values) and potential for error (if / when they get out of

Re: moving mail to another maildir based on tags and renaming files

2022-05-23 Thread inwit
On Mon May 23, 2022 at 11:02 PM CEST, erik colson wrote: > So I wanted to check if somebody else already wrote some > bash/perl/whatever script which handles this ? I did. I replicate folder and tags with this dirty script: https://paste.sr.ht/~inwit/018642e5c1cae1e57ae449006b6ed5087ae964d0 You

Re: moving mail to another maildir based on tags and renaming files

2022-05-23 Thread erik colson
"inwit" writes: > If you have questions, do ask! Do I understand correctly that I only have to remove the U=... part from the filename when moving a message? That seems so easy I hardly believe it ;) best -- erik colson ___ notmuch mailing list --

moving mail to another maildir based on tags and renaming files

2022-05-23 Thread erik colson
Hi, I would like to move mails selected by a notmuch query (i.e. "tag:movethismailtobox-ThisBox") to *ThisBox* I need this to somewhat still have usable access through my phone IMAP client. I am actually using afew already, but as I have 1000+ mailboxes it is unmaintainable to create the rules

[PATCH 2/8] lib/message: catch exceptions in _n_m_add_term

2022-05-23 Thread David Bremner
Some code movement is needed to make sure the cache is only invalidated when the Xapian operation succeeds. --- lib/message.cc | 27 +-- test/T566-lib-message.sh | 17 + 2 files changed, 34 insertions(+), 10 deletions(-) diff --git

[PATCH 6/8] lib/message: check return status of _n_m_{add,remove}_term

2022-05-23 Thread David Bremner
Xapian exceptions are not something that can be ignored, in general. --- lib/message.cc | 43 ++- 1 file changed, 34 insertions(+), 9 deletions(-) diff --git a/lib/message.cc b/lib/message.cc index 09e5660b..94be0f76 100644 --- a/lib/message.cc +++

[PATCH 8/8] test: error handling in _n_message_{add,remove}_filename

2022-05-23 Thread David Bremner
Use a closed database to force throwing a Xapian exception. Leave the check vague to accomodate a potential explicit check for open database. --- test/T566-lib-message.sh | 32 1 file changed, 32 insertions(+) diff --git a/test/T566-lib-message.sh

[PATCH 5/8] lib: define macro NODISCARD

2022-05-23 Thread David Bremner
In either C++17 (or later) mode, or when running cppcheck, this can be used to selectively generate warnings about discarded return values. --- lib/notmuch-private.h | 6 ++ 1 file changed, 6 insertions(+) diff --git a/lib/notmuch-private.h b/lib/notmuch-private.h index c63cfe5e..1c2290b2

[PATCH 3/8] test: _notmuch_message_remove_term catches exceptions.

2022-05-23 Thread David Bremner
Unfortunately we can't differentiate between the two distinct error conditions for Document::remove_term. --- test/T566-lib-message.sh | 18 ++ 1 file changed, 18 insertions(+) diff --git a/test/T566-lib-message.sh b/test/T566-lib-message.sh index 08ab2765..5b6c937e 100755 ---

[PATCH 4/8] lib/message: drop _notmuch_message_get_thread_id_only

2022-05-23 Thread David Bremner
This function has been unused since commit 4083fd8. --- lib/message.cc| 17 - lib/notmuch-private.h | 3 --- 2 files changed, 20 deletions(-) diff --git a/lib/message.cc b/lib/message.cc index bf3a3419..09e5660b 100644 --- a/lib/message.cc +++ b/lib/message.cc @@ -340,23

incrementally improve error handling in notmuch_message*

2022-05-23 Thread David Bremner
There is more that can be done, but this is a start. The series introduces a new test primitive test_private_C, for directly unit testing non-exported functions, and new macro NODISCARD to get the compiler to help tracking down places a particular function's return value is discarded. As a bonus,

[PATCH 7/8] lib/message: check return status from _n_m_add_{path,folder}_terms

2022-05-23 Thread David Bremner
Mainly to propagate information about Xapian exceptions. --- lib/message.cc | 23 +-- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/lib/message.cc b/lib/message.cc index 94be0f76..ae152df7 100644 --- a/lib/message.cc +++ b/lib/message.cc @@ -791,7 +791,7 @@

[PATCH 1/8] test: define test_private_C

2022-05-23 Thread David Bremner
When testing error handling, it is sometimes difficult to cover a particular error path deterministically. Introduce a test function to allow calling lower level functions directly. --- configure| 16 test/test-lib.sh | 13 + 2 files changed, 29 insertions(+)

Re: moving mail to another maildir based on tags and renaming files

2022-05-23 Thread João Pedro
On Mon, May 23 2022 23:02, erik colson wrote: > Hi, > > I would like to move mails selected by a notmuch query > (i.e. "tag:movethismailtobox-ThisBox") to *ThisBox* > I need this to somewhat still have usable access through my phone IMAP > client. What I have is tags that represent IMAP