[PATCH] emacs: don't add space to tag completion candidates.

2021-10-23 Thread David Bremner
Apparently this messes up various third party completion
frameworks. This change does mean that users will have to hit space
after completing a tag change in order to enter another change.

As a bonus, remove the call to #'delete, since
completing-read-multiple already promises to remove empty strings.
---
 emacs/notmuch-tag.el | 14 +++---
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el
index 536315e9..145f309f 100644
--- a/emacs/notmuch-tag.el
+++ b/emacs/notmuch-tag.el
@@ -429,17 +429,9 @@ initial input in the minibuffer."
(set-keymap-parent map crm-local-completion-map)
(define-key map " " 'self-insert-command)
map)))
-(delete "" (completing-read-multiple
-   prompt
-   ;; Append the separator to each completion so when the
-   ;; user completes a tag they can immediately begin
-   ;; entering another.  `completing-read-multiple'
-   ;; ultimately splits the input on crm-separator, so we
-   ;; don't need to strip this back off (we just need to
-   ;; delete "empty" entries caused by trailing spaces).
-   (mapcar (lambda (tag-op) (concat tag-op crm-separator)) 
tag-list)
-   nil nil initial-input
-   'notmuch-read-tag-changes-history
+(completing-read-multiple prompt tag-list
+ nil nil initial-input
+ 'notmuch-read-tag-changes-history)))
 
 ;;; Tagging
 
-- 
2.33.0
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH 4/6] lib/create: fix memory leak, ensure *database=NULL on error

2021-10-23 Thread David Bremner
This code previously relied on _finish_open to free the notmuch struct
on errors (except for the case of database == NULL, which was a
potential double free). When we removed those frees from _finish_open,
we introduced a (small) memory leak.

In this commit, fix the memory leak, and harmonize the on-error
behaviour with n_d_open_with_config.
---
 lib/open.cc| 10 --
 test/T590-libconfig.sh |  2 --
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/lib/open.cc b/lib/open.cc
index 77f01f72..6fa00a84 100644
--- a/lib/open.cc
+++ b/lib/open.cc
@@ -714,10 +714,16 @@ notmuch_database_create_with_config (const char 
*database_path,
else
free (message);
 }
+if (status && notmuch) {
+   notmuch_database_destroy (notmuch);
+   notmuch = NULL;
+}
+
 if (database)
*database = notmuch;
-else
-   talloc_free (notmuch);
+
+if (notmuch)
+   notmuch->open = true;
 return status;
 }
 
diff --git a/test/T590-libconfig.sh b/test/T590-libconfig.sh
index becb2821..77328cd7 100755
--- a/test/T590-libconfig.sh
+++ b/test/T590-libconfig.sh
@@ -891,7 +891,6 @@ EOF
 test_expect_equal_file EXPECTED OUTPUT
 
 test_begin_subtest "create: database set to null on missing config"
-test_subtest_known_broken
 cat c_head3 - c_tail3 <<'EOF' | test_C ${MAIL_DIR} "/nonexistent"
   notmuch_status_t st = notmuch_database_create_with_config(argv[1],argv[2], 
NULL, , NULL);
 EOF
@@ -903,7 +902,6 @@ EOF
 test_expect_equal_file EXPECTED OUTPUT
 
 test_begin_subtest "create: database set to null on missing config (env)"
-test_subtest_known_broken
 old_NOTMUCH_CONFIG=${NOTMUCH_CONFIG}
 NOTMUCH_CONFIG="/nonexistent"
 cat c_head3 - c_tail3 <<'EOF' | test_C ${MAIL_DIR}
-- 
2.33.0
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH 5/6] lib/load_config: document expectations for db on error, add tests

2021-10-23 Thread David Bremner
This is a bit different than n_d_{open,create}_with_config, since
there are several non-zero status codes where we do want to return a
non-NULL database structure.
---
 lib/notmuch.h  |  3 +++
 test/T590-libconfig.sh | 37 +
 2 files changed, 40 insertions(+)

diff --git a/lib/notmuch.h b/lib/notmuch.h
index 701eb814..115a6a42 100644
--- a/lib/notmuch.h
+++ b/lib/notmuch.h
@@ -458,6 +458,9 @@ notmuch_database_open_with_config (const char 
*database_path,
  *
  * For description of arguments, @see notmuch_database_open_with_config
  *
+ * For errors other then NO_DATABASE and NO_CONFIG, *database is set to
+ * NULL.
+ *
  * @retval NOTMUCH_STATUS_SUCCESS: Successfully loaded configuration.
  *
  * @retval NOTMUCH_STATUS_NO_CONFIG: No config file was loaded. Not fatal.
diff --git a/test/T590-libconfig.sh b/test/T590-libconfig.sh
index 77328cd7..e6bec872 100755
--- a/test/T590-libconfig.sh
+++ b/test/T590-libconfig.sh
@@ -916,4 +916,41 @@ db == NULL: 1
 EOF
 test_expect_equal_file EXPECTED OUTPUT
 
+test_begin_subtest "load_config: database set non-null on missing config"
+cat c_head3 - c_tail3 <<'EOF' | test_C ${MAIL_DIR} "/nonexistent"
+  notmuch_status_t st = notmuch_database_load_config(argv[1],argv[2], NULL, 
, NULL);
+EOF
+cat < EXPECTED
+== stdout ==
+db == NULL: 0
+== stderr ==
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
+test_begin_subtest "load_config: database non-null on missing config (env)"
+old_NOTMUCH_CONFIG=${NOTMUCH_CONFIG}
+NOTMUCH_CONFIG="/nonexistent"
+cat c_head3 - c_tail3 <<'EOF' | test_C ${MAIL_DIR}
+  notmuch_status_t st = notmuch_database_load_config(argv[1], NULL, NULL, , 
NULL);
+EOF
+NOTMUCH_CONFIG=${old_NOTMUCH_CONFIG}
+cat < EXPECTED
+== stdout ==
+db == NULL: 0
+== stderr ==
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
+test_begin_subtest "load_config: database set to NULL on fatal error"
+test_subtest_known_broken
+cat c_head3 - c_tail3 <<'EOF' | test_C
+  notmuch_status_t st = notmuch_database_load_config("relative", NULL, NULL, 
, NULL);
+EOF
+cat < EXPECTED
+== stdout ==
+db == NULL: 1
+== stderr ==
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
 test_done
-- 
2.33.0
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH 6/6] lib/load_config: deallocate / NULL database on fatal error

2021-10-23 Thread David Bremner
This fixes a potential memory leak, and makes the behaviour of
notmuch_database_load_config (somewhat) consistent with
n_d_{open,create} with config.
---
 lib/open.cc| 7 +++
 test/T590-libconfig.sh | 1 -
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/lib/open.cc b/lib/open.cc
index 6fa00a84..ba32c2f1 100644
--- a/lib/open.cc
+++ b/lib/open.cc
@@ -871,6 +871,13 @@ notmuch_database_load_config (const char *database_path,
 if (status_string)
*status_string = message;
 
+if (status &&
+   status != NOTMUCH_STATUS_NO_DATABASE
+   && status != NOTMUCH_STATUS_NO_CONFIG) {
+   notmuch_database_destroy (notmuch);
+   notmuch = NULL;
+}
+
 if (database)
*database = notmuch;
 
diff --git a/test/T590-libconfig.sh b/test/T590-libconfig.sh
index e6bec872..7feb6519 100755
--- a/test/T590-libconfig.sh
+++ b/test/T590-libconfig.sh
@@ -942,7 +942,6 @@ EOF
 test_expect_equal_file EXPECTED OUTPUT
 
 test_begin_subtest "load_config: database set to NULL on fatal error"
-test_subtest_known_broken
 cat c_head3 - c_tail3 <<'EOF' | test_C
   notmuch_status_t st = notmuch_database_load_config("relative", NULL, NULL, 
, NULL);
 EOF
-- 
2.33.0
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH 1/6] test: add two known broken tests for missing config files

2021-10-23 Thread David Bremner
The documentation claims that the database will be set to NULL in this
case, but it is currently not happening. Based on a reproducer [1]
from Austin Ray.

[1]: id:20211021190401.imirxau2ewke6e2m@athena
---
 test/T590-libconfig.sh | 43 ++
 1 file changed, 43 insertions(+)

diff --git a/test/T590-libconfig.sh b/test/T590-libconfig.sh
index 59b82a6f..ed12b005 100755
--- a/test/T590-libconfig.sh
+++ b/test/T590-libconfig.sh
@@ -849,4 +849,47 @@ zzzafter afterval
 EOF
 test_expect_equal_file EXPECTED OUTPUT
 
+cat < c_head3
+#include 
+int main (int argc, char **argv) {
+  notmuch_status_t stat;
+  notmuch_database_t *db = NULL;
+EOF
+
+cat < c_tail3
+  printf("db == NULL: %d\n", db == NULL);
+}
+EOF
+
+test_begin_subtest "open: database set to null on missing config"
+test_subtest_known_broken
+cat c_head3 - c_tail3 <<'EOF' | test_C ${MAIL_DIR} "/nonexistent"
+  notmuch_status_t st = notmuch_database_open_with_config(argv[1],
+ 
NOTMUCH_DATABASE_MODE_READ_ONLY,
+ argv[2], NULL, , 
NULL);
+EOF
+cat < EXPECTED
+== stdout ==
+db == NULL: 1
+== stderr ==
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
+test_begin_subtest "open: database set to null on missing config (env)"
+test_subtest_known_broken
+old_NOTMUCH_CONFIG=${NOTMUCH_CONFIG}
+NOTMUCH_CONFIG="/nonexistent"
+cat c_head3 - c_tail3 <<'EOF' | test_C ${MAIL_DIR}
+  notmuch_status_t st = notmuch_database_open_with_config(argv[1],
+ 
NOTMUCH_DATABASE_MODE_READ_ONLY,
+ NULL, NULL, , 
NULL);
+EOF
+NOTMUCH_CONFIG=${old_NOTMUCH_CONFIG}
+cat < EXPECTED
+== stdout ==
+db == NULL: 1
+== stderr ==
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
 test_done
-- 
2.33.0
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH 3/6] lib/create: document expectations for db on error, add tests

2021-10-23 Thread David Bremner
It seems sensible to harmonize the behaviour with
n_d_open_with_config. In this commit we just assert the desired
behaviour.
---
 lib/notmuch.h  |  3 +++
 test/T590-libconfig.sh | 28 
 2 files changed, 31 insertions(+)

diff --git a/lib/notmuch.h b/lib/notmuch.h
index 074fc682..701eb814 100644
--- a/lib/notmuch.h
+++ b/lib/notmuch.h
@@ -489,6 +489,9 @@ notmuch_database_load_config (const char *database_path,
  *
  * For description of arguments, @see notmuch_database_open_with_config
  *
+ * In case of any failure, this function returns an error status and
+ * sets *database to NULL.
+ *
  * @retval NOTMUCH_STATUS_SUCCESS: Successfully created the database.
  *
  * @retval NOTMUCH_STATUS_DATABASE_EXISTS: Database already exists, not created
diff --git a/test/T590-libconfig.sh b/test/T590-libconfig.sh
index a0d70080..becb2821 100755
--- a/test/T590-libconfig.sh
+++ b/test/T590-libconfig.sh
@@ -890,4 +890,32 @@ db == NULL: 1
 EOF
 test_expect_equal_file EXPECTED OUTPUT
 
+test_begin_subtest "create: database set to null on missing config"
+test_subtest_known_broken
+cat c_head3 - c_tail3 <<'EOF' | test_C ${MAIL_DIR} "/nonexistent"
+  notmuch_status_t st = notmuch_database_create_with_config(argv[1],argv[2], 
NULL, , NULL);
+EOF
+cat < EXPECTED
+== stdout ==
+db == NULL: 1
+== stderr ==
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
+test_begin_subtest "create: database set to null on missing config (env)"
+test_subtest_known_broken
+old_NOTMUCH_CONFIG=${NOTMUCH_CONFIG}
+NOTMUCH_CONFIG="/nonexistent"
+cat c_head3 - c_tail3 <<'EOF' | test_C ${MAIL_DIR}
+  notmuch_status_t st = notmuch_database_create_with_config(argv[1],
+ NULL, NULL, , 
NULL);
+EOF
+NOTMUCH_CONFIG=${old_NOTMUCH_CONFIG}
+cat < EXPECTED
+== stdout ==
+db == NULL: 1
+== stderr ==
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
 test_done
-- 
2.33.0
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH 2/6] lib/open: fix potential double-free, ensure *database=NULL on error

2021-10-23 Thread David Bremner
During refactoring for 0.32, the code that set notmuch=NULL on various
errors was moved into _finish_open. This meant that the the code which
relied on that to set *database to NULL on error was no longer
correct. It also introduced a potential double free, since the notmuch
struct was deallocated inside _finish_open (via n_d_destroy).

In this commit we revert to "allocator frees", and leave any cleanup
to the caller of _finish_open. This allows us to get back the
behaviour of setting *database to NULL with a small change. Other
callers of _finish_open will need free notmuch on errors.
---
 lib/open.cc| 13 +
 test/T590-libconfig.sh |  2 --
 2 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/lib/open.cc b/lib/open.cc
index 8a835e98..77f01f72 100644
--- a/lib/open.cc
+++ b/lib/open.cc
@@ -396,8 +396,6 @@ _finish_open (notmuch_database_t *notmuch,
 "   has a newer database format 
version (%u) than supported by this\n"
 "   version of notmuch (%u).\n",
 database_path, version, 
NOTMUCH_DATABASE_VERSION));
-   notmuch_database_destroy (notmuch);
-   notmuch = NULL;
status = NOTMUCH_STATUS_FILE_ERROR;
goto DONE;
}
@@ -414,8 +412,6 @@ _finish_open (notmuch_database_t *notmuch,
 "   requires features (%s)\n"
 "   not supported by this version of 
notmuch.\n",
 database_path, incompat_features));
-   notmuch_database_destroy (notmuch);
-   notmuch = NULL;
status = NOTMUCH_STATUS_FILE_ERROR;
goto DONE;
}
@@ -489,8 +485,6 @@ _finish_open (notmuch_database_t *notmuch,
 } catch (const Xapian::Error ) {
IGNORE_RESULT (asprintf (, "A Xapian exception occurred opening 
database: %s\n",
 error.get_msg ().c_str ()));
-   notmuch_database_destroy (notmuch);
-   notmuch = NULL;
status = NOTMUCH_STATUS_XAPIAN_EXCEPTION;
 }
   DONE:
@@ -559,10 +553,13 @@ notmuch_database_open_with_config (const char 
*database_path,
free (message);
 }
 
+if (status && notmuch) {
+   notmuch_database_destroy (notmuch);
+   notmuch = NULL;
+}
+
 if (database)
*database = notmuch;
-else
-   talloc_free (notmuch);
 
 if (notmuch)
notmuch->open = true;
diff --git a/test/T590-libconfig.sh b/test/T590-libconfig.sh
index ed12b005..a0d70080 100755
--- a/test/T590-libconfig.sh
+++ b/test/T590-libconfig.sh
@@ -862,7 +862,6 @@ cat < c_tail3
 EOF
 
 test_begin_subtest "open: database set to null on missing config"
-test_subtest_known_broken
 cat c_head3 - c_tail3 <<'EOF' | test_C ${MAIL_DIR} "/nonexistent"
   notmuch_status_t st = notmuch_database_open_with_config(argv[1],
  
NOTMUCH_DATABASE_MODE_READ_ONLY,
@@ -876,7 +875,6 @@ EOF
 test_expect_equal_file EXPECTED OUTPUT
 
 test_begin_subtest "open: database set to null on missing config (env)"
-test_subtest_known_broken
 old_NOTMUCH_CONFIG=${NOTMUCH_CONFIG}
 NOTMUCH_CONFIG="/nonexistent"
 cat c_head3 - c_tail3 <<'EOF' | test_C ${MAIL_DIR}
-- 
2.33.0
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Clean up de-allocation / nulling of notmuch database structure

2021-10-23 Thread David Bremner
Notmuch 0.32 introduced some bugs in the handling of the
notmuch_database_t output parameters. We didn't see them in the
notmuch CLI, but they caused some crashes for neomutt. This series
attempts to clean up those problems.

I plan to do a point release with this series on top of 0.34.

___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH] emacs: improve notmuch-*-from-current-query docstrings

2021-10-23 Thread David Bremner
Err on the side of providing better user documentation, rather than
documentation for developers.
---
 emacs/notmuch.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 2ef67c0e..fa061693 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -535,12 +535,12 @@ thread."
   (message "End of search results."
 
 (defun notmuch-tree-from-search-current-query ()
-  "Call notmuch tree with the current query."
+  "Tree view of current query."
   (interactive)
   (notmuch-tree notmuch-search-query-string))
 
 (defun notmuch-unthreaded-from-search-current-query ()
-  "Call notmuch tree with the current query."
+  "Unthreaded view of current query."
   (interactive)
   (notmuch-unthreaded notmuch-search-query-string))
 
-- 
2.33.0
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH 2/2] CLI: move indexopts variable out of shared options block

2021-10-23 Thread David Bremner
David Bremner  writes:

> This reduces the amount of global state.  Furthermore, index options
> can be set (in principle) in several ways, not just in the one
> function for processing indexing command line options.

series applied to master.

d
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH 2/2] lib/open: replace call to deprecated notmuch_database_open_verbose

2021-10-23 Thread David Bremner
Essentially inline the existing shim definition of
notmuch_database_open_verbose.
---
 lib/open.cc | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/lib/open.cc b/lib/open.cc
index 8a835e98..86faf1d9 100644
--- a/lib/open.cc
+++ b/lib/open.cc
@@ -19,9 +19,8 @@ notmuch_database_open (const char *path,
 char *status_string = NULL;
 notmuch_status_t status;
 
-status = notmuch_database_open_verbose (path, mode, database,
-   _string);
-
+status = notmuch_database_open_with_config (path, mode, "", NULL,
+   database, _string);
 if (status_string) {
fputs (status_string, stderr);
free (status_string);
-- 
2.33.0
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH 1/2] lib/compact: replace deprecated notmuch_database_open_verbose

2021-10-23 Thread David Bremner
It should not be necesary to have any config information here, hence
passing "" to n_d_open_with_config.
---
 lib/database.cc | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/lib/database.cc b/lib/database.cc
index 7eb0de79..6ef56d56 100644
--- a/lib/database.cc
+++ b/lib/database.cc
@@ -590,10 +590,12 @@ notmuch_database_compact (const char *path,
 notmuch_database_t *notmuch = NULL;
 char *message = NULL;
 
-ret = notmuch_database_open_verbose (path,
-NOTMUCH_DATABASE_MODE_READ_WRITE,
-,
-);
+ret = notmuch_database_open_with_config (path,
+NOTMUCH_DATABASE_MODE_READ_WRITE,
+"",
+NULL,
+,
+);
 if (ret) {
if (status_cb) status_cb (message, closure);
return ret;
-- 
2.33.0
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH 1/2] lib: remove enum names from typedefs

2021-10-23 Thread David Bremner
Jani Nikula  writes:

> There are some enum typedefs with the enum name:
>
> typedef enum _name_t { ... } name_t;
>
> We don't need or use the enum names _name_t for anything, and not all
> of the enum typedefs have them. We have the typedefs specifically to
> use the typedef name.

series applied to master
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH] lib: fix commented out NOTMUCH_DEPRECATED()

2021-10-23 Thread David Bremner
Jani Nikula  writes:

> Remove the comment markers from the placeholder NOTMUCH_DEPRECATED(),
> added in commit e5f3c3ed5024 ("lib: add stub for
> notmuch_database_open_with_config").

Applied to master. There is, as a predicted, a few more deprecation
warnings we should deal with before the next major release.

d
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH 2/5] lib/open: fix potential double-free, ensure *database=NULL on error

2021-10-23 Thread David Bremner
During refactoring for 0.32, the code that set notmuch=NULL on various
errors was moved into _finish_open. This meant that the the code which
relied on that to set *database to NULL on error was no longer
correct. It also introduced a potential double free, since the notmuch
struct was deallocated inside _finish_open (via n_d_destroy).

In this commit we revert to "allocator frees", and leave any cleanup
to the caller of _finish_open. This allows us to get back the
behaviour of setting *database to NULL with a small change. Other
callers of _finish_open will need free notmuch on errors.
---
 lib/open.cc| 13 +
 test/T590-libconfig.sh |  2 --
 2 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/lib/open.cc b/lib/open.cc
index 8a835e98..77f01f72 100644
--- a/lib/open.cc
+++ b/lib/open.cc
@@ -396,8 +396,6 @@ _finish_open (notmuch_database_t *notmuch,
 "   has a newer database format 
version (%u) than supported by this\n"
 "   version of notmuch (%u).\n",
 database_path, version, 
NOTMUCH_DATABASE_VERSION));
-   notmuch_database_destroy (notmuch);
-   notmuch = NULL;
status = NOTMUCH_STATUS_FILE_ERROR;
goto DONE;
}
@@ -414,8 +412,6 @@ _finish_open (notmuch_database_t *notmuch,
 "   requires features (%s)\n"
 "   not supported by this version of 
notmuch.\n",
 database_path, incompat_features));
-   notmuch_database_destroy (notmuch);
-   notmuch = NULL;
status = NOTMUCH_STATUS_FILE_ERROR;
goto DONE;
}
@@ -489,8 +485,6 @@ _finish_open (notmuch_database_t *notmuch,
 } catch (const Xapian::Error ) {
IGNORE_RESULT (asprintf (, "A Xapian exception occurred opening 
database: %s\n",
 error.get_msg ().c_str ()));
-   notmuch_database_destroy (notmuch);
-   notmuch = NULL;
status = NOTMUCH_STATUS_XAPIAN_EXCEPTION;
 }
   DONE:
@@ -559,10 +553,13 @@ notmuch_database_open_with_config (const char 
*database_path,
free (message);
 }
 
+if (status && notmuch) {
+   notmuch_database_destroy (notmuch);
+   notmuch = NULL;
+}
+
 if (database)
*database = notmuch;
-else
-   talloc_free (notmuch);
 
 if (notmuch)
notmuch->open = true;
diff --git a/test/T590-libconfig.sh b/test/T590-libconfig.sh
index d2ea4a2b..ca70642c 100755
--- a/test/T590-libconfig.sh
+++ b/test/T590-libconfig.sh
@@ -850,7 +850,6 @@ EOF
 test_expect_equal_file EXPECTED OUTPUT
 
 test_begin_subtest "open: database set to null on missing config"
-test_subtest_known_broken
 test_C ${MAIL_DIR} "/nonexistent" <
 int main (int argc, char **argv) {
@@ -871,7 +870,6 @@ EOF
 test_expect_equal_file EXPECTED OUTPUT
 
 test_begin_subtest "open: database set to null on missing config (env)"
-test_subtest_known_broken
 old_NOTMUCH_CONFIG=${NOTMUCH_CONFIG}
 NOTMUCH_CONFIG="/nonexistent"
 test_C ${MAIL_DIR} <

[PATCH 1/5] test: add two known broken tests for missing config files

2021-10-23 Thread David Bremner
The documentation claims that the database will be set to NULL in this
case, but it is currently not happening. Based on a reproducer [1]
from Austin Ray.

[1]: id:20211021190401.imirxau2ewke6e2m@athena
---
 test/T590-libconfig.sh | 45 ++
 1 file changed, 45 insertions(+)

diff --git a/test/T590-libconfig.sh b/test/T590-libconfig.sh
index 59b82a6f..d2ea4a2b 100755
--- a/test/T590-libconfig.sh
+++ b/test/T590-libconfig.sh
@@ -849,4 +849,49 @@ zzzafter afterval
 EOF
 test_expect_equal_file EXPECTED OUTPUT
 
+test_begin_subtest "open: database set to null on missing config"
+test_subtest_known_broken
+test_C ${MAIL_DIR} "/nonexistent" <
+int main (int argc, char **argv) {
+  notmuch_status_t stat;
+  notmuch_database_t *db = NULL;
+
+  notmuch_status_t st = notmuch_database_open_with_config(argv[1],
+ 
NOTMUCH_DATABASE_MODE_READ_ONLY,
+ argv[2], NULL, , 
NULL);
+  printf("db == NULL: %d\n", db == NULL);
+}
+EOF
+cat < EXPECTED
+== stdout ==
+db == NULL: 1
+== stderr ==
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
+test_begin_subtest "open: database set to null on missing config (env)"
+test_subtest_known_broken
+old_NOTMUCH_CONFIG=${NOTMUCH_CONFIG}
+NOTMUCH_CONFIG="/nonexistent"
+test_C ${MAIL_DIR} <
+int main (int argc, char **argv) {
+  notmuch_status_t stat;
+  notmuch_database_t *db = NULL;
+
+  notmuch_status_t st = notmuch_database_open_with_config(argv[1],
+ 
NOTMUCH_DATABASE_MODE_READ_ONLY,
+ NULL, NULL, , 
NULL);
+  printf("db == NULL: %d\n", db == NULL);
+}
+EOF
+NOTMUCH_CONFIG=${old_NOTMUCH_CONFIG}
+cat < EXPECTED
+== stdout ==
+db == NULL: 1
+== stderr ==
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
 test_done
-- 
2.33.0
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH 4/5] lib/create: fix memory leak, ensure *database=NULL on error

2021-10-23 Thread David Bremner
This code previously relied on _finish_open to free the notmuch struct
on errors (except for the case of database == NULL, which was a
potential double free). When we removed those frees from _finish_open,
we introduced a (small) memory leak.

In this commit, fix the memory leak, and harmonize the on-error
behaviour with n_d_open_with_config.
---
 lib/open.cc| 10 --
 test/T590-libconfig.sh |  2 --
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/lib/open.cc b/lib/open.cc
index 77f01f72..6fa00a84 100644
--- a/lib/open.cc
+++ b/lib/open.cc
@@ -714,10 +714,16 @@ notmuch_database_create_with_config (const char 
*database_path,
else
free (message);
 }
+if (status && notmuch) {
+   notmuch_database_destroy (notmuch);
+   notmuch = NULL;
+}
+
 if (database)
*database = notmuch;
-else
-   talloc_free (notmuch);
+
+if (notmuch)
+   notmuch->open = true;
 return status;
 }
 
diff --git a/test/T590-libconfig.sh b/test/T590-libconfig.sh
index b36653bf..cd7d6e24 100755
--- a/test/T590-libconfig.sh
+++ b/test/T590-libconfig.sh
@@ -893,7 +893,6 @@ EOF
 test_expect_equal_file EXPECTED OUTPUT
 
 test_begin_subtest "create: database set to null on missing config"
-test_subtest_known_broken
 test_C ${MAIL_DIR} "/nonexistent" <
 int main (int argc, char **argv) {
@@ -912,7 +911,6 @@ EOF
 test_expect_equal_file EXPECTED OUTPUT
 
 test_begin_subtest "create: database set to null on missing config (env)"
-test_subtest_known_broken
 old_NOTMUCH_CONFIG=${NOTMUCH_CONFIG}
 NOTMUCH_CONFIG="/nonexistent"
 test_C ${MAIL_DIR} <

[PATCH 3/5] lib/open: document expectations for db on error, add tests

2021-10-23 Thread David Bremner
It seems sensible to harmonize the behaviour with
n_d_open_with_config. In this commit we just assert the desired
behaviour.
---
 lib/notmuch.h  |  3 +++
 test/T590-libconfig.sh | 42 ++
 2 files changed, 45 insertions(+)

diff --git a/lib/notmuch.h b/lib/notmuch.h
index 074fc682..571b8a87 100644
--- a/lib/notmuch.h
+++ b/lib/notmuch.h
@@ -489,6 +489,9 @@ notmuch_database_load_config (const char *database_path,
  *
  * For description of arguments, @see notmuch_database_open_with_config
  *
+ * In case of any failure, this function returns an error status and
+ * database to NULL.
+ *
  * @retval NOTMUCH_STATUS_SUCCESS: Successfully created the database.
  *
  * @retval NOTMUCH_STATUS_DATABASE_EXISTS: Database already exists, not created
diff --git a/test/T590-libconfig.sh b/test/T590-libconfig.sh
index ca70642c..b36653bf 100755
--- a/test/T590-libconfig.sh
+++ b/test/T590-libconfig.sh
@@ -892,4 +892,46 @@ db == NULL: 1
 EOF
 test_expect_equal_file EXPECTED OUTPUT
 
+test_begin_subtest "create: database set to null on missing config"
+test_subtest_known_broken
+test_C ${MAIL_DIR} "/nonexistent" <
+int main (int argc, char **argv) {
+  notmuch_status_t stat;
+  notmuch_database_t *db = NULL;
+
+  notmuch_status_t st = notmuch_database_create_with_config(argv[1],argv[2], 
NULL, , NULL);
+  printf("db == NULL: %d\n", db == NULL);
+}
+EOF
+cat < EXPECTED
+== stdout ==
+db == NULL: 1
+== stderr ==
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
+test_begin_subtest "create: database set to null on missing config (env)"
+test_subtest_known_broken
+old_NOTMUCH_CONFIG=${NOTMUCH_CONFIG}
+NOTMUCH_CONFIG="/nonexistent"
+test_C ${MAIL_DIR} <
+int main (int argc, char **argv) {
+  notmuch_status_t stat;
+  notmuch_database_t *db = NULL;
+
+  notmuch_status_t st = notmuch_database_create_with_config(argv[1],
+ NULL, NULL, , 
NULL);
+  printf("db == NULL: %d\n", db == NULL);
+}
+EOF
+NOTMUCH_CONFIG=${old_NOTMUCH_CONFIG}
+cat < EXPECTED
+== stdout ==
+db == NULL: 1
+== stderr ==
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
 test_done
-- 
2.33.0
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH 5/5] lib/load_config: document expectations for db on error, add tests

2021-10-23 Thread David Bremner
This is a bit different than n_d_{open,create}_with_config, since
there are several non-zero status codes where we do want to return a
non-NULL database structure.
---
 lib/notmuch.h  |  2 ++
 lib/open.cc|  7 +++
 test/T590-libconfig.sh | 40 
 3 files changed, 49 insertions(+)

diff --git a/lib/notmuch.h b/lib/notmuch.h
index 571b8a87..64f71280 100644
--- a/lib/notmuch.h
+++ b/lib/notmuch.h
@@ -458,6 +458,8 @@ notmuch_database_open_with_config (const char 
*database_path,
  *
  * For description of arguments, @see notmuch_database_open_with_config
  *
+ * For fatal errors, database is set to NULL.
+ *
  * @retval NOTMUCH_STATUS_SUCCESS: Successfully loaded configuration.
  *
  * @retval NOTMUCH_STATUS_NO_CONFIG: No config file was loaded. Not fatal.
diff --git a/lib/open.cc b/lib/open.cc
index 6fa00a84..ba32c2f1 100644
--- a/lib/open.cc
+++ b/lib/open.cc
@@ -871,6 +871,13 @@ notmuch_database_load_config (const char *database_path,
 if (status_string)
*status_string = message;
 
+if (status &&
+   status != NOTMUCH_STATUS_NO_DATABASE
+   && status != NOTMUCH_STATUS_NO_CONFIG) {
+   notmuch_database_destroy (notmuch);
+   notmuch = NULL;
+}
+
 if (database)
*database = notmuch;
 
diff --git a/test/T590-libconfig.sh b/test/T590-libconfig.sh
index cd7d6e24..e8fbd3d7 100755
--- a/test/T590-libconfig.sh
+++ b/test/T590-libconfig.sh
@@ -932,4 +932,44 @@ db == NULL: 1
 EOF
 test_expect_equal_file EXPECTED OUTPUT
 
+test_begin_subtest "load_config: database set non-null on missing config"
+test_C ${MAIL_DIR} "/nonexistent" <
+int main (int argc, char **argv) {
+  notmuch_status_t stat;
+  notmuch_database_t *db = NULL;
+
+  notmuch_status_t st = notmuch_database_load_config(argv[1],argv[2], NULL, 
, NULL);
+  printf("db == NULL: %d\n", db == NULL);
+}
+EOF
+cat < EXPECTED
+== stdout ==
+db == NULL: 0
+== stderr ==
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
+test_begin_subtest "load_config: database non-null on missing config (env)"
+old_NOTMUCH_CONFIG=${NOTMUCH_CONFIG}
+NOTMUCH_CONFIG="/nonexistent"
+test_C ${MAIL_DIR} <
+int main (int argc, char **argv) {
+  notmuch_status_t stat;
+  notmuch_database_t *db = NULL;
+
+  notmuch_status_t st = notmuch_database_load_config(argv[1], NULL, NULL, , 
NULL);
+  printf("db == NULL: %d\n", db == NULL);
+}
+EOF
+NOTMUCH_CONFIG=${old_NOTMUCH_CONFIG}
+cat < EXPECTED
+== stdout ==
+db == NULL: 0
+== stderr ==
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
+
 test_done
-- 
2.33.0
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


WIP fixes for nulling of database argument on error

2021-10-23 Thread David Bremner
I'm not quite happy with the tests for notmuch_database_load_config
(it's not completely trivial to trigger the specific kind of error
behaviour that should result in a NULL database parameter), but here
is what I have so far. In particular it fixes a bug in deallocation on
the error path. I didn't run it under ASAN yet.

___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH] lib: document n_o_w_config can return NOTMUCH_STATUS_NO_CONFIG

2021-10-21 Thread David Bremner
This should be treated as fatal by callers, since we didn't succeed in
opening a Xapian database.
---
 lib/notmuch.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/notmuch.h b/lib/notmuch.h
index 074fc682..8d4d14af 100644
--- a/lib/notmuch.h
+++ b/lib/notmuch.h
@@ -433,6 +433,8 @@ notmuch_database_open_verbose (const char *path,
  * @retval NOTMUCH_STATUS_NULL_POINTER: The given \a database
  * argument is NULL.
  *
+ * @retval NOTMUCH_STATUS_NO_CONFIG: No config file was found. Fatal.
+
  * @retval NOTMUCH_STATUS_OUT_OF_MEMORY: Out of memory.
  *
  * @retval NOTMUCH_STATUS_FILE_ERROR: An error occurred trying to open the
-- 
2.33.0
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [WIP PATCH 0/1] autodoc failed to import notmuch2

2021-10-21 Thread David Bremner
Michael J Gruber  writes:

>
> In that case: Which docs do you use, and which docs do you want us
> (packagers) to use? The usual fedora policy is to (re)build docs if
> the doc source is shipped.
>
> Disclaimer: I have no clue about autodoc ;)

I agree with this in general. Currently Debian does not ship the docs. I
also don't know anything about autodoc, so curently I'm just deploying
locally built docs on notmuchmail.org.

d
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [WIP PATCH 0/1] autodoc failed to import notmuch2

2021-10-21 Thread David Bremner
Michael J Gruber  writes:

> Hi there
>
> During Fedora package builds I noticed that autodoc fails to import the
> notmuch2 module:
>
> ```
> WARNING: autodoc: failed to import module 'notmuch2'; the following
> exception was raised:
> No module named 'notmuch2'
> ```
>
> You never notice this on your own box where notmuch2 is installed,
> because then the build finds the previously installed module. But this
> is wrong, of course, because autodoc is supposed to document tthe module
> being build (in-source module).
>

I also see this error when doing builds in a clean environment for
Debian. I guess I'm currently not using the docs from those builds, so I
don't know how bad the damage is.
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


notmuch release 0.34 now available

2021-10-20 Thread David Bremner


Where to obtain notmuch 0.34
===
  https://notmuchmail.org/releases/notmuch-0.34.tar.xz

Which can be verified with:

  https://notmuchmail.org/releases/notmuch-0.34.tar.xz.sha256.asc
  -BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

83e9581542b6e387f61f30cf0f5e2d9038912ee1bb73ad64b84d1d9c543761b6  
notmuch-0.34.tar.xz
-BEGIN PGP SIGNATURE-

iQIzBAEBCAAdFiEEkiyHYXwaY0SiY6fqA0U5G1WqFSEFAmFwKB8ACgkQA0U5G1Wq
FSEzWg//RX/P6KjR1dnbK4rqD+tSYY84FBYbOgAP4q/zbuyto5jU2Cx+nWpN1TcD
BHI8U/PijLOe390wQJg4427vkmgYnmcPVfssSwvYNDTSnTgSUF9ZAAHtnPbM0CKg
YjsteRn0UQJgwZYpuTeoq0f0gPSv1bdNXO5jCjr7u5ah/DbQz3vudBSgb4dC7qla
XaNhsYF6x4jxAhluln0iYM575ZRoat6iRnY8ryF596uB8501UrNl38If9ME2aplZ
zmJRCOtZS0z7yln4Jf9FHqXxhAbG7CLdWlXeCxCKlb1zeTvr8J5cIus+FsgybWbZ
k7ePm4WaaOzSoGCK+CfpxKphj15qOzMBZS1c3tMe5xX+fqV8b/ldyiQbzjxMwP2F
LgZiqdglF+fVlRt1nO+SVqOTottFDODF/4TRGt283K0jwczUPt4+UMU3g/Yh5Hb5
NEN0WEgOtm3BwDtJ6W8uf2OWxEcYbfu8MKrLhcAtL2BADCowC79Bnw8nCNZBGmhm
WWZ5EHoAUGI5bN2V5Rf1OeUYfkOIaFnrdSbI5PnAlALiTE12wZ4K0P3C8CKz3bx2
6/hIHE/GyMEcLu95ZwXM2QiX64OSxLJU/yox1+zHcJBO6LE+uuxVzVtubYMWPX/9
RKYF8wmXO0VAF61NcVL+KvHhYQHK+r+biS7/y5bSwhNbwuQrfMI=
=hlEa
-END PGP SIGNATURE-

  https://notmuchmail.org/releases/notmuch-0.34.tar.xz.asc
  (signed by David Bremner)

What's new in notmuch 0.34
=

General
---

An optional new s-expression based query parser is available if
notmuch is built with the `sfsexp` library. See
notmuch-sexp-queries(7) for syntax, and use `notmuch config get
built_with.sexpr_queries` to check if notmuch is compiled with
s-expression query support.

CLI
---

Support multiple `Delivered-To` headers in notmuch-reply(1).

Emacs
-

Functions are now allowed in `notmuch-search-result-format`.

Improvements to unthreaded view on large threads.

Tolerate bad/missing working directory for most commands.

Allow customization of tree drawing symbols in notmuch-tree mode.

What is notmuch
===
Notmuch is a system for indexing, searching, reading, and tagging
large collections of email messages in maildir or mh format. It uses
the Xapian library to provide fast, full-text search with a convenient
search syntax.

For more about notmuch, see https://notmuchmail.org
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH] emacs: fix call to nonexistent notmuch--call-process-shell-command

2021-10-19 Thread David Bremner
Doug Woos  writes:

> Looks like a find/replace error in e722b4f4

applied to master and release

d
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH] emacs: fix call to nonexistent notmuch--call-process-shell-command

2021-10-18 Thread David Bremner
Doug Woos  writes:

> Looks like a find/replace error in e722b4f4
> ---
>  emacs/notmuch-show.el | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index ea20ddce..4de3e423 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -2086,7 +2086,7 @@ message."
> ;; Use the originating buffer's working directory instead of
> ;; that of the pipe buffer.
> (cd cwd)
> -   (let ((exit-code (notmuch--call-process-shell-command shell-command 
> nil buf)))
> +   (let ((exit-code (call-process-shell-command shell-command nil buf)))
>   (goto-char (point-max))
>   (set-buffer-modified-p nil)
>   (unless (zerop exit-code)
> -- 
> 2.29.2

That looks good to me. If there are no objections today, I'll apply this
for the upcoming release.

d
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: release plans for 0.34

2021-10-15 Thread David Bremner
David Bremner  writes:

> I'd like to release 0.34 fairly soon, so I'd propose a somewhat
> abbreviated release cycle: feature freeze on October 15th, release on
> October 20th.
>
> d

I have just uploaded the first release candidate to git and to the web
site. Please let me know any gotchas before October 20.

d


signature.asc
Description: PGP signature
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [RFC 0/5] doc: api docs overhaul

2021-10-13 Thread David Bremner
Jani Nikula  writes:

>
> I'm afraid I don't have an answer to that. What do projects do when they
> depend on packages from PyPI? It's a kind of chicken and egg problem.

I would say python projects would happily _only_ depend on pypi (witness
the requests to package notmuch for pypi) but we're not such a project.

>
> I saw that you made the Debian packaging request; many thanks! But is
> that enough?

No, it's actually relatively unlikely that someone will volunteer to
package it. I could do it myself, but I'd be happier if someone more up
on the latest python-in-debian practices would handle it.

> What is your stance on imposing new dependencies on other
> distros?
>

Well I just did it with sfsexp. My reasoning was that it was for an
optional (for now) new feature, so people were no worse off than
before. It's not quite the same thing here, since there is some API docs
now. I don't know how many people refer to them. A very rough estimate
from Debian [1] is that about 10% of the people who install notmuch also
install libnotmuch-dev, which contains the API docs. I guess most people
would be happy with a Web version of the API docs, which we don't do
now, but which would automagically happen if it was in the sphinx doctree.


[1]: https://qa.debian.org/popcon.php?package=notmuch 
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [RFC 1/5] doc: replace doxygen with hawkmoth sphinx extension for api docs

2021-10-13 Thread David Bremner
Jani Nikula  writes:
>  
> -have_doxygen=0
> -if [ $WITH_API_DOCS = "1" ] ; then
> -printf "Checking if doxygen is available... "
> -if command -v doxygen > /dev/null; then
> - printf "Yes.\n"
> - have_doxygen=1
> -else
> - printf "No (so will not install api docs)\n"
> -fi
> -fi
> -

I guess it's an important point that missing hawkmoth only blocks
building the api docs, not all of the docs.

d
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [RFC 3/5] lib: remove commented out NOTMUCH_DEPRECATED()

2021-10-13 Thread David Bremner
Jani Nikula  writes:

> Having comments between the documentation comment and the object being
> documented throws Hawkmoth off. Remove the placeholder
> NOTMUCH_DEPRECATED() comments.
>
> ---
>
> They were added in commit e5f3c3ed5024 ("lib: add stub for
> notmuch_database_open_with_config"); maybe the comment markers should
> be removed instead?

Yes, those should be uncommented, I think.

d
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [RFC 2/5] lib: remove enum names from typedefs

2021-10-13 Thread David Bremner
Jani Nikula  writes:

> Given the named enum typedef:
>
> typedef enum _name_t { ... } name_t;
>
> Hawkmoth uses _name_t as the name for documentation. Typedef the
> anonymous enum:
>
> typedef enum { ... } name_t;
>
> instead to use name_t. We don't really need the enum names for
> anything, and not all of the enum typedefs have them anyway.
> ---
I guess that change would be fine independent of the rest?
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Bug#996357: RFP: python3-hawkmoth -- minimalistic Sphinx C Domain autodoc directive extension

2021-10-13 Thread David Bremner
Package: wnpp
Severity: wishlist
X-Debbugs-Cc: notmuch@notmuchmail.org

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

* Package name: python3-hawkmoth
  Version : 0.9.0
  Upstream Author : Jani Nikula
* URL : https://github.com/jnikula/hawkmoth
* License : BSD 2 clause
  Programming Lang: Python
  Description : minimalistic Sphinx C Domain autodoc directive extension

Incorporate formatted C source code comments written in
reStructuredText into Sphinx based documentation.  Hawkmoth focuses on
simplicity of design, implementation and use.

Roughly speaking, it's replacement for Doxygen that integrates nicer with 
documentation written in Sphinx.
It seems useful in general. We're considering using it in notmuch.

-BEGIN PGP SIGNATURE-

iQIzBAEBCAAdFiEEkiyHYXwaY0SiY6fqA0U5G1WqFSEFAmFmz1kACgkQA0U5G1Wq
FSFVkg//Z+n9KDTUvMeZNQBSKWFOmoNYiYy1M6lM0S03Nzj73S9iaW3x5TWN21oo
81LwE3obciclnI49E2arychNYFHbIqL9NfkhxLAB15ngJLdo1/UmICLJqzeHNnhr
1/rEqnXs/kpzqQVh3IfFI9t6NwvmGb1iOgPv8RWzOl4BuytrIjuNBHYj7OYX4JKd
BZHAM7aWY4Becnn4r8rjt+iWiIhbdZbB5ozIFtEXQgcs4kCmJPY6kjsl57eFJQMh
Y+OUInLxB1mLGRcBRRVXHaFPSvkO3fjzl8YQmre5LBzYkFKwykKAL8OMIwMabBor
5/hPUVxHBkbnX4+B54G7J2esISrRCaRRGL9CIHeebmwz+lX0ugK0j4H7HlTqW7Z8
cGM9HW5pGN2CZGUukJNbLS+r6pca2l0cDP3NjFgI6GDdEmq4mWe1PQxmHIqN6XWI
tnH18GoApKayMAhzQaZoxMGsSry15xqowl4mypOvm+z2elcXkJm/afreFv7mCqD0
3PZokDvN5SqsrbDrmkHXr0cqwq5FjeC9HO0HlWAhQ/53i/bp35Yqg/RizcTXwgup
sm7AFMCbp60DxvjGVKUzskdV8GypvO18oMMle+KaQSTDwbJ0oqe8vAECY3Og14/1
WdInOBdRe16Zs/zP+2bWe0jsiVC6EXoutQAoKAeihev5E1c56S0=
=/KZP
-END PGP SIGNATURE-
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [RFC 0/5] doc: api docs overhaul

2021-10-13 Thread David Bremner
Jani Nikula  writes:


> The main downside is that Hawkmoth is not available via distro
> packaging, only PyPI.

I guess another issue is the new dependency on Clang +
bindings. Although maybe that's a fair trade for dropping doxygen.

What would be the plan for transition while distros package hawkmoth?
Embed it in notmuch? Ship the compiled docs?

d
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Bug#996151: sphinx-doc: use of definfoenclose generates warnings from makeinfo

2021-10-11 Thread David Bremner
Package: sphinx-doc
Version: 4.2.0-4
Severity: minor
Tags: upstream
X-Debbugs-Cc: notmuch@notmuchmail.org

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Notmuch uses sphinx-doc to generate info documenation from rst
documents. Somewhat recently makeinfo has started complaining that
definfoenclose is obsolete. This generates about 40 lines of unhelpful
warnings in building notmuch, so it would be nice to eliminate the
noise.

The texinfo documentation says

  In practice, there is little use for this command, and we do not recommend 
you use it. Support for @definfoenclose may be removed in future releases of 
Texinfo.

As far as I can tell the use of definfoenclose is coming from texinfo generated 
by
sphinx/writers/texinfo.py.


- -- System Information:
Debian Release: bookworm/sid
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'testing-proposed-updates-debug'), 
(500, 'testing-debug'), (500, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.10.0-8-amd64 (SMP w/8 CPU threads)
Kernel taint flags: TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=en_CA.UTF-8, LC_CTYPE=en_CA.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_CA:en
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages sphinx-doc depends on:
ii  docutils-doc 0.16+dfsg-4
ii  libjs-mathjax2.7.9+dfsg-1
ii  libjs-sphinxdoc  4.2.0-4
ii  python-requests-doc  2.25.1+dfsg-2
ii  python3-doc  3.9.2-3

sphinx-doc recommends no packages.

sphinx-doc suggests no packages.

- -- no debconf information

-BEGIN PGP SIGNATURE-

iQIzBAEBCAAdFiEEkiyHYXwaY0SiY6fqA0U5G1WqFSEFAmFkOA0ACgkQA0U5G1Wq
FSEt1RAAuKQDDYbgUgQkf7SFCT61hZkdn7nkky8TDdf0uBho0FsG2BfcroQxcdL2
K+DGsWJiUFE851BSo72+1whluGEPxuU34sW05/3TyN8M1MhDcHr8HLJMMDxqfXlL
lfJQBd4cHChEyX1GJrZha5oXlTo3pcL9VsaelYzI9/hRXHx+M8VRZ/x6gx6bdaOl
cYSPyhF9f9DCRJjWoUSHwNADjyofrIAEzCJLfAvVRVTaQWz0vL3PxPYLkK68uz0R
sB81pOWSsY9DUYQHDW5ykQQxj0DLoX9J9mNvQPmOsqyN4yZGQTn1w1yGWxEgb296
+HWU5wL0kKMdDostEjFqKFPIXYcNCQlbJvyqnA+oa72D7l386XfeUSSbi0K9oadu
rJS9Cnn65HslNJDh+BqRbQvYDpH0aWVX7YbNqCPEg32fESs/O7HrHFdYaQ1iI36W
YmyH+vgiIt5LnbLbfvS6t3d5nVpoNHneok+9zRhgL/6eTP3VkcPnsdFvYvNaKC/i
/m9Tb8YsY4KKXDzPja3AmuJrhzPA1fLuk5hfsHQNfF4umMOZ0fU25rOnR07mji44
emKqEcAivYHBd+twnorWRhA+Esw8M0WpDMRIcewg49S6l6mgFkzVB3kYnDQXbTm9
l+DHrNisYs/iPFbdf0p74ZJQbJ/V6lI1GF9jU78Gp30TkcQ/mAM=
=Q/CX
-END PGP SIGNATURE-
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH 2/2] doc/sexp-queries: replace definition lists with block quotes.

2021-10-11 Thread David Bremner
This document contains meaningful markup in the terms, which makeinfo
complains about. Replace the use of definition lists with regular
paragraphs containing quote blocks. This is accomplished by splitting
the "term" from the definition with a blank line.
---
 doc/man7/notmuch-sexp-queries.rst | 30 ++
 1 file changed, 30 insertions(+)

diff --git a/doc/man7/notmuch-sexp-queries.rst 
b/doc/man7/notmuch-sexp-queries.rst
index 019d15f0..d3b18593 100644
--- a/doc/man7/notmuch-sexp-queries.rst
+++ b/doc/man7/notmuch-sexp-queries.rst
@@ -31,10 +31,12 @@ An *s-expression* is either an atom, or list of whitespace 
delimited
 s-expressions inside parentheses. Atoms are either
 
 *basic value*
+
 A basic value is an unquoted string containing no whitespace, double 
quotes, or
 parentheses.
 
 *quoted string*
+
 Double quotes (") delimit strings possibly containing whitespace
 or parentheses. These can contain double quote characters by
 escaping with backslash. E.g. ``"this is a quote \""``.
@@ -48,9 +50,11 @@ a *field*, *logical operation*, or *modifier*, and 0 or more
 subqueries.
 
 ``*``
+
"*" matches any non-empty string in the current field.
 
 ``()``
+
 The empty list matches all messages
 
 *term*
@@ -62,19 +66,23 @@ subqueries.
 phrase splitting see :any:`fields`.
 
 ``(`` *field* |q1| |q2| ... |qn| ``)``
+
 Restrict the queries |q1| to |qn| to *field*, and combine with *and*
 (for most fields) or *or*. See :any:`fields` for more information.
 
 ``(`` *operator* |q1| |q2| ... |qn| ``)``
+
 Combine queries |q1| to |qn|. Currently supported operators are
 ``and``, ``or``, and ``not``. ``(not`` |q1| ... |qn| ``)`` is equivalent
 to ``(and (not`` |q1| ``) ... (not`` |qn| ``))``.
 
 ``(`` *modifier* |q1| |q2| ... |qn| ``)``
+
 Combine queries |q1| to |qn|, and reinterpret the result (e.g. as a 
regular expression).
 See :any:`modifiers` for more information.
 
 ``(macro (`` |p1| ... |pn| ``) body)``
+
 Define saved query with parameter substitution. The syntax is
 recognized only in saved s-expression queries (see ``squery.*`` in
 :any:`notmuch-config(1)`). Parameter names in ``body`` must be
@@ -164,26 +172,31 @@ MODIFIERS
 that are neither operators nor fields.
 
 ``(infix`` *atom* ``)``
+
 Interpret *atom* as an infix notmuch query (see
 :any:`notmuch-search-terms(7)`). Not supported inside fields.
 
 ``(matching`` |q1| |q2| ... |qn| ``)`` ``(of`` |q1| |q2| ... |qn|  ``)``
+
 Match all messages have the same values of the current field as
 those matching all of |q1| ... |qn|. Supported in most term [#not-path]_ or
 phrase fields. Most commonly used in the ``thread`` field.
 
 ``(query`` *atom* ``)``
+
 Expand to the saved query named by *atom*. See
 :any:`notmuch-config(1)` for more. Note that the saved query must
 be in infix syntax (:any:`notmuch-search-terms(7)`). Not supported
 inside fields.
 
 ``(regex`` *atom* ``)`` ``(rx`` *atom* ``)``
+
 Interpret *atom* as a POSIX.2 regular expression (see
 :manpage:`regex(7)`). This applies in term fields and a subset 
[#not-phrase]_ of
 phrase fields (see :any:`field-table`).
 
 ``(starts-with`` *subword* ``)``
+
 Matches any term starting with *subword*.  This applies in either
 phrase or term :any:`fields `, or outside of fields [#not-body]_. 
Note that
 a ``starts-with`` query cannot be part of a phrase. The
@@ -193,63 +206,80 @@ EXAMPLES
 
 
 ``Wizard``
+
 Match all messages containing the word "wizard", ignoring case.
 
 ``added``
+
 Match all messages containing "added", but also those containing "add", 
"additional",
 "Additional", "adds", etc... via stemming.
 
 ``(and Bob Marley)``
+
 Match messages containing words "Bob" and "Marley", or their stems
 The words need not be adjacent.
 
 ``(not Bob Marley)``
+
 Match messages containing neither "Bob" nor "Marley", nor their stems,
 
 ``"quick fox"`` ``quick-fox`` ``quick@fox``
+
 Match the *phrase* "quick" followed by "fox" in phrase fields (or
 outside a field). Match the literal string in a term field.
 
 ``(folder (of (id 1234@invalid)))``
+
 Match any message in the same folder as the one with Message-Id 
"1234@invalid"
 
 ``(id 1234@invalid blah@test)``
+
 Matches Message-Id "1234@invalid" *or* Message-Id "blah@test"
 
 ``(and (infix "date:2009-11-18..2009-11-18") (tag unread))``
+
 Match messages in the given date range with tag unread.
 
 ``(starts-with prelim)``
+
 Match any words starting with "prelim".
 
 ``(subject quick "brown fox")``
+
 Match messages whose subject contains "quick" (anywhere, stemmed) and
 the phrase "brown fox".
 
 ``(subject (starts-with prelim))``
+
 Matches any word starting with "prelim", inside a message subject.
 
 ``(subject (starts-wih quick) "brown fox")``
+
 Match messages whose subject contains "quick brown fox", but also
 "brown fox 

[PATCH 1/2] doc: remove explicit formatting of terms in definition lists

2021-10-11 Thread David Bremner
Sphinx-doc already formats the terms appropriately for a given
backend (bold in html and man). `makeinfo` complains noisily about
formatting inside a @item if we add our own explicit formatting.

This change may change the formatting in the info output. On the other
hand, the existing use of quotes for bold is not that great anyway.

In some places blank lines were removed to preserve the logical
structure of a definition list.
---
 doc/man1/notmuch-address.rst| 14 +++---
 doc/man1/notmuch-config.rst | 34 -
 doc/man1/notmuch-count.rst  |  6 +++---
 doc/man1/notmuch-dump.rst   | 10 +-
 doc/man1/notmuch-reply.rst  | 12 ++--
 doc/man1/notmuch-restore.rst| 12 ++--
 doc/man1/notmuch-search.rst | 18 -
 doc/man1/notmuch-show.rst   | 10 +-
 doc/man5/notmuch-hooks.rst  |  6 +++---
 doc/man7/notmuch-properties.rst |  8 +++-
 10 files changed, 64 insertions(+), 66 deletions(-)

diff --git a/doc/man1/notmuch-address.rst b/doc/man1/notmuch-address.rst
index 7423b629..c70dde35 100644
--- a/doc/man1/notmuch-address.rst
+++ b/doc/man1/notmuch-address.rst
@@ -42,7 +42,7 @@ Supported options for **address** include
neither ``--output=sender`` nor ``--output=recipients`` is
given, ``--output=sender`` is implied.
 
-   **sender**
+   sender
  Output all addresses from the *From* header.
 
  Note: Searching for **sender** should be much faster than
@@ -50,17 +50,17 @@ Supported options for **address** include
  cached directly in the database whereas other addresses need
  to be fetched from message files.
 
-   **recipients**
+   recipients
  Output all addresses from the *To*, *Cc* and *Bcc* headers.
 
-   **count**
+   count
  Print the count of how many times was the address encountered
  during search.
 
  Note: With this option, addresses are printed only after the
  whole search is finished. This may take long time.
 
-   **address**
+   address
  Output only the email addresses instead of the full mailboxes
  with names and email addresses. This option has no effect on
  the JSON or S-Expression output formats.
@@ -69,17 +69,17 @@ Supported options for **address** include
 
Control the deduplication of results.
 
-   **no**
+   no
  Output all occurrences of addresses in the matching
  messages. This is not applicable with ``--output=count``.
 
-   **mailbox**
+   mailbox
  Deduplicate addresses based on the full, case sensitive name
  and email address, or mailbox. This is effectively the same as
  piping the ``--deduplicate=no`` output to **sort | uniq**, except
  for the order of results. This is the default.
 
-   **address**
+   address
  Deduplicate addresses based on the case insensitive address
  part of the mailbox. Of all the variants (with different name
  or case), print the one occurring most frequently among the
diff --git a/doc/man1/notmuch-config.rst b/doc/man1/notmuch-config.rst
index 7d901758..6f12c773 100644
--- a/doc/man1/notmuch-config.rst
+++ b/doc/man1/notmuch-config.rst
@@ -55,14 +55,14 @@ The available configuration items are described below. 
Non-absolute
 paths are presumed relative to `$HOME` for items in section
 **database**.
 
-**database.path**
+database.path
 Notmuch will store its database here, (in
 sub-directory named ``.notmuch`` if **database.mail\_root**
 is unset).
 
 Default: see :ref:`database`
 
-**database.mail_root**
+database.mail_root
 The top-level directory where your mail currently exists and to
 where mail will be delivered in the future. Files should be
 individual email messages.
@@ -72,7 +72,7 @@ paths are presumed relative to `$HOME` for items in section
 Default: For compatibility with older configurations, the value of
 database.path is used if **database.mail\_root** is unset.
 
-**database.backup_dir**
+database.backup_dir
 Directory to store tag dumps when upgrading database.
 
 History: this configuration value was introduced in notmuch 0.32.
@@ -80,7 +80,7 @@ paths are presumed relative to `$HOME` for items in section
 Default: A sibling directory of the Xapian database called
 `backups`.
 
-**database.hook_dir**
+database.hook_dir
 Directory containing hooks run by notmuch commands. See
 :any:`notmuch-hooks(5)`.
 
@@ -88,7 +88,7 @@ paths are presumed relative to `$HOME` for items in section
 
 Default: See HOOKS, below.
 
-**database.autocommit**
+database.autocommit
 
 How often to commit transactions to disk. `0` means wait until
 command completes, otherwise an integer `n` specifies to commit to
@@ -96,30 +96,30 @@ paths are presumed relative to `$HOME` for items in section
 
 History: this configuration value was introduced in notmuch 0.33.
 
-**user.name**
+user.name
 Your full name.
 
 Default: ``$NAME`` variable if set, otherwise read from
 

Clean up some warnings from makeinfo

2021-10-11 Thread David Bremner
Recently (?) makeinfo started generating pages of warnings about the
sphinx generated texinfo.  This series fixes those warnings related to
the use of explicit markup in definition lists.  There are still some
warnings about "definfoenclose", which I suspect to be a bug in
sphinx-doc.
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH] emacs: add minimal docstring for notmuch-unthreaded

2021-10-11 Thread David Bremner
The missing docstring causes a blank in the notmuch-help display
[1]. Since the function is a simple wrapper for notmuch-tree, it seems
fair to forward the reader there for more detailed information.

[1]: id:878sape5a9@disroot.org
---
 emacs/notmuch-tree.el | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
index 001a367d..7fa73d40 100644
--- a/emacs/notmuch-tree.el
+++ b/emacs/notmuch-tree.el
@@ -1206,6 +1206,9 @@ The arguments are:
 
 (defun notmuch-unthreaded ( query query-context target buffer-name
 open-target)
+  "Display threads matching QUERY in unthreaded view.
+
+See function NOTMUCH-TREE for documentation of the arguments"
   (interactive)
   (notmuch-tree query query-context target buffer-name open-target t))
 
-- 
2.33.0
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: Notmuch Emacs 0.31.2 documentation and keybinding suggestions

2021-10-10 Thread David Bremner
"Jorge P. de Morais Neto"  writes:

> Hi.  I would like to report the following documentation and keybinding
> imperfections:
>
> The info page
> [[info:notmuch-emacs.info#notmuch-hello key bindings]] says that
>  moves to the previous widget, but that key is actually bound
> to `delete-backward-char'.

Apparently Tomi "corrected"  to  in
703dec7754da477b.

> To move to the previous widget I use 
> or .

On the other hand, the keybinding in the code is to "C-", which
explains the above. To really be , it should be S-tab.

> And why does  move backward but
>  (which ought to be equivalent to , no?) moves forward?

You'd think they'd be equivalent, but actually they are not. You can use
C-h k to test, even in a GUI/X11 emacs.

> Also, it seems that  moves forward and  moves backward, but
>  does nothing useful.  For consistency with Emacs Info Mode,
> Emacs View Mode, and some other applications such as Firefox, perhaps
>  should move backward too.

I note that S-SPC is not accesible in terminals. But if there's
concensus that is is useful I don't mind adding it.

> The introduction of help buffer for Notmuch-Show (reached by hitting
> ) describes the  command without mentioning that it can archive
> the thread; only in  specific description (which does not fit in
> the same window; one has to scroll) does it mention the archiving
> behavior.  I believe the archiving behavior should also be mentioned in
> the introduction, lest the user unwittingly archive a thread she wasn't
> supposed to.

I personally don't think archiving is that destructive, if someone wants
to improve this wording, it is the docstring for notmuch-show-mode

> Also, the description for  is empty (this also happens
> in the help buffer for Notmuch-Hello).

Yes, that's a bug as the function "notmuch-unthreaded" lacks a
docstring. I think the original author of that code doesn't use emacs
anymore, so someone else is welcome to contribute one.

> In the same help buffer, the description of  says "Show help for a
> subkeymap."  Would it not be better to drop the "a", leaving "Show help
> for subkeymap." ?

This is the docstring for notmuch-subkeymap-help. In that context I
think it's better with the "a".

> Finally, the binding for  in Notmuch-Show and Notmuch-Hello
> inconveniently clobbers the tab-bar-mode binding for that key.  Should
> not Notmuch be content with // (and
> possibly ) and leave  alone?
>

Notmuch has used the binding since 2010 (almost 10 years before
tab-bar-mode existed), so people might be used to it; on other hand it
does seem redundant since the binding S-tab is also there. I'm not a
very serious user of notmuch-hello mode, and I don't use tab-bar-mode at
all, so I'd welcome feedback from other people about how attached they
are to C-tab.

___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH] configure: whitespace cleanup

