Re: [PATCH] emacs: Add notmuch-show-local-dates option

2020-07-05 Thread Daniel Kahn Gillmor
On Fri 2020-07-03 19:58:23 -0300, David Bremner wrote: > The bikeshed must be blue! Uh, I mean what about narrowish screens (80 > columns or so) and or deeply indented threads? You mean what should happen to messages with headers that are much longer, like: To: David Bremner , Kevin Foley , notm

[PATCH 02/11] lib: use LOG_XAPIAN_EXCEPTION in n_m_get_date

2020-07-05 Thread David Bremner
This should not change functionality, but does slightly reduce code duplication. Perhaps more importantly it allows consistent changes to all of the similar exception handling in message.cc. --- lib/message.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/message.cc b/

[PATCH 08/11] lib: catch Xapian exceptions in n_m_add_tag

2020-07-05 Thread David Bremner
This is mostly just (horizontal) code movement due to wrapping everything in a try / catch. --- lib/message.cc | 34 -- test/T560-lib-error.sh | 1 - 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/lib/message.cc b/lib/message.cc index b7d7

[PATCH 05/11] lib: add known broken test for n_m_count_files

2020-07-05 Thread David Bremner
This will be fixed in the next commit. --- test/T560-lib-error.sh | 17 + 1 file changed, 17 insertions(+) diff --git a/test/T560-lib-error.sh b/test/T560-lib-error.sh index cda3df78..8207727e 100755 --- a/test/T560-lib-error.sh +++ b/test/T560-lib-error.sh @@ -502,5 +502,22 @@ ca

[PATCH 06/11] lib: catch Xapian exceptions in n_m_count_files

2020-07-05 Thread David Bremner
This will require some care for the caller to check the sign, and not just add error returns into a running total. --- lib/message.cc | 7 ++- lib/notmuch.h | 3 ++- test/T560-lib-error.sh | 1 - 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/message.cc b/l

[PATCH 09/11] test: add broken test for n_m_remove_tag

2020-07-05 Thread David Bremner
Exception will be caught in next commit. --- test/T560-lib-error.sh | 17 + 1 file changed, 17 insertions(+) diff --git a/test/T560-lib-error.sh b/test/T560-lib-error.sh index 7de13bb3..4640e2c9 100755 --- a/test/T560-lib-error.sh +++ b/test/T560-lib-error.sh @@ -534,4 +534,21 @@

[PATCH 11/11] lib: use COERCE_STATUS in n_m_{add,remove}_tag

2020-07-05 Thread David Bremner
Currently I don't know of a good way of testing this, but at least in principle a Xapian exception in _notmuch_message_{add,remove}_term would cause an abort in the library. --- lib/message.cc | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/message.cc b/lib/messa

[PATCH 01/11] lib: add regression test for n_m_get_date; clarify API

2020-07-05 Thread David Bremner
This function catches Xapian exceptions. The test is intended to make sure it stays that way. --- lib/notmuch.h | 2 ++ test/T560-lib-error.sh | 16 2 files changed, 18 insertions(+) diff --git a/lib/notmuch.h b/lib/notmuch.h index c7b21060..b7de7652 100644 --- a/lib/no

[PATCH 04/11] lib: catch Xapian exceptions in n_m_get_tags

2020-07-05 Thread David Bremner
This allows the function to return an error value rather than crashing. --- lib/message.cc | 7 ++- test/T560-lib-error.sh | 1 - 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/message.cc b/lib/message.cc index 6d78663b..9b7d4bc4 100644 --- a/lib/message.cc +++ b/li

Third batch of API cleanup for exception safety

2020-07-05 Thread David Bremner
This is a continuation of id:20200704151805.3717715-1-da...@tethera.net and probably needs to be applied on top. There are two patches not fitting the pattern of "add test" or "add try/catch to fix test". [PATCH 02/11] lib: use LOG_XAPIAN_EXCEPTION in n_m_get_date [PATCH 11/11] lib: use CO

[PATCH 07/11] test: add known broken test for n_m_add_tag with closed db

2020-07-05 Thread David Bremner
Exception will be caught in next commit. --- test/T560-lib-error.sh | 16 1 file changed, 16 insertions(+) diff --git a/test/T560-lib-error.sh b/test/T560-lib-error.sh index 507e0e07..f3e126e3 100755 --- a/test/T560-lib-error.sh +++ b/test/T560-lib-error.sh @@ -518,5 +518,21 @@ c

[PATCH 03/11] test: add known broken test for n_m_get_tags

2020-07-05 Thread David Bremner
This will be fixed in the next commit. --- test/T560-lib-error.sh | 17 + 1 file changed, 17 insertions(+) diff --git a/test/T560-lib-error.sh b/test/T560-lib-error.sh index ab7a24d1..94a0f470 100755 --- a/test/T560-lib-error.sh +++ b/test/T560-lib-error.sh @@ -486,5 +486,22 @@ ca

[PATCH 10/11] lib: catch Xapian exceptions in n_m_remove_tag

2020-07-05 Thread David Bremner
The churn here is again mainly re-indentation. --- lib/message.cc | 33 +++-- test/T560-lib-error.sh | 1 - 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/lib/message.cc b/lib/message.cc index 7c9af079..e4463d05 100644 --- a/lib/message.cc +++

Re: [PATCH 2/4] lib: catch error from closed db in n_m_get_message_id

2020-07-05 Thread David Bremner
David Bremner writes: > Floris Bruynooghe writes: > >> notmuch_database_get_version currently returns and unsigned int and >> segfaults on use with a closed db. > > Yes, the ones without a proper status value are going to be a bit work. > > In the next series I just posted [1], I started providi