2021-10-10 Thread David Bremner
Tomi Ollila  writes:

> On Sat, Oct 09 2021, David Bremner wrote:
>
>> In order to make it easier to keep the whitespace consistent in the
>> configure script, use the same style defined in devel/STYLE for
>> C/C++.
>>
>>   Specifically, a line should begin with zero or more tabs followed
>>   by fewer than eight spaces.
>>
>> Presumably this will be no more difficult for people editing configure
>> than for people editing the C and C++ code.
>
> LGTM. 
>
> Tomi
>

Applied to master.
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


release plans for 0.34

2021-10-10 Thread David Bremner

I'd like to release 0.34 fairly soon, so I'd propose a somewhat
abbreviated release cycle: feature freeze on October 15th, release on
October 20th.

d


signature.asc
Description: PGP signature
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH v2] devel: script for checking a commit (series)

2021-10-10 Thread David Bremner
Tomi Ollila  writes:

> On Sun, Oct 10 2021, David Bremner wrote:
>

> The above line does not have TAB, otherwise looks good to me.
>
> (there might be other tab/spaces inconsistencies, but this was local enough 
> for me
> to notice ;/)

applied, after (blush) whitespace cleanup.

d
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: List archive

2021-10-10 Thread David Bremner
Tomi Ollila  writes:

> On Sun, Feb 28 2021, David Bremner wrote:
>
>> I have restarted the generation of a list archive at
>>
>>   https://nmbug.notmuchmail.org/archive/notmuch-list.tar.xz
>>
>> As you can tell from the name, it's not an mbox anymore, but an archive
>> of a Maildir.
>>
>> I have updated the links I found in the wiki.  Let me know if I missed a
>> link or if there are problems retrieving it.
>>
>> Currently it is regenerated once per day.
>
> The old .mbox was convenient, as one could just fetch the ones not
> downloaded already (like I used to have:
>   wget --continue https://notmuchmail.org/archives/notmuch.mbox
> )
>
> Now it looks like one has to re-download the whole archive every time...
>

I mentioned this on IRC, but for the record, month-by-month archives (or
even file by file) is available at

 https://nmbug.notmuchmail.org/archive/notmuch-list/

d
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH v2] devel: script for checking a commit (series)

2021-10-10 Thread David Bremner
'check-notmuch-commit' is an updated version of a script I have been
using (although not always as consistently as I should) before sending
patches to the list.

Although it requires a bit more tooling, encouraging people to use
check-notmuch-commit might reduce the number of round trips to the
list for style nitpicks.
---
 devel/check-notmuch-commit | 32 
 1 file changed, 32 insertions(+)
 create mode 100755 devel/check-notmuch-commit

Changes since last round:

~ '--quick' argument to avoid expensive build/test
~ use Tomi's trick to avoid multiple calls to dirname
~ merge reindent-lisp into the main script. This eases development
  (only one script to put in path) and reduces execs.
~ include quoting fix for call to emacs  
~ add diff-filter option

diff --git a/devel/check-notmuch-commit b/devel/check-notmuch-commit
new file mode 100755
index ..99ed229d
--- /dev/null
+++ b/devel/check-notmuch-commit
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+# Usage suggestion:
+#   git rebase -i --exec devel/check-notmuch-commit origin/master
+
+set -e
+
+quick=0
+case "$1" in
+-q|-Q|--quick)
+quick=1
+;;
+esac
+
+if [ $quick = 0 ]; then
+make test
+fi
+
+unset uconf
+for file in $(git diff --name-only --diff-filter=AM HEAD^); do
+case $file in
+   *.c|*.h|*.cc|*.hh)
+uncrustify --replace -c "${uconf=$(dirname "$0")/uncrustify.cfg}" 
"$file"
+   ;;
+   *.el)
+   emacs -Q --batch "$file" --eval '(indent-region (point-min) 
(point-max) nil)' -f save-buffer
+   ;;
+esac
+done
+
+git diff --quiet
+
-- 
2.33.0
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH] configure: check explicitely for python dev (include) files

2021-10-09 Thread David Bremner
Tomi Ollila  writes:

>> +have_python3_dev=0
>> +printf "No (will not install CFFI-based python bindings).\n"
> --- tabs vs spaces difference above (use only spaces above for local 
> consistency) ---
>> +fi
>> +fi

I hadn't realized configure was such a mess indentation wise; see
id:20211009200916.1121658-1-da...@tethera.net for a proposed global
consistency fix.

>
> ...i.e. the lines 'have_python3_cffi=0' and 'have_python3_pytest=0' to appear 
> here
>

Applied to master with your suggestions
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH] configure: whitespace cleanup

2021-10-09 Thread David Bremner
In order to make it easier to keep the whitespace consistent in the
configure script, use the same style defined in devel/STYLE for
C/C++.

  Specifically, a line should begin with zero or more tabs followed
  by fewer than eight spaces.

Presumably this will be no more difficult for people editing configure
than for people editing the C and C++ code.
---
 configure | 136 +++---
 1 file changed, 68 insertions(+), 68 deletions(-)

diff --git a/configure b/configure
index e2d40d11..6c3a38f1 100755
--- a/configure
+++ b/configure
@@ -496,16 +496,16 @@ int main () {
 }
 EOF
 if ! TEMP_GPG=$(mktemp -d "${TMPDIR:-/tmp}/notmuch.XX"); then
-printf 'No.\nCould not make tempdir for testing session-key support.\n'
-errors=$((errors + 1))
+   printf 'No.\nCould not make tempdir for testing session-key support.\n'
+   errors=$((errors + 1))
 elif ${CC} ${CFLAGS} ${gmime_cflags} _check_session_keys.c 
${gmime_ldflags} -o _check_session_keys \
-   && GNUPGHOME=${TEMP_GPG} gpg --batch --quiet --import < 
"$srcdir"/test/gnupg-secret-key.asc \
-   && SESSION_KEY=$(GNUPGHOME=${TEMP_GPG} ./_check_session_keys) \
-   && [ $SESSION_KEY = 
9:0BACD64099D1468AB07C796F0C0AC4851948A658A15B34E803865E9FC635F2F5 ]
+  && GNUPGHOME=${TEMP_GPG} gpg --batch --quiet --import < 
"$srcdir"/test/gnupg-secret-key.asc \
+  && SESSION_KEY=$(GNUPGHOME=${TEMP_GPG} ./_check_session_keys) \
+  && [ $SESSION_KEY = 
9:0BACD64099D1468AB07C796F0C0AC4851948A658A15B34E803865E9FC635F2F5 ]
 then
-printf "OK.\n"
+   printf "OK.\n"
 else
-cat /dev/null; then
+   printf 'Your current GPGME development version is: %s\n' 
"$(gpgme-config --version)"
+   else
+   printf 'You do not have the GPGME development libraries 
installed.\n'
+   fi
+   errors=$((errors + 1))
 fi
 if [ -n "$TEMP_GPG" -a -d "$TEMP_GPG" ]; then
-rm -rf "$TEMP_GPG"
+   rm -rf "$TEMP_GPG"
 fi
 
 # see https://github.com/jstedfast/gmime/pull/90
@@ -570,36 +570,36 @@ int main () {
 }
 EOF
 if ! TEMP_GPG=$(mktemp -d "${TMPDIR:-/tmp}/notmuch.XX"); then
-printf 'No.\nCould not make tempdir for testing X.509 certificate 
validity support.\n'
-errors=$((errors + 1))
+   printf 'No.\nCould not make tempdir for testing X.509 certificate 
validity support.\n'
+   errors=$((errors + 1))
 elif ${CC} ${CFLAGS} ${gmime_cflags} _check_x509_validity.c 
${gmime_ldflags} -o _check_x509_validity \
-&& echo disable-crl-checks > "$TEMP_GPG/gpgsm.conf" \
-&& echo 
"4D:E0:FF:63:C0:E9:EC:01:29:11:C8:7A:EE:DA:3A:9A:7F:6E:C1:0D S" >> 
"$TEMP_GPG/trustlist.txt" \
-&& GNUPGHOME=${TEMP_GPG} gpgsm --batch --quiet --import < 
"$srcdir"/test/smime/ca.crt
+   && echo disable-crl-checks > "$TEMP_GPG/gpgsm.conf" \
+   && echo 
"4D:E0:FF:63:C0:E9:EC:01:29:11:C8:7A:EE:DA:3A:9A:7F:6E:C1:0D S" >> 
"$TEMP_GPG/trustlist.txt" \
+   && GNUPGHOME=${TEMP_GPG} gpgsm --batch --quiet --import < 
"$srcdir"/test/smime/ca.crt
 then
-if GNUPGHOME=${TEMP_GPG} ./_check_x509_validity; then
-gmime_x509_cert_validity=1
-printf "Yes.\n"
-else
-gmime_x509_cert_validity=0
-printf "No.\n"
-if pkg-config --exists "gmime-3.0 >= 3.2.7"; then
-cat <= 3.2.7"; then
+   cat 

[PATCH] configure: check explicitely for python dev (include) files

2021-10-07 Thread David Bremner
As discussed at [1] we have received reports that the implicit check
using cffi.FFI().verify() is not reliable in all environments. Since
we already use pkg-config, and the python dev package should include a
.pc file [2], add an extra check using pkg-config.  On at least
Debian, we have to know which version of python dev files with are
looking for, so calculate that first.

[1]: id:87im1g35ey.fsf@tethera.netid:87im1g35ey@tethera.net,
[2]: checked on Debian and Fedora
---
 configure | 16 
 1 file changed, 16 insertions(+)

diff --git a/configure b/configure
index 4262d122..fc9512f9 100755
--- a/configure
+++ b/configure
@@ -777,7 +777,23 @@ fi
 
 have_python3_cffi=0
 have_python3_pytest=0
+have_python3_dev=0
 if [ $have_python3 -eq 1 ]; then
+printf "Checking for python3 version ..."
+python3_version=$("$python" -c 'import sysconfig; 
print(sysconfig.get_python_version());')
+printf "(%s)\n" $python3_version
+
+printf "Checking for python $python3_version development files..."
+if pkg-config --exists "python-$python3_version"; then
+   have_python3_dev=1
+   printf "Yes.\n"
+else
+   have_python3_dev=0
+printf "No (will not install CFFI-based python bindings).\n"
+fi
+fi
+
+if [ $have_python3_dev -eq 1 ]; then
 printf "Checking for python3 cffi and setuptools... "
 if "$python" -c 'import cffi,setuptools; cffi.FFI().verify()' >/dev/null 
2>&1; then
 printf "Yes.\n"
-- 
2.33.0
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: configure checks for python3-notmuch2 module

2021-10-06 Thread David Bremner
Tomi Ollila  writes:

>
> Have to check how all this behaves on Fedora 34 machine when I 
> have access to one (currently away from such machines and from
> power grid also (laptop battery power, which I have to preserve,
> mobile devices gets charged by small solar panels so no problem
> there ;D))

Since winter is coming, I hope you are back in civilization :P. Did you
get a chance to try this?

cheers,

d
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [Tomi Ollila] [RFC PATCH] python-cffi out-of-tree build

2021-10-05 Thread David Bremner
Floris Bruynooghe  writes:

> Hi David, everyone,
>
> I had a vague recollection of reading from a single version file before
> and indeed, looking through annotations it seems commit
> 3a42abb456893b71b530f099a1467400f2b0ea71 changed this.  Seems the
> concern was that "pip install ." didn't work.  So perhaps that's
> something else to check?
>

Yes, that's correct. There could be a different way of doing this, but I
don't understand pip very well, so this is the best I could come up with
to make "pip install ." work.

d
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: T355-smime.sh is flaky

2021-10-02 Thread David Bremner
David Bremner  writes:

> With the attached (the first test from T355-smime.sh) saved as foo.sh,
> try running the following.
>
> count=0; while ./foo.sh ; do
> count=$((count + 1))
> echo $count >> tests.log
> done
>
> After the somewhere between 1 and 200 iterations this hangs up for
> me. Emacs is still running, the message-mode buffer has appropriate
> looking stuff in it. There is nothing interesting in *Messages*, and the
> buffer is still titled "*unsent mail*". When sending manually, I get
> a message that there is no key for test_su...@notmuchmail.org

Just for the record, this bug was fixed in 0.33.2

d
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH v2] lib/config: use g_key_file_get_string to read config values

2021-09-30 Thread David Bremner
Unlike the previous g_key_file_get_value, this version processes
escape codes for whitespace and \. The remaining two broken tests from
the last commit are because "notmuch config get" treats every value as
a list, and thus the previously introduces stripping of leading
whitespace applies.
---
 lib/config.cc   | 2 +-
 lib/open.cc | 4 ++--
 test/T030-config.sh | 2 --
 3 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/lib/config.cc b/lib/config.cc
index 8775b00a..d57240d1 100644
--- a/lib/config.cc
+++ b/lib/config.cc
@@ -427,7 +427,7 @@ _notmuch_config_load_from_file (notmuch_database_t *notmuch,
for (gchar **keys_p = keys; *keys_p; keys_p++) {
char *absolute_key = talloc_asprintf (notmuch, "%s.%s", *grp,  
*keys_p);
char *normalized_val;
-   val = g_key_file_get_value (file, *grp, *keys_p, NULL);
+   val = g_key_file_get_string (file, *grp, *keys_p, NULL);
if (! val) {
status = NOTMUCH_STATUS_FILE_ERROR;
goto DONE;
diff --git a/lib/open.cc b/lib/open.cc
index 8a835e98..0f44b858 100644
--- a/lib/open.cc
+++ b/lib/open.cc
@@ -199,7 +199,7 @@ _choose_database_path (void *ctx,
 }
 
 if (! *database_path && key_file) {
-   char *path = g_key_file_get_value (key_file, "database", "path", NULL);
+   char *path = g_key_file_get_string (key_file, "database", "path", NULL);
if (path) {
if (path[0] == '/')
*database_path = talloc_strdup (ctx, path);
@@ -637,7 +637,7 @@ notmuch_database_create_with_config (const char 
*database_path,
 
 if (key_file && ! split) {
char *mail_root = notmuch_canonicalize_file_name (
-   g_key_file_get_value (key_file, "database", "mail_root", NULL));
+   g_key_file_get_string (key_file, "database", "mail_root", NULL));
char *db_path = notmuch_canonicalize_file_name (database_path);
 
split = (mail_root && (0 != strcmp (mail_root, db_path)));
diff --git a/test/T030-config.sh b/test/T030-config.sh
index 09dacda3..aacdb8c6 100755
--- a/test/T030-config.sh
+++ b/test/T030-config.sh
@@ -85,13 +85,11 @@ output=$(notmuch config get foo.bar)
 test_expect_equal "${output}" "thing   other"
 
 test_begin_subtest "Round trip config item with embedded backslash"
-test_subtest_known_broken
 notmuch config set foo.bar 'thing\other'
 output=$(notmuch config get foo.bar)
 test_expect_equal "${output}" "thing\other"
 
 test_begin_subtest "Round trip config item with embedded NL/CR"
-test_subtest_known_broken
 notmuch config set foo.bar 'thing
 
other'
 output=$(notmuch config get foo.bar)
-- 
2.33.0
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH 2/2] lib/config: use g_key_file_get_string to read config values

2021-09-30 Thread David Bremner
Unlike the previous g_key_file_get_value, this version processes
escape codes for whitespace and \. The remaining two broken tests from
the last commit are because "notmuch config get" treats every value as
a list, and thus the previously introduces stripping of leading
whitespace applies.
---
 lib/config.cc | 2 +-
 lib/open.cc   | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/config.cc b/lib/config.cc
index 8775b00a..d57240d1 100644
--- a/lib/config.cc
+++ b/lib/config.cc
@@ -427,7 +427,7 @@ _notmuch_config_load_from_file (notmuch_database_t *notmuch,
for (gchar **keys_p = keys; *keys_p; keys_p++) {
char *absolute_key = talloc_asprintf (notmuch, "%s.%s", *grp,  
*keys_p);
char *normalized_val;
-   val = g_key_file_get_value (file, *grp, *keys_p, NULL);
+   val = g_key_file_get_string (file, *grp, *keys_p, NULL);
if (! val) {
status = NOTMUCH_STATUS_FILE_ERROR;
goto DONE;
diff --git a/lib/open.cc b/lib/open.cc
index 8a835e98..0f44b858 100644
--- a/lib/open.cc
+++ b/lib/open.cc
@@ -199,7 +199,7 @@ _choose_database_path (void *ctx,
 }
 
 if (! *database_path && key_file) {
-   char *path = g_key_file_get_value (key_file, "database", "path", NULL);
+   char *path = g_key_file_get_string (key_file, "database", "path", NULL);
if (path) {
if (path[0] == '/')
*database_path = talloc_strdup (ctx, path);
@@ -637,7 +637,7 @@ notmuch_database_create_with_config (const char 
*database_path,
 
 if (key_file && ! split) {
char *mail_root = notmuch_canonicalize_file_name (
-   g_key_file_get_value (key_file, "database", "mail_root", NULL));
+   g_key_file_get_string (key_file, "database", "mail_root", NULL));
char *db_path = notmuch_canonicalize_file_name (database_path);
 
split = (mail_root && (0 != strcmp (mail_root, db_path)));
-- 
2.33.0
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH 1/2] test: known broken tests for escape characters in config files.

2021-09-30 Thread David Bremner
glib generates the following escape characters with their usual
meanings: \n, \t, \r, and \\, along with \s for _leading_
spaces. Currently notmuch fails to unescape these on reading the
config files. These tests demonstrate this bug; the one new test that
passes is because apparently glib only escapes tabs at the beginning
of a key.
---
 test/T030-config.sh | 31 +++
 1 file changed, 31 insertions(+)

diff --git a/test/T030-config.sh b/test/T030-config.sh
index 3a585d1b..09dacda3 100755
--- a/test/T030-config.sh
+++ b/test/T030-config.sh
@@ -67,6 +67,37 @@ user.primary_email=test_su...@notmuchmail.org
 EOF
 test_expect_equal_file EXPECTED OUTPUT
 
+test_begin_subtest "Round trip config item with leading spaces"
+test_subtest_known_broken
+notmuch config set foo.bar "  thing"
+output=$(notmuch config get foo.bar)
+test_expect_equal "${output}" "  thing"
+
+test_begin_subtest "Round trip config item with leading tab"
+test_subtest_known_broken
+notmuch config set foo.bar "   thing"
+output=$(notmuch config get foo.bar)
+test_expect_equal "${output}" "thing"
+
+test_begin_subtest "Round trip config item with embedded tab"
+notmuch config set foo.bar "thing  other"
+output=$(notmuch config get foo.bar)
+test_expect_equal "${output}" "thing   other"
+
+test_begin_subtest "Round trip config item with embedded backslash"
+test_subtest_known_broken
+notmuch config set foo.bar 'thing\other'
+output=$(notmuch config get foo.bar)
+test_expect_equal "${output}" "thing\other"
+
+test_begin_subtest "Round trip config item with embedded NL/CR"
+test_subtest_known_broken
+notmuch config set foo.bar 'thing
+
other'
+output=$(notmuch config get foo.bar)
+test_expect_equal "${output}" "thing
+
other"
+
 test_begin_subtest "Top level --config=FILE option"
 cp "${NOTMUCH_CONFIG}" alt-config
 notmuch --config=alt-config config set user.name "Another Name"
-- 
2.33.0
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH 2/2] config: ignore leading/trailing spaces in ';'-delimited lists

2021-09-30 Thread David Bremner
In [1] Ciprian observed that it was easy for users to mistakenly
introduce leading and trailing space to new.tags when editing a
notmuch config file. This commit strips spaces on either side of the
';' delimiter when splitting.

In principle it would be possible to support tags (or other config
values) with leading or trailing spaces by processing '\s' escapes in
the input string. Currently such processing is not done.

[1]: id:ca+tk8fzjplaed3vl1f9ebk_bf_rv8pdtlzdupratkclcpja...@mail.gmail.com
---
 test/T050-new.sh   |  1 -
 test/T070-insert.sh|  1 -
 test/T590-libconfig.sh |  1 -
 util/string-util.c | 10 ++
 4 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/test/T050-new.sh b/test/T050-new.sh
index bc20440b..69697c48 100755
--- a/test/T050-new.sh
+++ b/test/T050-new.sh
@@ -330,7 +330,6 @@ output=$(NOTMUCH_NEW --quiet 2>&1)
 test_expect_equal "$output" ""
 
 test_begin_subtest "leading/trailing whitespace in new.tags is ignored"
-test_subtest_known_broken
 # avoid complications with leading spaces and "notmuch config"
 sed -i 's/^tags=.*$/tags= fu bar ; ; bar /' notmuch-config
 add_message
diff --git a/test/T070-insert.sh b/test/T070-insert.sh
index 9d29c859..ec170b30 100755
--- a/test/T070-insert.sh
+++ b/test/T070-insert.sh
@@ -235,7 +235,6 @@ test_json_nodes <<<"$output" \
'new_tags:[0][0][0]["tags"] = ["bar", "foo"]'
 
 test_begin_subtest "leading/trailing whitespace in new.tags is ignored"
-test_subtest_known_broken
 # avoid complications with leading spaces and "notmuch config"
 sed -i 's/^tags=.*$/tags= fu bar ; ; bar /' notmuch-config
 gen_insert_msg
diff --git a/test/T590-libconfig.sh b/test/T590-libconfig.sh
index 88647940..768e6576 100755
--- a/test/T590-libconfig.sh
+++ b/test/T590-libconfig.sh
@@ -273,7 +273,6 @@ test_expect_equal_file EXPECTED OUTPUT
 restore_database
 
 test_begin_subtest "notmuch_config_get_values (ignore leading/trailing 
whitespace)"
-test_subtest_known_broken
 cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR} ${NOTMUCH_CONFIG} %NULL%
 {
 notmuch_config_values_t *values;
diff --git a/util/string-util.c b/util/string-util.c
index 9c46a81a..03d7648d 100644
--- a/util/string-util.c
+++ b/util/string-util.c
@@ -42,13 +42,15 @@ const char *
 strsplit_len (const char *s, char delim, size_t *len)
 {
 bool escaping = false;
-size_t count = 0;
+size_t count = 0, last_nonspace = 0;
 
-/* Skip initial unescaped delimiters */
-while (*s && *s == delim)
+/* Skip initial unescaped delimiters and whitespace */
+while (*s && (*s == delim || isspace (*s)))
s++;
 
 while (s[count] && (escaping || s[count] != delim)) {
+   if (! isspace (s[count]))
+   last_nonspace = count;
escaping = (s[count] == '\\');
count++;
 }
@@ -56,7 +58,7 @@ strsplit_len (const char *s, char delim, size_t *len)
 if (count == 0)
return NULL;
 
-*len = count;
+*len = last_nonspace + 1;
 return s;
 }
 
-- 
2.33.0
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH 1/2] test: known broken tests for leading/trailing ws in config

2021-09-30 Thread David Bremner
These tests duplicate the bug/misfeature reported in

  id:ca+tk8fzjplaed3vl1f9ebk_bf_rv8pdtlzdupratkclcpja...@mail.gmail.com
---
 test/T050-new.sh   | 13 +
 test/T070-insert.sh| 13 +
 test/T590-libconfig.sh | 24 
 3 files changed, 50 insertions(+)

diff --git a/test/T050-new.sh b/test/T050-new.sh
index 1141c1e3..bc20440b 100755
--- a/test/T050-new.sh
+++ b/test/T050-new.sh
@@ -329,6 +329,19 @@ notmuch config set new.tags "foo;;bar"
 output=$(NOTMUCH_NEW --quiet 2>&1)
 test_expect_equal "$output" ""
 
+test_begin_subtest "leading/trailing whitespace in new.tags is ignored"
+test_subtest_known_broken
+# avoid complications with leading spaces and "notmuch config"
+sed -i 's/^tags=.*$/tags= fu bar ; ; bar /' notmuch-config
+add_message
+NOTMUCH_NEW --quiet
+notmuch dump id:$gen_msg_id | sed 's/ --.*$//' > OUTPUT
+cat &1)
diff --git a/test/T070-insert.sh b/test/T070-insert.sh
index 208deb1c..9d29c859 100755
--- a/test/T070-insert.sh
+++ b/test/T070-insert.sh
@@ -234,6 +234,19 @@ output=$(notmuch show --format=json id:$gen_msg_id)
 test_json_nodes <<<"$output" \
'new_tags:[0][0][0]["tags"] = ["bar", "foo"]'
 
+test_begin_subtest "leading/trailing whitespace in new.tags is ignored"
+test_subtest_known_broken
+# avoid complications with leading spaces and "notmuch config"
+sed -i 's/^tags=.*$/tags= fu bar ; ; bar /' notmuch-config
+gen_insert_msg
+notmuch insert < $gen_msg_filename
+notmuch dump id:$gen_msg_id | sed 's/ --.*$//' > OUTPUT
+cat EXPECTED
+== stdout ==
+a
+b c
+d
+== stderr ==
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+restore_database
+
 test_begin_subtest "notmuch_config_get_values_string"
 cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR} ${NOTMUCH_CONFIG} %NULL%
 {
-- 
2.33.0
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: Strip spaces in `tags` in `~/.notmuch-config` (and other fields)

2021-09-30 Thread David Bremner
Ciprian Dorin Craciun  writes:
>
> Given that the `~/.notmuch-config` resembles an INI file, and given
> how lax the actual syntax is in general, I would suggest the
> following:
>
> * allow white-spaces around `[ section ]`, and `field = value`;

This is somewhat out of our control, as we rely on glib to parse these
files.

> * strip white-spaces (left and right) from values like `tags = unread
> ; inbox ;`;  (but not infix like `tag = some tag ; some other tag;`;)

I will shortly send a patch to implement this. It has the potential
issue that it is no longer possible to enter tags with leading/trailing
spaces in the config file. That doesn't seem like a big deal to me, but
I guess we'll see.

> * allow skipping the last `;` separator from `tags` and similar;
>

This should be working now. The last ; is optional (since notmuch 0.32,
I think).

> Failing that, perhaps add a warning when parsing the configuration file.

This again comes down to the config file parser we are using.  However,
we can (and do) scan the tags afterwards for certain issues, which we
could further extend.
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


notmuch release 0.33.2 now available

2021-09-30 Thread David Bremner

Where to obtain notmuch 0.33.2
===
  https://notmuchmail.org/releases/notmuch-0.33.2.tar.xz

Which can be verified with:

  https://notmuchmail.org/releases/notmuch-0.33.2.tar.xz.sha256.asc
  -BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

244892f6ab52a84f6b013b387cd6652d461effd36b14ef9e576604b5850b2cae  
notmuch-0.33.2.tar.xz
-BEGIN PGP SIGNATURE-

iQIzBAEBCAAdFiEEkiyHYXwaY0SiY6fqA0U5G1WqFSEFAmFVoPgACgkQA0U5G1Wq
FSGeBA//TO4AaeNRqc6XPZvG0VsvUFVLqswWHAEXP6fvakXXFkex4UD6DoJlt5gk
ZTTxkyxrsjRvikSFOBsbW6SmbJIzFtPqx5/1X6UeoiedRoh3LD5pNrIg9DktQpOw
l5pccH3dWm6jEgC5OvauFE2kiRFwFgI6X63LDzlg7qZa6ggCQwxf844gx2amxpJX
aBt2lQ0w2mnc1nywrxyGLXhsJgSYJSGMRDHHGMe2dOJKSycxMg0aZ7eMFYckVL/K
xh6LwT1MUhYTvMzCMxLiZ9xX41gH1SBdJrKvIYa0t7UwQ0iT8G9zLST156Ryw8R2
uVLHGjxMqLOq67Fqmz3AvLEPZhKgr6lQvs4IGM/G9bzMG4ocA2NhxNbsx7AoHz6T
1SMBElGy8tQBDtvN/AxK4WQV8uTYqYIG7tETtiYcB2UIn3PIja8Ko/keLVjZXMke
k/zvYnyxKaL/dlzqd1UJIv64kv93BWENuo98qV4nLIrUTVFK5wmw3Scvc1OIa9Vd
s+TYh0vZbBU5Cas4RandMPV/chT+zLCP0lqyNi1DyFfUliC7Hx2Qt6lVuu7dNwHt
Je9JosqcyAG5YVBDnVileHMpuL6NzPYBdzvWiqg8B4AgwmvlAOWIcEdOGf2Gs1id
+Vs+P6nsN2zpnPkhvikIT5GF+sAqUpZ7XK8EpFAIVLvh2Lp5aPM=
=nTkX
-END PGP SIGNATURE-

  https://notmuchmail.org/releases/notmuch-0.33.2.tar.xz.asc
  (signed by David Bremner)

What's new in notmuch 0.33.2
=

Tests
-

Improve reliability of T355-smime by changing gpgsm initialization.

What is notmuch
===
Notmuch is a system for indexing, searching, reading, and tagging
large collections of email messages in maildir or mh format. It uses
the Xapian library to provide fast, full-text search with a convenient
search syntax.

For more about notmuch, see https://notmuchmail.org



signature.asc
Description: PGP signature
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: Does notmuch works on Windows?

2021-09-29 Thread David Bremner
 writes:

> Notmuch seems to be a good solution for dealing with emails in Emacs. I've
> learned that Notmuch as been packaged for a few Linux, BSD and macOS
> operating systems.
>
> Now, is there a way to have Notmuch running in Windows (v. 8.1) with Emacs?
> Is there a reasonable workaround? 
>
> Thank you for you time and feedback.
>

Some years ago, Claudio Bley ported notmuch to Windows [1]. Looking at
github [2], it looks like that project is no longer active. I have
copied Claudio in case he has more up to date information.

The easy path would presumably be to use WSL(2?). I have seen discussion
of that in various web searches, but I don't have any personal
experience with it (and iirc, it needs a newer Windows?).

[1]: 
https://nmbug.notmuchmail.org/nmweb/show/87mwm71x91.wl%25claudio.bley%40gmail.com
[2]: https://github.com/avdv/notmuch-w32
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH] test/T355-smime: Use key as exported by gpgsm

2021-09-28 Thread David Bremner
David Bremner  writes:

> As reported in id:87h7pxiek3@tethera.net, the previous version of
> the test is flaky. There is some so-far undebugged interaction between
> openssl and gpgsm that causes the keys to fail to import. As a
> potential workaround, use the key as exported by gpgsm, and eliminate
> openssl from this particular pipeline.

I ran the loop described in id:87h7pxiek3@tethera.net, it it got to
7493 iterations without a crash in the 3h I gave it, so I think the
flakiness is fixed. I don't really understand enough about S/MIME to
know if I should clean up the key material in tests/smime, so for now
I'm leaving it in multiple forms.
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH] test/T355-smime: Use key as exported by gpgsm

2021-09-27 Thread David Bremner
As reported in id:87h7pxiek3@tethera.net, the previous version of
the test is flaky. There is some so-far undebugged interaction between
openssl and gpgsm that causes the keys to fail to import. As a
potential workaround, use the key as exported by gpgsm, and eliminate
openssl from this particular pipeline.
---
 test/smime/0xE0972A47.p12 | 62 +++
 test/test-lib.sh  |  6 ++--
 2 files changed, 64 insertions(+), 4 deletions(-)
 create mode 100644 test/smime/0xE0972A47.p12

diff --git a/test/smime/0xE0972A47.p12 b/test/smime/0xE0972A47.p12
new file mode 100644
index ..2c4a6d17
--- /dev/null
+++ b/test/smime/0xE0972A47.p12
@@ -0,0 +1,62 @@
+Issuer ...: /CN=Notmuch Test Suite
+Serial ...: 6F748C94BD0C67A9
+Subject ..: /CN=Notmuch Test Suite
+aka ..: test_su...@notmuchmail.org
+Keygrip ..: 1727B9C7108D50333614F3B1DD0807F624B31130
+
+-BEGIN PKCS12-
+MIIJ+AIBAzCCCb4GCSqGSIb3DQEHAaCCCa8EggmrMIIJpzCCBAcGCSqGSIb3DQEH
+BqCCA/gwggP0AgEAMIID7QYJKoZIhvcNAQcBMBwGCiqGSIb3DQEMAQYwDgQIcfMY
+MS7tOpcCAggAgIIDwFu7ZRNrXCb0eKei44aeBZPRs9YI/5EpMcFuc8j4/8T1HkIt
+GuRe/HzRmoiLZcAMOzGC/hF8TkHlNeUZ7rOSpCg4UlBVWJS6avTMHHsakDvTV/7q
+X5VNi4pLUuyEToGTAPHV+s5P/gYYG6mFPkwG/pDDlAcgMhgtuPY/lQp6IS/E6CaR
+fhcnQiPq9ySTqO7UNwIyMwtAtSHkgBaje8UbOkQch4lg51i97rm9m4EMvklKtjXc
+Ud4aTEuoZguPmdBdLvF5QxqJf6Bm9lHa1Awhru2gBWQf9TjX8bwK9Xsv8G6gPOwc
+LVpIR9fMZtgBbc+heeJTjfn6VqEy881ckbkz+38hiN3pbLMuATM7QAY3u3N4whM6
+Hmfyl3iqba84Pl93zaUzqazAUeFdqcqSpAUGkS4gU6klr9qi3NicaGbry1DySYU7
+2h4xy3j7eiHxqdWaibdPoBC8CEbPaFj2qnOVsZykxG6zPvbEB+5sJ/a+T6xm1Btx
+N6vXR7ObbXlpC4pRkS32ehuRbY6wc6H2KKepOMCu7x10tN0Up5ccNxvkT26QIrEE
+LW296ijCLbsRhWymDtopWAZHcXXIu0fJ4tocSp2c3lojSEYu1jlMXR+Pa4R8EtgZ
+lb5+NqISxjUlMMWzGDyhrp9ImcsZmpv6N8zPcZVyU+M1/h+p9ur/IOVZU9P1vIKy
+kcM4pslr0JhLfnZCLZ+3Ux1yKAcndGZFPb1vZ83jyZKR38BVSGu53ODaBJBqSMHu
+Mv2Na/qzvQBSVJuWF9cAhiVd7v9R/EvT0zmljN4w7l4EXsB5wRsO1wvlL+MhwaET
+dIHbRH2GD3gERX6oTc3t3cgritVePk70rCxQDxn5zUbjW7dNIlIobAumLHBfgSxR
+QCE6gxdTm5MW2O9hnfTSQvliVaGU1gd0M3BRiqeNpPPxnloGKnOEODM381F4HxyR
+CzO2r/2aKJP+U5HxSf4cljp3/Lripxykzfqc9/xZshl+jGixsSSm+Ul916Hpj2Rt
+j9vHg4H9YfJTGdvzxZcvZCvNSy3ygtjx0++SrI5hGHKjpVJIK2/9Wi39q5s6LkiA
+RCjvuoBBcQXm++69X7QGWSsGFtwerCGnq3nAxGpHVKVGTvFYMAg6y1RR0zvE0SuM
+MZegD8w45QyrmiPqSRM7/RtqVdA+r/wiJwWerUBq+mrCvJHB2NRcjiUiCJY1bjRU
+ATMfB0uZaNInUXiLDGxp2mdBgdFVq7sYTbq+OvprzxeAjIvodxl3J9ThvJnt1fzK
+RPCJw5COI60ibE3XTTCCBZgGCSqGSIb3DQEHAaCCBYkEggWFMIIFgTCCBX0GCyqG
+SIb3DQEMCgECoIIE7jCCBOowHAYKKoZIhvcNAQwBAzAOBAiEe8CcxIIv9wICCAAE
+ggTIujut93lYPUsKc/JNhZhUWS/RHHog6d8ZAjpFvXpyD8Z2z4A4PpgIn8eUSRW5
+Gwp8izR+16Tj3ht52pJ5Y1x27/S3l3sDlekEZ/33X/AdLFWAXbcibmwtRea1ucKZ
+ze3DJM7CvuRvVSBG8XubPGi3pZkEjHBGQqgtsTnxlBp0PXl7wxfyT7F6gOH2DGYP
+bYzNa2fnY8twEcUYhuksI/eh9Zwj9TrF0HWq1hwp0tDCfqutzshSX2GQ/p0raL3B
+C2stHBjl0OVUfDHpqQ5OJWbQvGcJntECqu4gmSJohunObaUKcN8xs+FzB5czpmsT
+W/pyR58nc8QhTttByqZN3EerhEogWDZj4tQ6dK8p6bqLO/0qqBehZGchfof5Evwj
+VFsvVGD8xVLQWWAFnrQs5+U56NQEbmZzN5RCI7FEK2VVOeG03dpXyoAQyxuYrsYU
+3znmoSleIqDDBFD21YePUcJZ0R8AQsvgV11tdwPWqr1hk0bIazLQ9rappGrTgkK8
+DFdQKSH1dRvjqtbuDyY7j5PXXJTXthVv9T9N7Vp6qU+pWBQ1Mz30J+fHX2ilEnbi
+tQ49hwt1+/2Zkmwz3reoEnxYOKzCg/ySIpQ27/Hx4xZ+ecEzX/0IxCkHeAV3V3bB
+1z8wFxWEh1s9hL6C8lRk/wQ9KsKaxM7BdLw7RjiqEwR4HgeCqMPdCVQQpILARDC8
+Poz8xUmjv7HyIvvyBUP12YdIj74Jjj0Mm2r/FDj7nsXxkjXMZEMMKK3oVaAMq8Bd
+cO4VQXDd7bgNzLF9PKxWNjoCuQcPJXwMPqlFoc06BLPstEaR4enafv0Pd4l0pyME
+YgezyVW+3yFEsbbB2UUs0r7oqxsDFU9/iHf8O3nu3NuKTJkux4uMlOTBKsm6sY7k
+GduP2UA+WU27jHrf4zQQbkDLG1lJFfcaKzlcOmz5B9iZwugBz9Y28w5f2/12Kqrh
+4tibFBUG0E85KAb1wnFUNUx06OMX229U1M0E1LHbcUJ9mcRipONPVn0FRi8XzaLK
+023XRoihuoWhVUiB1OJ2eZW1JnUYRztfa3nfmGjXv4VGkxYlnTkE9z0PAAhf6t5A
+7Ir0y1JUeOlBITTcojOp6qQ8tMQQ5wRk1oncHiw3WwJvFN6fOa9Q/+4ZmULHz0vV
+Xl+Qio8B7/4jqZoT4e/gK6U/zHriznLzqp63LjP47eFRXTfuXslaCt7YF75Mq2J6
+VPA+qfYRw0K5BvDUkr8c+nLP2AiDaEYVBHGdBRTlWO9UkcB1F4cuZZiU5MZbxVrb
+Db+zGWW6AT+4XTO4z9KmAqgTTv1+BQrLxNI+RG8JfQapUKQyB794F4kXK2yhd1P3
+XS9cwh24COiqbOpI1nB5qn7cn4RRHW156LWGF+VJFdxR6Wu3vZx/kZGevG9o1ARF
+z1l9mbGyhwnUJO1EQwjbppvRou1bZuNbuRgLmHKEVPAv+J+7hLXZAnRdwoV0x91t
+bpmy4qyxA/90DHguIhRVcKsYBrdShY7LXdZArECBhMY9R41D6v1yyhC6fL6PKR5g
+DaluN2K9TBALzZH7NnNdE14l+56+kLc9Fq8JXsq3rxdeBTsNl09fHPf9w5VLkq4I
+doNcPPlta0Q0xJNa/RYENCJpAMZdMFIJ558uMXwwVQYJKoZIhvcNAQkUMUgeRgBH
+AG4AdQBQAEcAIABlAHgAcABvAHIAdABlAGQAIABjAGUAcgB0AGkAZgBpAGMAYQB0
+AGUAIABlADAAOQA3ADIAYQA0ADcwIwYJKoZIhvcNAQkVMRYEFGFvRs1zg0xjhHdW
+rw37ZKbglypHMDEwITAJBgUrDgMCGgUABBSluQBa+tVpYVYmB/zAZuPE9NnargQI
+XWSQTDEONWgCAggA
+-END PKCS12-
diff --git a/test/test-lib.sh b/test/test-lib.sh
index dc4962f5..32f710a5 100644
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -143,10 +143,8 @@ add_gpgsm_home () {
 _gnupg_exit () { gpgconf --kill all 2>/dev/null || true; }
 at_exit_function _gnupg_exit
 mkdir -p -m 0700 "$GNUPGHOME"
-openssl pkcs12 -export -passout pass: -inkey 
"$NOTMUCH_SRCDIR/test/smime/key+cert.pem" \
-   < "$NOTMUCH_SRCDIR/test/smime/test.crt" | \
-   gpgsm --batch --no-tty --no-common-certs-import 
--pinentry-mode=loopback 

Re: How to disable html render at all?

2021-09-26 Thread David Bremner
Dmitry Polyakov  writes:

> Hello everyone.
>
> When none of multipart but text/html was found, notmuch render html part
> of email, but how I can disable this behavior? Perfectly is to toggle
> render html by some function.
>

Apologies for the long wait. If you customize mm-inlined-types, you can
replace text/.* with text/plain, then html parts will never be
inlined. If you want to view them, you could use ". o" and give the name
of an external browser.  It's not as convenient as just pressing the
[text/html] button to render, but I think that would actually render
them, but keep them hidden, even if I could figure out the magic
incantation to make it work.

d
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [alot] announcing v0.10

2021-09-26 Thread David Bremner
Patrick Totzke  writes:

> This release contains the usual minor usability improvements and is the first
> to rely purely on the new cffi python bindings (available under
> notmuch/bindings/python-cffi and know to python as notmuch2).
> Many thanks to Frank Lenormand for the initial patchset and to Floris
> Bruynooghe and Michael J Gruber for subsequent fixes.

Hey, that's great news, I'm glad you could migrate to the new bindings.

d
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [RFC WIP PATCH] test: use GNU make instead of parallel(1) to run tests in parallel

2021-09-26 Thread David Bremner
Tomi Ollila  writes:

> quick try -- more to follow if there is interest :D
>
> moreutils parallel and gnu parallel are fine tools, but if tests
> can be run in parallel with gnu make (which is required anyway)
> those are not needed to be installed -- not in linux nor in any
> other system where such tools may be harder to install...

At least for me, installing moreutils is not a burden. So someone else
will have to drive this if they are motivated.

d
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: Why some characters are not displayed correctly when setting mm-text-html-renderer to links

2021-09-26 Thread David Bremner
David Bremner  writes:

> Wenlong Dai  writes:
>
>>
>> After some research, I found that setting mm-text-html-renderer to links
>> would reduce the load time from 
>> to around 2 seconds or less. But one small issue with this is some
>> characters are not displayed correctly, for example the
>> RIGHT SINGLE QUOTATION MARK, which would be displayed as \342\200\231
>>
>
> I didn't have time to debug this yet, but I did duplicate the problem on
> Emacs 27.1 on Debian, so it is not Windows or gccemacs specific. As far
> as I can tell links is outputing non-utf8 characters, but it could also
> be other issues like double decoding.
>

Thanks to Lars Ingebrigtsen, the problem will be fixed in emacs 28, as
of upstream emaacs commit a2c75d349a3ab83.

d

___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: bug#50713: 27.1; mm-inline-render-with-file should not (always?) use mm-with-unibyte-buffer

2021-09-26 Thread David Bremner
Lars Ingebrigtsen  writes:

> ⚠External message: Use caution.
>
> David Bremner  writes:
>
>> Please find attached an example mail file. It is a spam message, but it
>> does seem to declare utf8 charsets. It is display OK in gnus (and in
>> notmuch, using mm-* to process the mime parts) if mm-text-html-renderer
>> is 'shr, but not if it is 'links,
>
> Thanks; with that mail I can reproduce the problem -- with is that links
> assumes that it's only dealing with ASCII text and *s out all non-ASCII
> octets from the file unless you bind LANG to something that's not
> ASCII-ish.
>
> I've now done so in Emacs 28, and it seems to work fine now.

Perfect, I verified the fix in emacs commit 2a2c75d34 also fixes the
problem reported by a notmuch user.

d
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: performance in emacs displaying a huge thread

2021-09-25 Thread David Bremner
Alan Schmitt  writes:

>
> The surprising thing is that there is not file 
> ~/.emacs-configs/doom-emacs/.local/straight/repos/notmuch/emacs/notmuch-version.el,
> just a file
> ~/.emacs-configs/doom-emacs/.local/straight/repos/notmuch/emacs/notmuch-version.el.tmpl
> so this is probably why the global file is chosen.
>
> I have no idea why this is happening… It could be a doom or straight
> bug… If you think so as well, I will report it.

I think it is a bug in doom or straight, or at least an assumption that
turns out to be wrong. They are assuming the elisp is runnable from git,
but in fact it needs to run make to create notmuch-version.el. I think
the straight recipe could specify a ":pre-build" step to build
notmuch-version.el. I attach a Makefile snippet that shows how to build
the file without running configure. You'd still need make, git, and sed. 



Standalone.mk
Description: Binary data
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: performance in emacs displaying a huge thread

2021-09-24 Thread David Bremner
Alan Schmitt  writes:

> Hello David,
>
> I found the source of the issue, and I would like to apologize because
> it’s fully my fault. I’ve realized I was not using the elisp code from
> the package installed using my package manager, but one installed using
> straight that was pinned to an old version. I simply switched to the
> release branch, and now everything works out of the box.
>
> I’m very sorry for the time lost.
>

That will teach me not to ask people to check M-x notmuch-version!

d
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: Distribute manual page directly?

2021-09-24 Thread David Bremner
Chunyang Xu  writes:

> Hello,
>
> I installed notmuch via Homebrew and didn't get manual page. It looks
> like python-sphinx is required to produce the manual page. My question
> is: can you distribute the manual page directly in the tarball? so we
> don't have to install python-sphinx.
>

I'm not sure it helps your specific (old) request, but the documentation
for the current version, which is textually identical to the man pages,
is available online at

   https://notmuchmail.org/doc/latest/

I'm still a leary of making the source tarball diverge further from the
git repo (or committing generated files), but having a seperate docs
tarball generated as part of the release process seems like it might be
OK.
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: Bug: Emacs notmuch display

2021-09-24 Thread David Bremner
j...@fedge.ca writes:

> Hey David, that worked!  Thanks so much!
>
> So going forward... should I reach out to the Solus development and  
> ask them to update their "notmuch" version?
> And until the Solus repository version matches the emacs one, I should  
> refuse to update the emacs notmuch?
>
> Thanks again.

Yes, it seems reasonable to ask them to update notmuch, 0.31.4 is about
6 months old, so not ancient, but not yesterday either. The ideal
situation would be that they provide a matching package for
notmuch-emacs as other linux distros like Debian and Fedora do. Failing
that, yes you will want to be careful about upgrading notmuch-emacs.
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: performance in emacs displaying a huge thread

2021-09-22 Thread David Bremner
Alan Schmitt  writes:

>
> I can view a thread with more than 7000 messages (with
> show-only-matching-messages to t) if they are not encrypted. In fact I
> already could with 0.32 if I remember correctly. The fact that messages
> are encrypted seems to matter here.

I've been unable to replicate this deep recursion. Whenever I'm in
unthreaded search view, I have one message summary on every line, and
when I trace through notmuch-show-insert-tree,

  (let ((msg (car tree))
(replies (cadr tree)))

always assigns nil (empty list) to replies.  That means my call stack
has exactly one instance of notmuch-show-insert-tree.

>
> If it matters, here is the bottom of the debug stack:
>
>   notmuch-show-insert-thread(((nil ((nil ((nil nil) (nil (... ...))) 1)
>   notmuch-show-insert-tree((nil ((nil ((nil ((nil nil) (nil ...))) 0)
>   #f(compiled-function (tree) #)((nil ((nil ((nil 
> ((nil nil) (nil ...
>   mapc(#f(compiled-function (tree) #) ((nil ((nil 
> ((nil (... ...
>   notmuch-show-insert-thread(((nil ((nil ((nil (... ...))) 0)
>   #f(compiled-function (thread) #)(((nil ((nil ((nil 
> (... ...
>   mapc(#f(compiled-function (thread) #) (((nil ((nil 
> ((nil ...
>   notmuch-show-insert-forestnil ((nil ((nil ...
>   notmuch-show--build-buffer()
>   notmuch-show("id:mr.ye1axfhsd2e.vd_os17a...@polytechnique.org")
>   notmuch-tree-show-message-out()
>   notmuch-tree-show-message(nil)
>   funcall-interactively(notmuch-tree-show-message nil)
>   call-interactively(notmuch-tree-show-message nil nil)
>   command-execute(notmuch-tree-show-message)

On possibility is that there some old version of the code that you are
running.  Inside notmuch-show-insert-tree, the variable
notmuch-show-single-message should be 't', whether called from regular
tree-mode or an unthreaded search.

As an experiment, you could try redefining

(defun notmuch-show-insert-tree (tree depth)
  "Insert the message tree TREE at depth DEPTH in the current thread."
  (let ((msg (car tree))
(replies (cadr tree)))
(message "nreplies %d flag %s" (length replies) notmuch-show-single-message)
;; We test whether there is a message or just some replies.
(when msg
  (notmuch-show-insert-msg msg depth))
(notmuch-show-insert-thread replies (1+ depth

this will log the number of replies and flag value. For me, it logs

"nreplies 0 flag t"
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: Bug: Emacs notmuch display

2021-09-22 Thread David Bremner
David Bremner  writes:

> j...@fedge.ca writes:
>
>>
>> Thanks. I guess I'm still stuck.  I downloaded version 31.4 from:
>> https://notmuchmail.org/releases/
>>
>> But when I select "notmuch-0.31.4.tar" for the package-install-file, I  
>> get an error:
>>  Wrong type argument: stringp, nil
>
> It's a bit confusing, but there is the source tarball notmuch-0.31.tar.xz, 
> that you
> downloaded, and the output from "make elpa", which is called
> notmuch-0.31.4.tar. I'll send you copy of the latter off list.

Even more confusing when I mess up the name. The output from "make elpa"
is actually notmuch-emacs-0.31.4.tar
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: Bug: Emacs notmuch display

2021-09-22 Thread David Bremner
j...@fedge.ca writes:

>
> Thanks. I guess I'm still stuck.  I downloaded version 31.4 from:
> https://notmuchmail.org/releases/
>
> But when I select "notmuch-0.31.4.tar" for the package-install-file, I  
> get an error:
>  Wrong type argument: stringp, nil

It's a bit confusing, but there is the source tarball notmuch-0.31.tar.xz, that 
you
downloaded, and the output from "make elpa", which is called
notmuch-0.31.4.tar. I'll send you copy of the latter off list.

> Would it not make sense to upgrade notmuch to 0.33.1 ?  Which I guess I would
> have to do from source, which I haven't done before...

Sure, definitely an option, it just requires installing a few more
dependencies, and maybe figuring out how to make sure the binaries are
in your path.
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: Bug: Emacs notmuch display

2021-09-22 Thread David Bremner
Jeff Elliott  writes:

> [Wed Sep 22 15:49:36 2021]
> A caller requested output format version 5, but the installed notmuch
> CLI only supports up to format version 4.  You may need to upgrade your
> notmuch CLI.
>
> When I try to upgrade my notmuch from the Solus package manager, I get
> that it is already updated.

Yep, this is exactly the problem mentioned in the README on melpa (which
I'm guessing is where you installed notmuch from). You need to use a
version of the notmuch CLI that is as new as as your version of
notmuch-emacs, or an older version of notmuch-emacs. Normally I would
recommend using the notmuch-emacs package from your distro, but I
couldn't figure out if it exists in solus.

If you have the appropriate version of the source, then "make elpa" will
create package you can install in emacs

M-x package-install-file 
notmuch-0.31.4.tar 

should work. If you're stuck, I can make such an elpa package for you.
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: performance in emacs displaying a huge thread

2021-09-21 Thread David Bremner
Alan Schmitt  writes:

> On 2021-09-21 09:42, David Bremner  writes:
>
>> That's not completely unexpected. The change in question only really fixes 
>> it for
>> unthreaded view. Try notmuch-unthreaded-from-search-current-query (bound
>> to 'U' by default).
>
> Thank you for bearing with me. I confirm that I can see messages at the
> beginning of the thread using both an unthreaded search and
> notmuch-show-only-matching-messages set to t. Unfortunately, messages
> later in the thread still result in an error:
>
> Debugger entered--Lisp error: (error "Lisp nesting exceeds 
> ‘max-lisp-eval-depth’")
>   mapc(#f(compiled-function (tree) #) ((nil ((nil 
> ((nil (...)) (nil ((nil ((nil nil)))
>   notmuch-show-insert-thread(((nil ((nil ((nil (...)) (nil ((nil ((nil 
> nil)) 197)
>   notmuch-show-insert-tree((nil ((nil ((nil ((nil ...) (nil ((nil ((nil 
> nil))) 196)

I don't really understand how you got here. For me, if I type U from
notmuch-search to get an unthreaded view, then  just shows the
single message, and "notmuch-show-insert-tree" is not called.

In this way I can view arbitrary messages threads of up to 1024 in
length. I didn't test with encrypted messages, maybe that changes
something.
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: performance in emacs displaying a huge thread

2021-09-21 Thread David Bremner
Alan Schmitt  writes:

> Hello,
>
> I’m on notmuch 0.33.1 and I’m still having issues displaying messages in
> long threads when the messages are encrypted. I have such a thread with
> more than 600 messages, and when I do the following:
> - search for the messages
> - run notmuch-tree-from-search-current-query

That's not completely unexpected. The change in question only really fixes it 
for
unthreaded view. Try notmuch-unthreaded-from-search-current-query (bound
to 'U' by default).
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [RFC 0/2] add --new-tags= to notmuch-new(1)

2021-09-20 Thread David Bremner
andr...@rammhold.de writes:

> I am posting this as an RFC to see what other users and the developers think
> about this approach and if anyone has solved a similar issue (in a different
> way).

I honestly don't know if what you propose is the best solution for your
problem. Looking at the functionality for it's own sake, I wonder why
you don't copy the UI from notmuch insert, which already allows
specifying arbitrary tag operations for newly delivered messages. I
suspect some of the code can re-used as well.

d
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH v4] emacs: notmuch-tree: customizable strings for drawing trees

2021-09-20 Thread David Bremner
Jose Antonio Ortega Ruiz  writes:

> On Tue, Aug 31 2021, David Bremner wrote:
>
>> jao  writes:
>>
>>> -  (push "│" tree-status))
>>> +  (push (alist-get 'vertical notmuch-tree-thread-symbols 3) 
>>> tree-status))
>>
>> That 3 looks like a typo. If nothing else turns up, I can just delete
>> it.
>
> indeed.  it's a leftover of my previous implementation.  please go
> ahead.  thanks!

Done, and applied to master.
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [bug] notmuch-read-tag-changes, incompatability with consult, non-standard usage of completing-read-multiple

2021-09-20 Thread David Bremner
Natnael Kahssay  writes:

> notmuch-read-tag-changes throws error, "Tag must be in the form of 
> +'this_tag' or '-that_tag'" when used with consult. notmuch-read-tag-changes 
> expects completing-read-multiple to strip crm-separator out of results. 
> Consult's implementation of competing-read-multiple doesn't strip results.
> I discussed with the author of the package here. 
> https://github.com/minad/consult/issues/410
>
> He states notmuch is using a non-standard and possibly tentative property of 
> completing-read-multiple. I agree.


This seems related to the discussion starting at

 https://nmbug.notmuchmail.org/nmweb/show/87im0w6u5r.fsf%40m4x.org

See in particular

https://nmbug.notmuchmail.org/nmweb/show/m2pmud2xxa.fsf%40dme.org
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: Cannot Start Notmuch (invalid-read-syntax "#")

2021-09-14 Thread David Bremner
Tomi Ollila  writes:

> On Mon, Sep 13 2021, Charles-André Roy wrote:
>
>> Hello David,
>>
>> I have removed and purged the notmuch-emacs package.
>>
>> elpa-notmuch/stable,now 0.31.4-2 was already installed.
>>
>
> The notmuch-config.el file is created by user; if it exists, notmuch emacs
> mua loads it.
>
> The following defines it (no notmuch.el)
>
> (defcustom notmuch-init-file (locate-user-emacs-file "notmuch-config")
>  ...)

A few more questions based on Tomi's experiments / observations.

1) Can you try starting "emacs -q", then evaluate "(require 'notmuch)" in
   *scratch*.  If notmuch starts after this we have confirmed it is
   something specific to your emacs configuration. The usual approach is
   then to bisect your init.el

2) Check in .emacs.d/elpa for any residual notmuch-* directories


___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: Cannot Start Notmuch (invalid-read-syntax "#")

2021-09-13 Thread David Bremner
Charles-André Roy  writes:

> Hello David,
>
> Thank you for your responses !
>
> 1. I looked at the load-path variable and the $HOME directory per se is
> not in it.  There are many directories in $HOME/.emacs.d leading to
> packages I have installed.
>
> 2. I installed notmuch-emacs through the Debian packages
> apt list gives notmuch-emacs/now 0.28.4-1 all  [installé, local]

That is quite old (from buster I guess?). Can you try elpa-notmuch 0.31.4-2
from bullseye?  That version you have of notmuch-emacs should be a dummy package
depending on elpa-notmuch, so safe to remove.

> apt list also gives notmuch/stable,now 0.31.4-2 amd64  [installé]
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: Cannot Start Notmuch (invalid-read-syntax "#")

2021-09-13 Thread David Bremner
David Bremner  writes:

>> Debugger entered--Lisp error: (invalid-read-syntax "#")
>>   read(#)
>>   eval-buffer(# nil "/home/charles/.notmuch-config" nil t)  
>> ; Reading at buffer position 2
>>   load-with-code-conversion("/home/charles/.notmuch-config" 
>> "/home/charles/.notmuch-config" t t)
>>   load("~/.notmuch-config" t t nil t)
>
> The emacs function load is for lisp files. $HOME/.notmuch-config is an
> INI style config file, which does indeed have many '#' in it by
> default. Why emacs is trying to run .notmuch-config as lisp is currently
> a mystery to me.

Oh, I might know what is happening. notmuch-emacs is trying to load
.notmuch-config.el, and you (maybe?) have $HOME in your emacs load-path.
I guess I would pretty strongly recommmend not having $HOME in your
emacs load-path (at least I just end up with random files in my $HOME).
If it's important to you to have $HOME in your load-path, you can use
the XDG location for your config file: put it in
$HOME/.config/notmuch/default/config.

d
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: Cannot Start Notmuch (invalid-read-syntax "#")

2021-09-13 Thread David Bremner
Charles-André Roy  writes:

> I am using Debian.  I recently installed Bullseye with Emacs 27.1.  Now
> I cannot start Notmuch in emacs anymore.  I can download my mail and
> send them.  The commands in the terminal work as usual.

How is notmuch installed? Have you installed both CLI and emacs
front-end from source?

> I also have a problem with "cl library deprecated" but judging from my
> searches on the Web this would be a different issue.

I don't think those messages are notmuch related, since (current)
notmuch uses cl the "modern" way by requiring cl-lib. One possibility is
old .elc files. 

> Debugger entered--Lisp error: (invalid-read-syntax "#")
>   read(#)
>   eval-buffer(# nil "/home/charles/.notmuch-config" nil t)  ; 
> Reading at buffer position 2
>   load-with-code-conversion("/home/charles/.notmuch-config" 
> "/home/charles/.notmuch-config" t t)
>   load("~/.notmuch-config" t t nil t)

The emacs function load is for lisp files. $HOME/.notmuch-config is an
INI style config file, which does indeed have many '#' in it by
default. Why emacs is trying to run .notmuch-config as lisp is currently
a mystery to me.

>   
> byte-code("\303\20\304\305!\210\11\203\22\0\306\n\307\211\310\307%\210\310\207"
>  [mail-user-agent init-file-user notmuch-init-file notmuch-user-agent provide 
> notmuch load t nil] 6)
>   autoload-do-load((autoload "notmuch" "notmuch mail" t nil) notmuch)
>   command-execute(notmuch record)
>   execute-extended-command(nil "notmuch")
>   smex-read-and-run(("notmuch" "byte-compile-file" "package-delete" 
> "list-packages" "man" "shell" "package-list-packages" "eshell" "nomPrenom" 
> "spam" "battery" "olivetti-mode" "lbdb" "locate" "widen" "replace-string" 
> "info" "emojify-mode" "count-matches" "séparateur" "eww" "calendar" 
> "query-replace" "emms" "Info-menu" "now" "org-sort" "goto-char" 
> "lisp-interaction-mode" "car--nettoyerFicheCarnetAdresses" "abbrev-mode" 
> "sunrise-sunset" "insert-kbd-macro" "tramp-unload-tramp" 
> "pdf-tools-customize" "org-element-update-syntax" "customize" "suiviPortions" 
> "package-autoremove" "transient-mark-mode" "variable-pitch-mode" "term" 
> "dired" "compile" "bookmark-set" "lunar-phases" "bookmark-save" 
> "epa-list-keys" "2C-two-columns" "pdf-tools-help" ...))
>   smex()
>   funcall-interactively(smex)
>   call-interactively(smex nil nil)
>   command-execute(smex)

To narrow things down, can you try without smex? It's probably not the
issue, but it might simplify the backtrace.

David
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH] emacs: run notmuch-search-hook lazily

2021-09-12 Thread David Bremner
In message id:YT3ueuZHKW931NW3@localhost, Fabio Natali isolated a
visual glitch caused by running notmuch-search-hook too early. This
change moves the running of that hook to
notmuch-search-process-filter, which ensures there is some output in
the buffer before running the hook. Since n-s-p-f can be called many
times for a given buffer, add a buffer local flag to make sure it is
only run once per buffer.
---
 emacs/notmuch.el | 15 ---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 2ef67c0e..052f7578 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -880,6 +880,14 @@ sets the :orig-tag property."
   (setq notmuch-search-target-thread "found")
   (goto-char pos
 
+(defvar-local notmuch--search-hook-run nil
+  "Flag used to ensure the notmuch-search-hook is only run once per buffer")
+
+(defun notmuch--search-hook-wrapper ()
+  (unless notmuch--search-hook-run
+(setq notmuch--search-hook-run t)
+(run-hooks 'notmuch-search-hook)))
+
 (defun notmuch-search-process-filter (proc string)
   "Process and filter the output of \"notmuch search\"."
   (let ((results-buf (process-buffer proc))
@@ -892,7 +900,9 @@ sets the :orig-tag property."
  (goto-char (point-max))
  (insert string))
(notmuch-sexp-parse-partial-list 'notmuch-search-append-result
-results-buf)
+results-buf))
+  (with-current-buffer results-buf
+   (notmuch--search-hook-wrapper)
 
 ;;; Commands (and some helper functions used by them)
 
@@ -1036,8 +1046,7 @@ the configured default sort order."
  (process-put proc 'parse-buf
   (generate-new-buffer " *notmuch search parse*"))
  (set-process-filter proc 'notmuch-search-process-filter)
- (set-process-query-on-exit-flag proc nil
-(run-hooks 'notmuch-search-hook)))
+ (set-process-query-on-exit-flag proc nil))
 
 (defun notmuch-search-refresh-view ()
   "Refresh the current view.
-- 
2.33.0
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: T355-smime.sh is flaky

2021-09-11 Thread David Bremner
David Bremner  writes:
> After digging through mml-secure for a while, I realized that the
> problem is not actually in emacs, but in our test harness for gpgsm. I
> added the gpgsm -K to the script, and you can see that the
> test_su...@notmuchmail.org key is not being added.
>
> I think that means there is some kind of intermittent failure with the
> following pipeline
> 
> openssl pkcs12 -export -passout pass: -inkey 
> "$NOTMUCH_SRCDIR/test/smime/key+cert.pem" \
>   < "$NOTMUCH_SRCDIR/test/smime/test.crt" | \
>   gpgsm --batch --no-tty --no-common-certs-import 
> --pinentry-mode=loopback --passphrase-fd 3 \
> --disable-dirmngr --import  >"$GNUPGHOME"/import.log 2>&1 3<<<''
>

I wrote the output from openssl to a temporary file, and it appears that
sometimes (like the case I attached), this cannot be imported by "gpgsm
--import". It might be related to the existing bug report [1] from dkg.

One thing I noticed is that the debugging output has broken looking
offset in it.

gpgsm: 872 bytes of RC2 encrypted text
gpgsm: processing certBag
gpgsm: 1224 bytes of 3DES encrypted text
gpgsm: decryption failed; trying charset 'ISO-8859-1'
gpgsm: decryption failed; trying charset 'ISO-8859-15'
gpgsm: decryption failed; trying charset 'ISO-8859-2'
gpgsm: decryption failed; trying charset 'ISO-8859-3'
gpgsm: decryption failed; trying charset 'ISO-8859-4'
gpgsm: decryption failed; trying charset 'ISO-8859-5'
gpgsm: decryption failed; trying charset 'ISO-8859-6'
gpgsm: decryption failed; trying charset 'ISO-8859-7'
gpgsm: decryption failed; trying charset 'ISO-8859-8'
gpgsm: decryption failed; trying charset 'ISO-8859-9'
gpgsm: decryption failed; trying charset 'KOI8-R'
gpgsm: decryption failed; trying charset 'IBM437'
gpgsm: decryption failed; trying charset 'IBM850'
gpgsm: decryption failed; trying charset 'EUC-JP'
gpgsm: decryption failed; trying charset 'BIG5'
gpgsm: data error at "decrypted-text", offset 2646783990
gpgsm: error at "bag-sequence", offset 996
gpgsm: error parsing or decrypting the PKCS#12 file
gpgsm: total number processed: 1
gpgsm:   imported: 1


[1]: https://dev.gnupg.org/T4751



bad.p12
Description: application/pkcs12
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [Joerg Jaspert] Bug#922536: notmuch-emacs: notmuch breaks on directory removal

2021-09-11 Thread David Bremner
David Bremner  writes:

> Seems like reasonable complaint. It should be possible to change to the
> maildir root, but probably requires shelling out to notmuch config 
> get the value.

This should be fixed in commit 21e365f51
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [Bug] Cannot build python3 bindings documentation of notmuch 0.28.1

2021-09-11 Thread David Bremner
dan.cer...@posteo.net (Dan Čermák) writes:

> Hi list,
>
> the python3 bindings documentation seems to be broken:
>
> on OpenSUSE Tumbleweed and Fedora 29 (both have Python 3.7 and sphinx
> 1.7.6) I get this:

This should be fixed in commit 510dc8c8
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: emacs: Use of seq-some breaks 'nil' values in notmuch-fcc-dirs

2021-09-11 Thread David Bremner
Toke Høiland-Jørgensen  writes:

> Hi
>
> Commit 16b2db0986ce ("emacs: various cosmetic improvements") switched
> over notmuch-fcc-header-setup to use 'seq-some' to parse the
> notmuch-fcc-dirs variables. However, this seems to have broken the use
> of 'nil' values in the list. Specifically, I have notmuch-fcc-dirs set
> to something like:
>
> '(("toke@onemail.alias" . "alias1/Sent +sent -unread")
>   ("toke@another.alias" . nil)
>   (".*" . "Sent +sent -unread"))
>
> and since that update, I end up with "Sent +sent -unread" as the FCC
> value for emails I initiate from toke@another.alias.
>
> Any chance this could be fixed?

This should be fixed in commit b03b0d4e
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: Wrap process creating primitives with safe CWD

2021-09-11 Thread David Bremner
David Bremner  writes:

> This a bit more of a change than I was expecting, but there
> is nothing very tricky here (except getting the tests for exceptions in emacs 
> working took a bit of effort).
>
> I decided against trying to normalize the use of process-creating
> primitives (e.g. to all make-process or whatever) in this series, but
> that seems like it would be a reasonable project.

I have applied this series to master.

d
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


notmuch release 0.33.1 now available

2021-09-10 Thread David Bremner

Where to obtain notmuch 0.33.1
===
  https://notmuchmail.org/releases/notmuch-0.33.1.tar.xz

Which can be verified with:

  https://notmuchmail.org/releases/notmuch-0.33.1.tar.xz.sha256.asc
  -BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

2d905f03d9ee4abcd06dfae4c4d31e5fe623ed22b3ce4d9184cc0baed29b10d2  
notmuch-0.33.1.tar.xz
-BEGIN PGP SIGNATURE-

iQIzBAEBCAAdFiEEkiyHYXwaY0SiY6fqA0U5G1WqFSEFAmE7RAgACgkQA0U5G1Wq
FSFVjxAArdnZK4T39HIy6wQeek++y+MYOLKUJvVJkhsMgd+MHQBdzAwAP1qJ71s4
bzsWUHsD9U6+BUWSiN0r+EmJzGAmi1yVePvABQnW2XLA+ISS874ov9Dney2jrMPg
JVgGVSd5CHpCq2KwSqzNCK4saTzH3Ekjs/PLLXklvXNGUvfsE23lXCx+8x8Rqou9
nfEvAV7hQquURzyDOjV7WRqZ0vXHdJCr/YxdlJRQczws08MUza8vr2cy+mZDPkSm
JJnFIg+Ryp9zSUt/n+ml+Bg54EV2X8M9LhH9UdGKiDK2ccNZnEyUXseixXYyYYKY
czikHI1/Xd5Y6XXr61Yvn/6ibegGx14a+llP5uDGmX82kWvsSMELS5KR3LChxMrM
51rKH+pbtoBYuZWH4NZiKbYhF7XET3lTI8LUjUpyHvzhQxcj8G+z0XyWVygfNaef
NpmtBZ5vISi+qwi0NOXglCqD0gWuboiWfofuOoby6o1zoXOAddMpengLmAkJyhTA
76BfWQ9yYp9STr+TJEeBEpvOkHgfJwiTZomZk1dQeXXbTFOWqBhc5w20cabC0XUS
2i8KMBL8MXLuhTBJTLq2Rf3YcEC2Vz3tjxaDNg+K9QR2oynkFfHgdlOhXEDQw+4u
KomQYXxKdmHmcxh/6tEUrvvarqfiXi58UymLlrQZos0tVIndSUA=
=KPlE
-END PGP SIGNATURE-

  https://notmuchmail.org/releases/notmuch-0.33.1.tar.xz.asc
  (signed by David Bremner)

What's new in notmuch 0.33.1
=

General
---

Replace the fully-qualified-domain-name of the host with "localhost"
in the default email address.  This should fix two flaky subtests in
T590-libconfig.

What is notmuch
===
Notmuch is a system for indexing, searching, reading, and tagging
large collections of email messages in maildir or mh format. It uses
the Xapian library to provide fast, full-text search with a convenient
search syntax.

For more about notmuch, see https://notmuchmail.org



signature.asc
Description: PGP signature
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH] lib: use 'localhost' rather than fqdn for default mail address.

2021-09-09 Thread David Bremner
As discussed in the thread starting at [1], the fully qualified domain
name is a bit tricky to get reproducibly, might reveal information
people prefer to keep private, and somewhat unlikely to provide
reliable mail routing.

The new approach of $current_username@localhost is better for the
first two considerations, and probably at least as good as a test mail
address.

[1]: id:87sfyibqhj@tethera.net
---
 lib/config.cc  | 17 ++---
 test/T590-libconfig.sh | 10 --
 2 files changed, 6 insertions(+), 21 deletions(-)

diff --git a/lib/config.cc b/lib/config.cc
index 7ecc3c7b..408570bc 100644
--- a/lib/config.cc
+++ b/lib/config.cc
@@ -543,25 +543,12 @@ _get_username_from_passwd_file (void *ctx)
 static const char *
 _get_email_from_passwd_file (void *ctx)
 {
-
-char hostname[256];
-struct hostent *hostent;
-const char *domainname;
 char *email;
 
 char *username = _get_username_from_passwd_file (ctx);
 
-gethostname (hostname, 256);
-hostname[255] = '\0';
-
-hostent = gethostbyname (hostname);
-if (hostent && (domainname = strchr (hostent->h_name, '.')))
-   domainname += 1;
-else
-   domainname = "(none)";
-
-email = talloc_asprintf (ctx, "%s@%s.%s",
-username, hostname, domainname);
+email = talloc_asprintf (ctx, "%s@localhost",
+username);
 
 talloc_free (username);
 return email;
diff --git a/test/T590-libconfig.sh b/test/T590-libconfig.sh
index 41f67bae..59b82a6f 100755
--- a/test/T590-libconfig.sh
+++ b/test/T590-libconfig.sh
@@ -12,12 +12,10 @@ import os, sys, pwd, socket
 pw = pwd.getpwuid(os.getuid())
 user = pw.pw_name
 name = pw.pw_gecos.partition(",")[0]
-fqdn = socket.getaddrinfo(socket.gethostname(), 0, 0,
-  socket.SOCK_STREAM, 0, socket.AI_CANONNAME)[0][3]
+
 for l in sys.stdin:
 if l[:4] == "08: ":
-l = l.replace(user, "USERNAME", 1).replace("@" + fqdn, "@FQDN", 1)
-l = l.replace(".(none)", "", 1).replace(".localdomain", "", 1)
+l = l.replace(user, "USERNAME", 1)
 elif l[:4] == "10: ":
 l = l.replace("'" + name, "'USER_FULL_NAME", 1)
 sys.stdout.write(l)
@@ -416,7 +414,7 @@ cat <<'EOF' >EXPECTED
 05: 'unread;inbox'
 06: ''
 07: 'true'
-08: 'USERNAME@FQDN'
+08: 'USERNAME@localhost'
 09: 'NULL'
 10: 'USER_FULL_NAME'
 11: '8000'
@@ -761,7 +759,7 @@ cat <<'EOF' >EXPECTED
 05: 'unread;inbox'
 06: ''
 07: 'true'
-08: 'USERNAME@FQDN'
+08: 'USERNAME@localhost'
 09: 'NULL'
 10: 'USER_FULL_NAME'
 11: '8000'
-- 
2.30.2
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH v3 0/3] Allow functions in notmuch-*-result-format

2021-09-08 Thread David Bremner
David Edmondson  writes:

> As well as allowing headers to be specified in the various result
> format lists, allow functions that can be used to implement per-user
> logic when generating the results.

applied to master, along with my followup patch with tests.
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH] emacs: notmuch-fcc-header-setup: fix regression

2021-09-08 Thread David Bremner
Jonas Bernoulli  writes:

> With [1: 16b2db09] we lost the (undocumented) option to use no Fcc
> header only for From addresses matching a regexp.  This brings back
> that feature and documents it.
>
> 1: 2021-01-15 16b2db0986ce0ed7c420a69d0a98bb41e9ca4bd8
>emacs: various cosmetic improvements

applied to master.

d
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH] NEWS: typo fix; some trailing periods

2021-09-08 Thread David Bremner
Tomi Ollila  writes:

> The trailing periods to smaller diff between devel/news2wiki.pl
> output and what has been pushed to notmuch-wiki.

applied to master, thanks

d
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


27.1; defcustom for mail-user-agent is too strict?

2021-09-07 Thread David Bremner

The defcustom for mail-user-agent looks like

:type '(radio (function-item :tag "Message package"
   :format "%t\n"
   message-user-agent)
;; [...] snip   
(function-item :tag "Message with full Gnus features"
   :format "%t\n"
   gnus-user-agent)
(function :tag "Other"))

This means that a symbol without a function definition cannot be set
(using customize) as mail-user-agent. This seem inconsistent with the
docstring of define-mail-user-agent, 

SYMBOL can be any Lisp symbol.  Its function definition and/or
value as a variable do not matter for this usage; we use only certain
properties on its property list, to encode the rest of the arguments.

and with existing mail user agents such as message-user-agent and
gnus-user-agent which don't have function definitions.

As far as I know, this defcustom is still enforcing that the symbol is a
function in emacs 28.x.

In GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.24, cairo 
version 1.16.0)
 of 2021-03-27, modified by Debian built on x86-conova-01
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: Debian GNU/Linux 11 (bullseye)

Configured using:
 'configure --build x86_64-linux-gnu --prefix=/usr
 --sharedstatedir=/var/lib --libexecdir=/usr/lib
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --enable-libsystemd --with-pop=yes
 
--enable-locallisppath=/etc/emacs:/usr/local/share/emacs/27.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/27.1/site-lisp:/usr/share/emacs/site-lisp
 --with-sound=alsa --without-gconf --with-mailutils --build
 x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib
 --libexecdir=/usr/lib --localstatedir=/var/lib
 --infodir=/usr/share/info --mandir=/usr/share/man --enable-libsystemd
 --with-pop=yes
 
--enable-locallisppath=/etc/emacs:/usr/local/share/emacs/27.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/27.1/site-lisp:/usr/share/emacs/site-lisp
 --with-sound=alsa --without-gconf --with-mailutils --with-cairo
 --with-x=yes --with-x-toolkit=gtk3 --with-toolkit-scroll-bars
 'CFLAGS=-g -O2
 -ffile-prefix-map=/build/emacs-LlFm6W/emacs-27.1+1=. -fstack-protector-strong
 -Wformat -Werror=format-security -Wall' 'CPPFLAGS=-Wdate-time
 -D_FORTIFY_SOURCE=2' LDFLAGS=-Wl,-z,relro'

Configured features:
XPM JPEG TIFF GIF PNG RSVG CAIRO SOUND GPM DBUS GSETTINGS GLIB NOTIFY
INOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF
ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS LIBSYSTEMD
JSON PDUMPER LCMS2 GMP

Important settings:
  value of $LANG: en_CA.UTF-8
  locale-coding-system: utf-8-unix

Major mode: notmuch-show

Minor modes in effect:
  shell-dirtrack-mode: t
  tracking-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  line-number-mode: t
  visual-line-mode: t
  transient-mark-mode: t


Features:
(shadow sort company-oddmuse company-keywords company-etags etags
fileloop xref project company-gtags company-dabbrev-code company-dabbrev
company-files company-capf company-cmake company-xcode company-clang
company-semantic company-eclim company-template company-bbdb company
mail-extr emacsbug sendmail cursor-sensor smerge-mode diff mm-archive
shr-color org-clock org-duration view mule-util cal-china lunar solar
cal-dst cal-bahai cal-islam cal-hebrew holidays hol-loaddefs cal-iso
org-eldoc org-element avl-tree generator ol-eww eww mm-url url-queue
ol-rmail ol-mhe ol-irc ol-info ol-gnus nnir gnus-sum url url-proxy
url-privacy url-expand url-methods url-history shr url-cookie url-domsuf
url-util svg xml dom gnus-group gnus-undo gnus-start gnus-cloud nnimap
nnmail mail-source utf7 netrc nnoo gnus-spec gnus-int gnus-range
gnus-win gnus nnheader ol-docview doc-view jka-compr image-mode exif
ol-bibtex bibtex ol-bbdb ol-w3m face-remap org-agenda org-refile org
org-macro org-footnote org-pcomplete org-list org-faces org-entities
noutline outline org-version ob-dot ob-shell ob-emacs-lisp ob-python
python tramp-sh tramp tramp-loaddefs trampver tramp-integration files-x
tramp-compat shell pcomplete parse-time iso8601 ls-lisp ob ob-tangle
org-src ob-ref ob-lob ob-table ob-exp ob-comint comint ansi-color
ob-core ob-eval org-table org-keys org-loaddefs find-func edmacro kmacro
cl-extra notmuch notmuch-tree notmuch-jump notmuch-hello wid-edit
notmuch-show notmuch-print notmuch-crypto notmuch-mua notmuch-message
notmuch-draft notmuch-maildir-fcc notmuch-address notmuch-company
notmuch-parser notmuch-wash coolj notmuch-query goto-addr icalendar
diary-lib diary-loaddefs cal-menu calendar 

Re: Is default email address in notmuch setup / lib useful?

2021-09-06 Thread David Bremner
Tomi Ollila  writes:

>
> Agreed. I tried to look whether we could get rid of user.name and
> user.primary_email config values (and then emacs/other email clients
> would need to resolve that information elsewhere). I don't know if
> that can ever be done (or should), but the the current beaviour
> is flaky (and I agree potentially insecure).

Would that involve getting rid of notmuch-reply, or something else?

d
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [bug] Invalid function: notmuch-user-agent (was: notmuch release 0.33 now available)

2021-09-06 Thread David Bremner
Gregor Zattler  writes:

>
> Actually this is a bit above my lisp knowledge.  Do you
> think your explanation suffices for a bug report against emacs?
>

If no-one comes up with a counter-argument in the next few days, I will
submit one.
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [bug] Invalid function: notmuch-user-agent (was: notmuch release 0.33 now available)

2021-09-06 Thread David Bremner
Gregor Zattler  writes:

> Hi David, notmuch developers,
> * David Bremner  [2021-09-03; 13:29]:
>> Emacs
>> -
>>
>> `notmuch` no longer sets `mail-user-agent` on load. To restore the
>> previous behaviour of using notmuch to send mail by default, customize
>> `mail-user-agent` to `notmuch-user-agent`.
>
> While reading this news, I realized, that `mail-user-agent'
> is set to "message-user-agent" in my emacs instance.
>
> I therefore tried to change `mail-user-agent' via the customization
> interface (clicking the radio button "Other:" and providing
> "notmuch-user-agent" as value) but then I got an error
> message:
>
> custom-variable-mark-to-save: Saving mail-user-agent: Invalid function: 
> notmuch-user-agent
>

This seems like a bug in the defcustom for mail-user-agent (i.e. a bug
in emacs). 
I think you will find that

   (setq mail-user-agent 'notmuch-user-agent)

works. My reading of the documentation (and either my reading or the
docs could be wrong) is that the symbol for a mail-user-agent need not
be a function.  Quoting the docstring for define-mail-user-agent

SYMBOL can be any Lisp symbol.  Its function definition and/or
value as a variable do not matter for this usage; we use only certain
properties on its property list, to encode the rest of the arguments.

Other user agents, e.g. 'gnus-user-agent, 'message-user-agent, and
'sendmail-user-agent do not seem to have function definition. On the
other hand, it is a bit surprising that no-one noticed a problem with
"Other" mail-user-agent values before now.


___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Is default email address in notmuch setup / lib useful?

2021-09-05 Thread David Bremner


Currently notmuch tries to make a guess for a default email address
based on the "fully qualified hostname" of the host it is running
on. This is roughly equivalent to running "hostname -f". I have observed
two things

1) It's a bit flaky. There are various functions (gethostbyname,
getaddrinfo) that work in subtly different ways.  We've tried
three different setups in the test suite to test this, and none of them
work everywhere.

2) It doesn't seem that useful. The number of people running notmuch on
hosts that can (and want to) receive email seems pretty
small. Furthermore, it's not obvious we're going to get the right
name. For example on my laptop it returns "zancas.local", which is only
routable on my home LAN.

I could be wrong about 2, though.  If you actually find this to be a
useful feature, please reply to this thread.

If people agree it's generally not useful, I'd propose to replace it
with some simpler default like "localhost" [1], equally useful to for
testing, but simpler to implement and test.

[1]: required by at least RFC6761
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: v5 sexp query parser

2021-09-05 Thread David Bremner
David Bremner  writes:

>
> I don't plan on applying this for 0.33, but will probably go ahead and apply 
> something like this series to master soon after the 0.33 release. So now is 
> the time to bikeshed.
>

As promised, I have applied this series to master. I don't think it
should introduce bugs for those not using the new query parser, but it's
a moderate sized change (maybe 1000 lines of new code, and 1500 lines of
tests and docs), so one never knows.
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


notmuch release 0.33 now available

2021-09-03 Thread David Bremner
Where to obtain notmuch 0.33
===
  https://notmuchmail.org/releases/notmuch-0.33.tar.xz

Which can be verified with:

  https://notmuchmail.org/releases/notmuch-0.33.tar.xz.sha256.asc
  -BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

883e045b4bfa2c48c9a4671062a40603a7f6165724dd54618beeba100549d26c  
notmuch-0.33.tar.xz
-BEGIN PGP SIGNATURE-

iQIzBAEBCAAdFiEEkiyHYXwaY0SiY6fqA0U5G1WqFSEFAmEyhCkACgkQA0U5G1Wq
FSGmlRAAm85hcV4Vb+ca1769t1xzQVqmEVEypiZmdUmHcfdpuyt7cydgacEDgVlX
xYJi51QUA2xHrSOl3Z0Eh2Gs/HRnX06g6YxisptJzC1QHv2QQBUq9Lr9hNTGeeoX
huoWxRTT1SZjCKsIha/XZxrELhmkq/YaEl65CkFU5HxulXk3mXnd4Ho88e/0G1QJ
qsH6giF1Pjp+o/GJL3xipsk42BgTiWtyXLUPEe4RBJ+SfqkHN96iL7sP4YOT3fU1
yP9EfsM2+QQcvcuCToF2UiFzXH+BcK5LjW0DFk1fObcO+zqIZeowZ/VPQnYAMc2K
IOzRIDcnuY0zaO5nbeKmY1P+lGkmboId2xGgzGxPf4571nqNe4HPeHDpgVR9jobU
h9kxrby7bUAuZKETujAKmPj5FqqVsgwv1mU5RjppW5t9kdLvOK8zG+EmuYeEClnH
gBbYNEF070FMnwJ6fj/RShbH/dT/X2SMcz9RzSOW7hO3mMiA/3YokywVT13hj1hn
xqBChtPzZ7AsCSJAKLqrZ3e2MLMBUh87lsqZtOtAvap3cLrLOoGzuyeLFtQHqDKw
/vkPbSTO2MsZeG0x69BoC+ZlUg6jWKrDSHh/hFfn5W/3TZc3p6zG+blIPf0Kc71X
X7SQuDUd50F/56CPLXlItbO98C+/s5D6NFH2fKYnJ+hw/RffrEk=
=sj+o
-END PGP SIGNATURE-

  https://notmuchmail.org/releases/notmuch-0.33.tar.xz.asc
  (signed by David Bremner)

What's new in notmuch 0.33
=

Library
---

Correct documentatation about transactions.

Add a configurable automatic commit of transactions. See
`database.autocommit` in notmuch-config(1).

Document the algorithm used to find a database.

CLI
---

Define format version 5, which supports sorting the output of
notmuch-show.

Emacs
-

`notmuch` no longer sets `mail-user-agent` on load. To restore the
previous behaviour of using notmuch to send mail by default, customize
`mail-user-agent` to `notmuch-user-agent`.

`notmuch-company` now works in `org-msg`.

Improve the display of messages from long threads in unthreaded mode.

Prefer email addresses over User ID when showing valid signatures.

Define a new face `notmuch-jump-key`.

New commands in notmuch-tree view: `notmuch-tree-filter` and 
`notmuch-tree-filter-by-tag`.

Honour `notmuch-show-text/html-blocked-images` when using `w3m` to
render html.

Support toggling sort order in notmuch-tree mode.

Ruby


Memory management of allocated notmuch objects (database, messages,
etc...) is now done via the Ruby GC. This removes all constraints on
the order of object destruction.  Database close and destroy are
split, following an old library API change.

Vim
---

Respect excluded tags when showing a thread.

Documentation
-

Fix doc build for Sphinx 4.0.

Improve the markup and linking of the documentation.

What is notmuch
===
Notmuch is a system for indexing, searching, reading, and tagging
large collections of email messages in maildir or mh format. It uses
the Xapian library to provide fast, full-text search with a convenient
search syntax.

For more about notmuch, see https://notmuchmail.org



signature.asc
Description: PGP signature
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


  1   2   3   4   5   6   7   8   9   10   >