git-remote-notmuch v2

2024-09-08 Thread David Bremner


Apologies for the lack of subject. Still caffeine deficient this
morning...

David Bremner  writes:

> 7) This code makes heavier use of GLib than most notmuch code.  In
> particular there is extensive use of g_auto macros for memory
> management.  These could be replaced with more use of talloc, but that
> would require a few more low level utility routines to be written.

The other thing it makes me think is that GLib is arguably badly
re-inventing C++, so that's something to ponder. I don't know if argues
for just using C++, or for going the extra mile and using talloc.

> 8) Performance has been optimized for the case of few changes to the
> database since last git-push (analogous notmuch restore)

9) I replaced the shelling out to "git var" with interrogating the
notmuch configuration database. The behaviour is slightly different, in
particular GIT_COMMITTER_* environment variables are currently
ignored. Obeying those could be added fairly simply, I think. There are
probably other subtlties to how git constructs GIT_COMMITTER_IDENT; I'm
not sure if those are important.

10) I observed there are still a few relics of the "git-remote-nm" name
in the code.

11) I think this should eventually save and restore configuration
information and properties like dump / restore do. I don't see any
conceptual barrier to doing so, just more code.


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


[no subject]

2024-09-08 Thread David Bremner
This series obsoletes the series at

 id:20240828160710.866567-1-da...@tethera.net

As far as the points there,

0, 1 still hold.

3) There is now URL handling, in an upwardly compatible way from felipe's 
script and (I think) neomutt.

4) The error handling has improved, although arguably still leans a
bit too much on assert.

5, 6 still hold

7) This code makes heavier use of GLib than most notmuch code.  In
   particular there is extensive use of g_auto macros for memory
   management.  These could be replaced with more use of talloc, but that would 
require a few more low level utility routines to be written.

8) Performance has been optimized for the case of few changes to the database 
since last git-push (analogous notmuch restore)
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH v2 2/4] cli: start remote helper for git.

2024-09-08 Thread David Bremner
This is closely based on git-remote-nm (in ruby) by Felipe Contreras.
Initially just implement the commands 'capabilites' and 'list'.  This
isn't enough to do anything useful so start some unit tests. Testing
of URL passing will be done after clone (import command) support is
added.
---
 Makefile.local  |   7 +-
 git-remote-notmuch.c| 314 
 test/T860-git-remote.sh |  46 ++
 3 files changed, 366 insertions(+), 1 deletion(-)
 create mode 100644 git-remote-notmuch.c
 create mode 100755 test/T860-git-remote.sh

diff --git a/Makefile.local b/Makefile.local
index 7699c208..ffeb0d00 100644
--- a/Makefile.local
+++ b/Makefile.local
@@ -1,7 +1,8 @@
 # -*- makefile-gmake -*-
 
 .PHONY: all
-all: notmuch notmuch-shared build-man build-info ruby-bindings 
python-cffi-bindings notmuch-git nmbug
+all: notmuch notmuch-shared git-remote-notmuch \
+   build-man build-info ruby-bindings python-cffi-bindings notmuch-git 
nmbug
 ifeq ($(MAKECMDGOALS),)
 ifeq ($(shell cat .first-build-message 2>/dev/null),)
@NOTMUCH_FIRST_BUILD=1 $(MAKE) --no-print-directory all
@@ -274,6 +275,9 @@ notmuch: $(notmuch_client_modules) lib/libnotmuch.a 
util/libnotmuch_util.a parse
 notmuch-shared: $(notmuch_client_modules) lib/$(LINKER_NAME)
$(call quiet,$(FINAL_NOTMUCH_LINKER) $(CFLAGS)) 
$(notmuch_client_modules) $(FINAL_NOTMUCH_LDFLAGS) -o $@
 
+git-remote-notmuch: git-remote-notmuch.o status.o tag-util.o query-string.o
+   $(call quiet,$(FINAL_NOTMUCH_LINKER) $(CFLAGS)) $^ 
$(FINAL_NOTMUCH_LDFLAGS) -o $@
+
 .PHONY: install
 install: all install-man install-info
mkdir -p "$(DESTDIR)$(prefix)/bin/"
@@ -302,6 +306,7 @@ endif
 
 SRCS  := $(SRCS) $(notmuch_client_srcs)
 CLEAN := $(CLEAN) notmuch notmuch-shared $(notmuch_client_modules)
+CLEAN := $(CLEAN) git-remote-notmuch git-remote-notmuch.o
 CLEAN := $(CLEAN) version.stamp notmuch-*.tar.gz.tmp
 CLEAN := $(CLEAN) .deps
 
diff --git a/git-remote-notmuch.c b/git-remote-notmuch.c
new file mode 100644
index ..4afd198c
--- /dev/null
+++ b/git-remote-notmuch.c
@@ -0,0 +1,314 @@
+/* notmuch - Not much of an email program, (just index and search)
+ *
+ * Copyright © 2023 Felipe Contreras
+ * Copyright © 2024 David Bremner
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see https://www.gnu.org/licenses/ .
+ *
+ * Authors: Felipe Contreras
+ * David Bremner 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "notmuch-client.h"
+#include "path-util.h"
+#include "hex-escape.h"
+#include "string-util.h"
+#include "tag-util.h"
+
+#define ASSERT(x) assert ((x))
+
+/* File scope globals */
+const char *debug_flags = NULL;
+FILE *log_file = NULL;
+
+/* For use with getline. */
+char *buffer = NULL;
+size_t buffer_len = 0;
+
+static inline bool
+equal_lastmod (const char *uuid1, unsigned long counter1,
+  const char *uuid2, unsigned long counter2)
+{
+return (strcmp_null (uuid1, uuid2) == 0) && (counter1 == counter2);
+}
+
+/* Error handling */
+static void
+ensure (bool condition, const char *format, ...)
+{
+va_list va_args;
+
+if (! condition) {
+   va_start (va_args, format);
+   vfprintf (stderr, format, va_args);
+   va_end (va_args);
+   fprintf (stderr, "\n");
+   exit (EXIT_FAILURE);
+}
+}
+
+/* It is a (protocol) error to call this at/after EOF */
+static void
+buffer_line (FILE *stream)
+{
+ssize_t nread;
+
+nread = getline (&buffer, &buffer_len, stream);
+ensure (nread >= 0, "getline %s", strerror (errno));
+chomp_newline (buffer);
+}
+
+static GStrv
+tokenize_buffer ()
+{
+char *tok = buffer;
+size_t tok_len = 0;
+
+g_autoptr (GStrvBuilder) builder = g_strv_builder_new ();
+
+while ((tok = strtok_len (tok + tok_len, " \t\n", &tok_len))) {
+   g_strv_builder_take (builder, g_strndup (tok, tok_len));
+}
+
+return g_strv_builder_end (builder);
+}
+
+static void
+flog (const char *format, ...)
+{
+va_list va_args;
+
+if (log_file) {
+   va_start (va_args, format);
+   vfprintf (log_file, format, va_args);
+   fflush (log_file);
+   va_end (va_args);
+}
+}
+
+static const char *
+gmessage (GError *err)
+{
+if (err)
+   return err->message;
+  

[PATCH v2 4/4] cli/git-remote: add export command

2024-09-08 Thread David Bremner
This enables the push command, and the helper is now feature complete.
---
 git-remote-notmuch.c   | 136 +
 performance-test/M07-git-remote.sh |   4 +
 performance-test/T08-git-remote.sh |  41 +
 test/T860-git-remote.sh|  68 +++
 4 files changed, 249 insertions(+)

diff --git a/git-remote-notmuch.c b/git-remote-notmuch.c
index 39ba6bf3..de689474 100644
--- a/git-remote-notmuch.c
+++ b/git-remote-notmuch.c
@@ -280,6 +280,140 @@ cmd_import (notmuch_database_t *notmuch,
 store_lastmod (notmuch, nm_dir);
 }
 
+static GString *
+read_data ()
+{
+ssize_t nread;
+size_t bytes;
+size_t data_size;
+
+g_auto (GStrv) tokens = NULL;
+
+ASSERT ((nread = getline (&buffer, &buffer_len, stdin) != -1));
+
+tokens = tokenize_buffer ();
+
+str2ul (tokens[1], &data_size);
+
+buffer = realloc (buffer, data_size + 1);
+bytes = fread (buffer, 1, data_size, stdin);
+ASSERT (bytes == data_size);
+
+buffer_len = data_size;
+
+return g_string_new_len (buffer, buffer_len);
+}
+
+static void
+free_string (GString *str)
+{
+g_string_free (str, true);
+}
+
+static void
+cmd_export (notmuch_database_t *notmuch, const char *nm_dir)
+{
+ssize_t nread;
+
+g_autoptr (GHashTable) blobs = NULL;
+
+ASSERT (blobs = g_hash_table_new_full ((GHashFunc) g_str_hash,
+  (GEqualFunc) g_str_equal,
+  g_free, (GDestroyNotify) free_string)
+   );
+
+while ((nread = getline (&buffer, &buffer_len, stdin)) != -1) {
+   flog ("\texport %s\n", buffer);
+   if (STRNCMP_LITERAL (buffer, "done") == 0) {
+   break;
+   } else if (STRNCMP_LITERAL (buffer, "blob") == 0) {
+   GString *data;
+   g_auto (GStrv) tokens = NULL;
+
+
+   flog ("export blob\n");
+   buffer_line (stdin);
+
+   tokens = tokenize_buffer ();
+
+   data = read_data ();
+
+   flog ("\tmark%s\n", tokens[1]);
+   g_hash_table_insert (blobs, g_strdup (tokens[1]), data);
+   buffer_line (stdin);
+   } else if (STRNCMP_LITERAL (buffer, "commit") == 0) {
+   char *mid = NULL;
+   size_t mid_len = 0;
+
+   flog ("export commit\n");
+
+   /* mark for commit (ignored) */
+   buffer_line (stdin);
+   /* author (ignored) */
+   buffer_line (stdin);
+   /* committer (ignored) */
+   buffer_line (stdin);
+
+   /* commit message (ignored) */
+   (void) read_data ();
+
+   while (strlen (buffer) > 0) {
+   g_autoptr (GString) mark = NULL;
+   g_autoptr (GString) path = NULL;
+   const GString *blob;
+   g_autofree char *basename = NULL;
+   notmuch_message_t *message;
+   const char *tok;
+   size_t tok_len;
+   size_t max_tok_len;
+   tag_op_list_t *tag_ops;
+   g_auto (GStrv) tokens = NULL;
+
+   buffer_line (stdin);
+   if (strlen (buffer) == 0)
+   break;
+
+   tokens = tokenize_buffer ();
+   flog ("looking for blob |%s|\n", tokens[2]);
+   ASSERT (blob = g_hash_table_lookup (blobs, tokens[2]));
+
+   basename = g_path_get_dirname (tokens[3] + 6);
+   ASSERT (HEX_SUCCESS ==
+   hex_decode (notmuch, basename, &mid, &mid_len));
+   ASSERT (NOTMUCH_STATUS_SUCCESS ==
+   notmuch_database_find_message (notmuch, mid, &message));
+   ASSERT (message);
+
+   ASSERT (NOTMUCH_STATUS_SUCCESS ==
+   notmuch_message_freeze (message));
+
+   tag_ops = tag_op_list_create (message);
+   tok = blob->str;
+   max_tok_len = blob->len;
+   tok_len = 0;
+   while ((tok_len < max_tok_len) &&
+  (tok = strsplit_len (tok + tok_len, '\n', &tok_len)) != 
NULL) {
+   const char *tag = talloc_strndup (message, tok, tok_len);
+   ASSERT (0 == tag_op_list_append (tag_ops, tag, false));
+   }
+
+   ASSERT (NOTMUCH_STATUS_SUCCESS ==
+   tag_op_list_apply (message, tag_ops, 
TAG_FLAG_REMOVE_ALL));
+
+   ASSERT (NOTMUCH_STATUS_SUCCESS ==
+   notmuch_message_thaw (message));
+
+   notmuch_message_destroy (message);
+   }
+   puts ("ok refs/heads/master");
+   }
+
+}
+store_lastmod (notmuch, nm_dir);
+puts ("");
+}
+
+
 /* stubs since we cannot link with notmuch.o */
 const notmuch_opt_desc_t notmuch_shared_options[] = {
 { }
@@ -408,6 +542,8 @@ main (int argc, char *argv[])
 
if (STRNCMP_LITERAL (s, "capabilities") == 0)
cmd_capabilities ();
+   else if (STRN

[PATCH v2 3/4] cli/git-remote: add import command

2024-09-08 Thread David Bremner
The output in default.import is based on a modified version
of Felipe's git-remote-nm with Blake2 hashing replaced by SHA1
(for portability). This enable fetch/pull/clone, so test that as well.
---
 git-remote-notmuch.c  | 108 +
 performance-test/M07-git-remote.sh|  16 ++
 performance-test/T08-git-remote.sh|  12 +
 test/T860-git-remote.sh   |  69 ++
 .../git-remote.expected-output/default.import | 229 ++
 5 files changed, 434 insertions(+)
 create mode 100755 performance-test/M07-git-remote.sh
 create mode 100755 performance-test/T08-git-remote.sh
 create mode 100644 test/git-remote.expected-output/default.import

diff --git a/git-remote-notmuch.c b/git-remote-notmuch.c
index 4afd198c..39ba6bf3 100644
--- a/git-remote-notmuch.c
+++ b/git-remote-notmuch.c
@@ -155,6 +155,30 @@ read_lastmod (const char *dir, char **uuid_out, unsigned 
long *counter_out)
 
 }
 
+static void
+store_lastmod (notmuch_database_t *notmuch, const char *dir)
+{
+char *filename = NULL;
+FILE *out;
+unsigned long lastmod;
+const char *uuid;
+
+ASSERT (filename = talloc_asprintf (notmuch, "%s/lastmod", dir));
+
+out = fopen (filename, "w");
+ensure (out, "error opening %s for writing: %s", filename, strerror 
(errno));
+
+lastmod = notmuch_database_get_revision (notmuch, &uuid);
+ASSERT (fprintf (out, "%s\t%zu\n", uuid, lastmod) > 0);
+}
+
+static void
+write_data (const char *data)
+{
+printf ("data %zu\n", strlen (data));
+fputs (data, stdout);
+}
+
 static void
 cmd_capabilities ()
 {
@@ -174,6 +198,88 @@ cmd_list (notmuch_database_t *db, const char *uuid, 
unsigned long lastmod)
equal_lastmod (uuid, lastmod, db_uuid, db_lastmod) ? " unchanged" : 
"");
 }
 
+static void
+cmd_import (notmuch_database_t *notmuch,
+   const char *nm_dir,
+   const char *uuid,
+   unsigned long lastmod)
+{
+const char *ident = NULL;
+const char *lastmod_str = NULL;
+notmuch_messages_t *messages;
+notmuch_status_t status;
+notmuch_query_t *query;
+char *mid_buf = NULL;
+size_t mid_buf_len = 0;
+
+ident = talloc_asprintf (notmuch, "%s <%s> %zu +",
+notmuch_config_get (notmuch, 
NOTMUCH_CONFIG_USER_NAME),
+notmuch_config_get (notmuch, 
NOTMUCH_CONFIG_PRIMARY_EMAIL),
+time (NULL));
+
+
+printf ("feature done\ncommit refs/notmuch/master\nmark :1\ncommitter 
%s\n", ident);
+
+ASSERT (lastmod_str = talloc_asprintf (notmuch, "lastmod: %zu\n", 
lastmod));
+write_data (lastmod_str);
+if (uuid)
+   puts ("from refs/notmuch/master^0");
+puts ("deleteall");
+
+status = notmuch_query_create_with_syntax (notmuch,
+  "",
+  NOTMUCH_QUERY_SYNTAX_XAPIAN,
+  &query);
+
+if (print_status_database ("git-remote-nm", notmuch, status))
+   exit (EXIT_FAILURE);
+
+if (debug_flags && strchr (debug_flags, 's'))
+   notmuch_query_set_sort (query, NOTMUCH_SORT_NEWEST_FIRST);
+else
+   notmuch_query_set_sort (query, NOTMUCH_SORT_UNSORTED);
+
+status = notmuch_query_search_messages (query, &messages);
+if (print_status_query ("git-remote-nm", query, status))
+   exit (EXIT_FAILURE);
+
+for (;
+notmuch_messages_valid (messages);
+notmuch_messages_move_to_next (messages)) {
+   const char *tag_buf = "";
+   const char *mid;
+   const char *hash;
+   int ret;
+
+   notmuch_message_t *message = notmuch_messages_get (messages);
+   mid = notmuch_message_get_message_id (message);
+
+   ret = hex_encode (notmuch, mid, &mid_buf, &mid_buf_len);
+   ensure (ret == HEX_SUCCESS, "failed to hex-encode message-id %s\n", 
mid);
+
+   /* we can't use _notmuch_sha1_from_string because we don't want
+* to include the null terminator */
+   g_autoptr (GChecksum) sha1 = NULL;
+   sha1 = g_checksum_new (G_CHECKSUM_SHA1);
+   g_checksum_update (sha1, (const guchar *) mid, strlen (mid));
+   hash = g_checksum_get_string (sha1);
+   printf ("M 644 inline %2.2s/%2.2s/%s/tags\n", hash, hash + 2, mid_buf);
+
+   for (notmuch_tags_t *tags = notmuch_message_get_tags (message);
+notmuch_tags_valid (tags);
+notmuch_tags_move_to_next (tags)) {
+   const char *tag_str = notmuch_tags_get (tags);
+   ASSERT (tag_buf = talloc_asprintf (message, "%s%s\n", tag_buf, 
tag_str));
+   }
+   write_data (tag_buf);
+   notmuch_message_destroy (message);
+}
+puts ("");
+puts ("done");
+fflush (stdout);
+store_lastmod (notmuch, nm_dir);
+}
+
 /* stubs since we cannot link with notmuch.o */
 const notmuch_opt_desc_t notmuch_shared_options[] = {
 { }
@@ -302,6 +408,8 @@ main (int argc, cha

[PATCH v2 1/4] util: refactor sync_dir and mkdir_recursive

2024-09-08 Thread David Bremner
Moving these functions to libnotmuch_util will allow re-user from
either multiple CLI compilation units or from the library. To avoid
future surprises, replace printing to stderr with the usual status
string mechanism.
---
 notmuch-insert.c | 84 +
 util/path-util.c | 97 +++-
 util/path-util.h |  8 
 3 files changed, 114 insertions(+), 75 deletions(-)

diff --git a/notmuch-insert.c b/notmuch-insert.c
index e44607ad..66c4f434 100644
--- a/notmuch-insert.c
+++ b/notmuch-insert.c
@@ -21,13 +21,13 @@
  * Author: Peter Wang 
  */
 
-#include "notmuch-client.h"
-#include "tag-util.h"
 
-#include 
-#include 
 #include 
+
+#include "notmuch-client.h"
+#include "tag-util.h"
 #include "string-util.h"
+#include "path-util.h"
 
 static volatile sig_atomic_t interrupted;
 
@@ -64,26 +64,6 @@ safe_gethostname (char *hostname, size_t len)
 }
 }
 
-/* Call fsync() on a directory path. */
-static bool
-sync_dir (const char *dir)
-{
-int fd, r;
-
-fd = open (dir, O_RDONLY);
-if (fd == -1) {
-   fprintf (stderr, "Error: open %s: %s\n", dir, strerror (errno));
-   return false;
-}
-
-r = fsync (fd);
-if (r)
-   fprintf (stderr, "Error: fsync %s: %s\n", dir, strerror (errno));
-
-close (fd);
-
-return r == 0;
-}
 
 /*
  * Check the specified folder name does not contain a directory
@@ -105,54 +85,6 @@ is_valid_folder_name (const char *folder)
 }
 }
 
-/*
- * Make the given directory and its parents as necessary, using the
- * given mode. Return true on success, false otherwise. Partial
- * results are not cleaned up on errors.
- */
-static bool
-mkdir_recursive (const void *ctx, const char *path, int mode)
-{
-struct stat st;
-int r;
-char *parent = NULL, *slash;
-
-/* First check the common case: directory already exists. */
-r = stat (path, &st);
-if (r == 0) {
-   if (! S_ISDIR (st.st_mode)) {
-   fprintf (stderr, "Error: '%s' is not a directory: %s\n",
-path, strerror (EEXIST));
-   return false;
-   }
-
-   return true;
-} else if (errno != ENOENT) {
-   fprintf (stderr, "Error: stat '%s': %s\n", path, strerror (errno));
-   return false;
-}
-
-/* mkdir parents, if any */
-slash = strrchr (path, '/');
-if (slash && slash != path) {
-   parent = talloc_strndup (ctx, path, slash - path);
-   if (! parent) {
-   fprintf (stderr, "Error: %s\n", strerror (ENOMEM));
-   return false;
-   }
-
-   if (! mkdir_recursive (ctx, parent, mode))
-   return false;
-}
-
-if (mkdir (path, mode)) {
-   fprintf (stderr, "Error: mkdir '%s': %s\n", path, strerror (errno));
-   return false;
-}
-
-return parent ? sync_dir (parent) : true;
-}
-
 /*
  * Create the given maildir folder, i.e. maildir and its
  * subdirectories cur/new/tmp. Return true on success, false
@@ -165,6 +97,7 @@ maildir_create_folder (const void *ctx, const char *maildir, 
bool world_readable
 const int mode = (world_readable ? 0755 : 0700);
 char *subdir;
 unsigned int i;
+char **status_string = NULL;
 
 for (i = 0; i < ARRAY_SIZE (subdirs); i++) {
subdir = talloc_asprintf (ctx, "%s/%s", maildir, subdirs[i]);
@@ -173,7 +106,7 @@ maildir_create_folder (const void *ctx, const char 
*maildir, bool world_readable
return false;
}
 
-   if (! mkdir_recursive (ctx, subdir, mode))
+   if (mkdir_recursive (ctx, subdir, mode, status_string))
return false;
 }
 
@@ -347,6 +280,7 @@ static char *
 maildir_write_new (const void *ctx, int fdin, const char *maildir, bool 
world_readable)
 {
 char *cleanpath, *tmppath, *newpath, *newdir;
+char *status_string = NULL;
 
 tmppath = maildir_write_tmp (ctx, fdin, maildir, world_readable);
 if (! tmppath)
@@ -375,13 +309,15 @@ maildir_write_new (const void *ctx, int fdin, const char 
*maildir, bool world_re
goto FAIL;
 }
 
-if (! sync_dir (newdir))
+if (sync_dir (newdir, &status_string))
goto FAIL;
 
 return newpath;
 
   FAIL:
 unlink (cleanpath);
+if (status_string)
+   fputs (status_string, stderr);
 
 return NULL;
 }
diff --git a/util/path-util.c b/util/path-util.c
index 3267a967..5511c09b 100644
--- a/util/path-util.c
+++ b/util/path-util.c
@@ -5,10 +5,17 @@
 #define _GNU_SOURCE
 
 #include "path-util.h"
-
+#include "compat.h"
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
 #include 
 #include 
 
+#include 
 
 char *
 notmuch_canonicalize_file_name (const char *path)
@@ -25,3 +32,91 @@ notmuch_canonicalize_file_name (const char *path)
 #error undefined PATH_MAX _and_ missing canonicalize_file_name not supported
 #endif
 }
+
+/* Call fsync() on a directory path. */
+notmuch_status_t
+sync_dir (const char *dir, char **status_string)
+{
+int fd, r;
+
+fd = open (dir, O_RDONLY);
+i

Re: Is it possible to search HTML contents of messages

2024-09-02 Thread David Bremner
Mohsin Kaleem  writes:

> David Bremner  writes:
>
>> Our strategy for indexing html hasn't changed much since the
>> beginning. We just remove all tags using a simple state
>> machine. Unfortunately the term you want to search for is an attribute
>> of an href tag. Offhand I can't think of a simple improvement that would
>> help.
>
> I see, would it be possible to search the properties of a message
> instead? Like the headers for example. Received from some .ru domain or
> something similar to that.
>

You can search any header if you index it first. See notmuch-config(1)
for how to configure extra headers. Received seems like the most likely
to have what you want. I'm curious how much it bloats the database, but
I guess compared to all of the attachments people send these days it
probably is not that bad.

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


[PATCH] lib: move call to _n_m_invalidate_metadata

2024-09-01 Thread David Bremner
It is wrong most of the time in _notmuch_message_remove_terms, but
that function is too low level to know how to call
_n_m_invalidate_metadata with the right argument, at least not without
more extensive changes. This change merely makes the current behaviour
more obvious, since the other calls cannot have relied on metadata
being invalidated.
---
 lib/message-property.cc | 1 +
 lib/message.cc  | 2 --
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/lib/message-property.cc b/lib/message-property.cc
index 7f520340..772437eb 100644
--- a/lib/message-property.cc
+++ b/lib/message-property.cc
@@ -151,6 +151,7 @@ _notmuch_message_remove_all_properties (notmuch_message_t 
*message, const char *
 try {
/* XXX better error reporting ? */
_notmuch_message_remove_terms (message, term_prefix);
+   _notmuch_message_invalidate_metadata (message, "property");
 } catch (Xapian::Error &error) {
LOG_XAPIAN_EXCEPTION (message, error);
return NOTMUCH_STATUS_XAPIAN_EXCEPTION;
diff --git a/lib/message.cc b/lib/message.cc
index 46638f80..94e1bb12 100644
--- a/lib/message.cc
+++ b/lib/message.cc
@@ -719,8 +719,6 @@ _notmuch_message_remove_terms (notmuch_message_t *message, 
const char *prefix)
/* Ignore failure to remove non-existent term. */
}
 }
-
-_notmuch_message_invalidate_metadata (message, "property");
 }
 
 
-- 
2.43.0

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


Re: WIP: git-remote-notmuch

2024-08-28 Thread David Bremner
David Bremner  writes:

> 3) The original script took a path to mail_root, but this doesn't
> really cover the possible split configurations; in particular it
> doesn't handle my (XDG) layout. The current code just looks for the
> "default" notmuch setup, and ignores the URL.  I am open to ideas for
> how a notmuch URL should look like. I'd imagine they should have the
> profile in them, but I'm not sure how much flexibility we need / want
> to suppot.

I guess some kind of key value scheme like

  notmuch://?profile=foo
  notmuch::?profile=foo
  
or

  notmuch://?config=.bar?database=fub/zub

would work, basically a thin wrapper around
notmuch_database_open_with_config.

There is still room for bikeshedding about the syntax.  We could throw
in "localhost" for future-proofing,

notmuch://localhost

would pass NULL to all 3 relevant parameters of n_d_o_w_c
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH 5/5] cli/git-remote: add time performance test

2024-08-28 Thread David Bremner
Memory tests already existed (for correctness) but this helps sanity
check the performance to make sure we are in the same range as the
existing notmuch-git script.
---
 performance-test/T08-git-remote.sh | 23 +++
 1 file changed, 23 insertions(+)
 create mode 100755 performance-test/T08-git-remote.sh

diff --git a/performance-test/T08-git-remote.sh 
b/performance-test/T08-git-remote.sh
new file mode 100755
index ..799e221b
--- /dev/null
+++ b/performance-test/T08-git-remote.sh
@@ -0,0 +1,23 @@
+#!/usr/bin/env bash
+
+test_description='git-remote-notmuch'
+
+. $(dirname "$0")/perf-test-lib.sh || exit 1
+
+export GIT_COMMITTER_NAME="Notmuch Test Suite"
+export GIT_COMMITTER_EMAIL="notm...@example.com"
+
+time_start
+
+time_run 'clone --bare' "git clone --quiet --bare notmuch::default default.git"
+time_run 'clone' "git clone --quiet notmuch::default"
+
+cd default
+hash=$(git hash-object --stdin -w < /dev/null)
+# replace all files with empty files
+git ls-tree -r HEAD | sed "s/blob [^\t]*/blob $hash/" | git update-index 
--index-info
+git commit -m'zero tags' 2>>log.txt 1>&2
+
+time_run "push" "git push --quiet origin master"
+
+time_done
-- 
2.43.0

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


[PATCH 1/5] util: refactor sync_dir and mkdir_recursive

2024-08-28 Thread David Bremner
Moving these functions to libnotmuch_util will allow re-user from
either multiple CLI compilation units or from the library. To avoid
future surprises, replace printing to stderr with the usual status
string mechanism.
---
 notmuch-insert.c | 84 +
 util/path-util.c | 97 +++-
 util/path-util.h |  8 
 3 files changed, 114 insertions(+), 75 deletions(-)

diff --git a/notmuch-insert.c b/notmuch-insert.c
index e44607ad..66c4f434 100644
--- a/notmuch-insert.c
+++ b/notmuch-insert.c
@@ -21,13 +21,13 @@
  * Author: Peter Wang 
  */
 
-#include "notmuch-client.h"
-#include "tag-util.h"
 
-#include 
-#include 
 #include 
+
+#include "notmuch-client.h"
+#include "tag-util.h"
 #include "string-util.h"
+#include "path-util.h"
 
 static volatile sig_atomic_t interrupted;
 
@@ -64,26 +64,6 @@ safe_gethostname (char *hostname, size_t len)
 }
 }
 
-/* Call fsync() on a directory path. */
-static bool
-sync_dir (const char *dir)
-{
-int fd, r;
-
-fd = open (dir, O_RDONLY);
-if (fd == -1) {
-   fprintf (stderr, "Error: open %s: %s\n", dir, strerror (errno));
-   return false;
-}
-
-r = fsync (fd);
-if (r)
-   fprintf (stderr, "Error: fsync %s: %s\n", dir, strerror (errno));
-
-close (fd);
-
-return r == 0;
-}
 
 /*
  * Check the specified folder name does not contain a directory
@@ -105,54 +85,6 @@ is_valid_folder_name (const char *folder)
 }
 }
 
-/*
- * Make the given directory and its parents as necessary, using the
- * given mode. Return true on success, false otherwise. Partial
- * results are not cleaned up on errors.
- */
-static bool
-mkdir_recursive (const void *ctx, const char *path, int mode)
-{
-struct stat st;
-int r;
-char *parent = NULL, *slash;
-
-/* First check the common case: directory already exists. */
-r = stat (path, &st);
-if (r == 0) {
-   if (! S_ISDIR (st.st_mode)) {
-   fprintf (stderr, "Error: '%s' is not a directory: %s\n",
-path, strerror (EEXIST));
-   return false;
-   }
-
-   return true;
-} else if (errno != ENOENT) {
-   fprintf (stderr, "Error: stat '%s': %s\n", path, strerror (errno));
-   return false;
-}
-
-/* mkdir parents, if any */
-slash = strrchr (path, '/');
-if (slash && slash != path) {
-   parent = talloc_strndup (ctx, path, slash - path);
-   if (! parent) {
-   fprintf (stderr, "Error: %s\n", strerror (ENOMEM));
-   return false;
-   }
-
-   if (! mkdir_recursive (ctx, parent, mode))
-   return false;
-}
-
-if (mkdir (path, mode)) {
-   fprintf (stderr, "Error: mkdir '%s': %s\n", path, strerror (errno));
-   return false;
-}
-
-return parent ? sync_dir (parent) : true;
-}
-
 /*
  * Create the given maildir folder, i.e. maildir and its
  * subdirectories cur/new/tmp. Return true on success, false
@@ -165,6 +97,7 @@ maildir_create_folder (const void *ctx, const char *maildir, 
bool world_readable
 const int mode = (world_readable ? 0755 : 0700);
 char *subdir;
 unsigned int i;
+char **status_string = NULL;
 
 for (i = 0; i < ARRAY_SIZE (subdirs); i++) {
subdir = talloc_asprintf (ctx, "%s/%s", maildir, subdirs[i]);
@@ -173,7 +106,7 @@ maildir_create_folder (const void *ctx, const char 
*maildir, bool world_readable
return false;
}
 
-   if (! mkdir_recursive (ctx, subdir, mode))
+   if (mkdir_recursive (ctx, subdir, mode, status_string))
return false;
 }
 
@@ -347,6 +280,7 @@ static char *
 maildir_write_new (const void *ctx, int fdin, const char *maildir, bool 
world_readable)
 {
 char *cleanpath, *tmppath, *newpath, *newdir;
+char *status_string = NULL;
 
 tmppath = maildir_write_tmp (ctx, fdin, maildir, world_readable);
 if (! tmppath)
@@ -375,13 +309,15 @@ maildir_write_new (const void *ctx, int fdin, const char 
*maildir, bool world_re
goto FAIL;
 }
 
-if (! sync_dir (newdir))
+if (sync_dir (newdir, &status_string))
goto FAIL;
 
 return newpath;
 
   FAIL:
 unlink (cleanpath);
+if (status_string)
+   fputs (status_string, stderr);
 
 return NULL;
 }
diff --git a/util/path-util.c b/util/path-util.c
index 3267a967..b7114b18 100644
--- a/util/path-util.c
+++ b/util/path-util.c
@@ -5,10 +5,17 @@
 #define _GNU_SOURCE
 
 #include "path-util.h"
-
+#include "compat.h"
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
 #include 
 #include 
 
+#include 
 
 char *
 notmuch_canonicalize_file_name (const char *path)
@@ -25,3 +32,91 @@ notmuch_canonicalize_file_name (const char *path)
 #error undefined PATH_MAX _and_ missing canonicalize_file_name not supported
 #endif
 }
+
+/* Call fsync() on a directory path. */
+notmuch_status_t 
+sync_dir (const char *dir, char **status_string)
+{
+int fd, r;
+
+fd = open (dir, O_RDONLY);
+

[PATCH 4/5] cli/git-remote: add export command

2024-08-28 Thread David Bremner
This enables the push command, and the helper is now feature complete.
---
 git-remote-notmuch.c| 157 
 test/T860-git-remote.sh |  69 ++
 test/make-export.py |  44 +++
 3 files changed, 270 insertions(+)
 create mode 100644 test/make-export.py

diff --git a/git-remote-notmuch.c b/git-remote-notmuch.c
index a4ed98e2..35579004 100644
--- a/git-remote-notmuch.c
+++ b/git-remote-notmuch.c
@@ -224,6 +224,161 @@ cmd_import (notmuch_database_t *notmuch) {
 store_lastmod(notmuch, nm_dir);
 }
 
+static GString *
+get_tok (const char *line, size_t index) {
+
+const char *tok = line;
+size_t tok_len =0;
+
+for (size_t count = 0; count<=index; count++) {
+   ASSERT(tok = strsplit_len (tok+tok_len, ' ', &tok_len));
+}
+
+return g_string_new_len (tok, tok_len);
+}
+
+static GString *
+read_data (char **line_p, size_t *len_p) {
+ssize_t nread;
+size_t bytes;
+size_t data_size;
+const char *tok;
+size_t tok_len =0;
+
+ASSERT (line_p);
+ASSERT (len_p);
+ASSERT((nread = getline(line_p, len_p, stdin) != -1));
+
+tok=*line_p;
+for (size_t count = 0; count<=1; count++) {
+   ASSERT(tok = strsplit_len (tok+tok_len, ' ', &tok_len));
+}
+
+/* TODO: don't ignore tok_len */
+ASSERT(sscanf (tok, "%zu", &data_size) == 1);
+
+*line_p = realloc (*line_p, data_size+1);
+bytes = fread (*line_p, 1, data_size, stdin);
+ASSERT (bytes == data_size);
+
+*len_p = data_size;
+
+return g_string_new_len (*line_p, *len_p);
+}
+
+static void free_string (GString *str) {
+g_string_free (str, true);
+}
+
+static void
+cmd_export (notmuch_database_t *notmuch)
+{
+  ssize_t nread;
+  size_t len = 0;
+  char *line = NULL;
+  GHashTable* blobs;
+
+  ASSERT(blobs = g_hash_table_new_full ((GHashFunc)g_string_hash,
+   (GEqualFunc)g_string_equal,
+   (GDestroyNotify)free_string, 
(GDestroyNotify)free_string));
+
+  while ((nread = getline(&line, &len, stdin)) != -1) {
+  flog ("\texport %s\n", line);
+  if (STRNCMP_LITERAL (line, "done") == 0) {
+ break;
+  }
+  else if (STRNCMP_LITERAL (line, "blob") == 0) {
+ GString *mark;
+ GString *data;
+
+ flog ("export blob\n");
+ read_one_line (stdin, &line, &len);
+ mark = get_tok (line, 1);
+
+ data = read_data (&line, &len);
+
+ g_hash_table_insert (blobs, mark, data);
+ read_one_line (stdin, &line, &len);
+ /* TODO free things */
+  }
+
+  else if (STRNCMP_LITERAL (line, "commit") == 0) {
+ char *mid = NULL;
+ size_t mid_len = 0;
+
+ flog ("export commit\n");
+
+ /* mark for commit (ignored) */
+ read_one_line (stdin, &line, &len);
+ /* author (ignored) */
+ read_one_line (stdin, &line, &len);
+ /* committer (ignored) */
+ read_one_line (stdin, &line, &len);
+
+ /* commit message (ignored) */
+ (void)read_data (&line, &len);
+
+ while (strlen (line) > 0) {
+ GString *mark, *path;
+ GBytes *blob;
+ char *basename;
+ notmuch_message_t *message;
+ char *tag;
+ const char *tok;
+ size_t tok_len;
+ size_t max_tok_len;
+
+ read_one_line (stdin, &line, &len);
+ if (strlen (line) ==0)
+ break;
+
+ ASSERT(mark = get_tok (line, 2));
+ ASSERT(blob = g_hash_table_lookup (blobs, mark));
+ free_string (mark);
+
+ ASSERT(path = get_tok (line, 3));
+
+ basename = g_path_get_dirname (path->str+6);
+ ASSERT(HEX_SUCCESS ==
+hex_decode (notmuch, basename, &mid, &mid_len));
+ g_free (basename);
+ free_string (path);
+
+ ASSERT(NOTMUCH_STATUS_SUCCESS ==
+notmuch_database_find_message (notmuch, mid, &message));
+ ASSERT(message);
+
+
+ ASSERT(NOTMUCH_STATUS_SUCCESS ==
+notmuch_message_freeze (message));
+
+ ASSERT(NOTMUCH_STATUS_SUCCESS ==
+notmuch_message_remove_all_tags (message));
+
+ tok = g_bytes_get_data (blob, &max_tok_len);
+ tok_len = 0;
+ while ((tok_len < max_tok_len) &&
+(tok = strsplit_len (tok + tok_len, '\n', &tok_len)) != 
NULL) {
+ tag = strndup (tok, tok_len);
+ ASSERT(NOTMUCH_STATUS_SUCCESS ==
+notmuch_message_add_tag (message, tag));
+ free (tag);
+ }
+
+ ASSERT(NOTMUCH_STATUS_SUCCESS ==
+notmuch_message_thaw (message));
+
+ notmuch_message_destroy (message);
+ }
+ puts("ok refs/heads/master");
+  }
+
+  }
+  store_la

[PATCH 2/5] cli: start remote helper for git.

2024-08-28 Thread David Bremner
This is closely based on git-remote-nm (in ruby) by Felipe Contreras.
Initially just implement the commands 'capabilites' and 'list'.  This
isn't enough to do anything useful so start some unit tests.
---
 Makefile.local  |   7 +-
 git-remote-notmuch.c| 181 
 test/T860-git-remote.sh |  45 ++
 3 files changed, 232 insertions(+), 1 deletion(-)
 create mode 100644 git-remote-notmuch.c
 create mode 100755 test/T860-git-remote.sh

diff --git a/Makefile.local b/Makefile.local
index 7699c208..2ac494b8 100644
--- a/Makefile.local
+++ b/Makefile.local
@@ -1,7 +1,8 @@
 # -*- makefile-gmake -*-
 
 .PHONY: all
-all: notmuch notmuch-shared build-man build-info ruby-bindings 
python-cffi-bindings notmuch-git nmbug
+all: notmuch notmuch-shared git-remote-notmuch \
+   build-man build-info ruby-bindings python-cffi-bindings notmuch-git 
nmbug
 ifeq ($(MAKECMDGOALS),)
 ifeq ($(shell cat .first-build-message 2>/dev/null),)
@NOTMUCH_FIRST_BUILD=1 $(MAKE) --no-print-directory all
@@ -274,6 +275,9 @@ notmuch: $(notmuch_client_modules) lib/libnotmuch.a 
util/libnotmuch_util.a parse
 notmuch-shared: $(notmuch_client_modules) lib/$(LINKER_NAME)
$(call quiet,$(FINAL_NOTMUCH_LINKER) $(CFLAGS)) 
$(notmuch_client_modules) $(FINAL_NOTMUCH_LDFLAGS) -o $@
 
+git-remote-notmuch: git-remote-notmuch.o status.o
+   $(call quiet,$(FINAL_NOTMUCH_LINKER) $(CFLAGS)) $^ 
$(FINAL_NOTMUCH_LDFLAGS) -o $@
+
 .PHONY: install
 install: all install-man install-info
mkdir -p "$(DESTDIR)$(prefix)/bin/"
@@ -302,6 +306,7 @@ endif
 
 SRCS  := $(SRCS) $(notmuch_client_srcs)
 CLEAN := $(CLEAN) notmuch notmuch-shared $(notmuch_client_modules)
+CLEAN := $(CLEAN) git-remote-notmuch git-remote-notmuch.o
 CLEAN := $(CLEAN) version.stamp notmuch-*.tar.gz.tmp
 CLEAN := $(CLEAN) .deps
 
diff --git a/git-remote-notmuch.c b/git-remote-notmuch.c
new file mode 100644
index ..cfc43a68
--- /dev/null
+++ b/git-remote-notmuch.c
@@ -0,0 +1,181 @@
+/* notmuch - Not much of an email program, (just index and search)
+ *
+ * Copyright © 2023 Felipe Contreras
+ * Copyright © 2024 David Bremner
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see https://www.gnu.org/licenses/ .
+ *
+ * Authors: Felipe Contreras
+ * David Bremner 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "notmuch-client.h"
+#include "path-util.h"
+#include "hex-escape.h"
+#include "string-util.h"
+
+#define ASSERT(x) assert((x))
+
+/* File scope globals */
+const char *alias = NULL;
+const char *nm_dir = NULL;
+const char *url = NULL;
+const char* debug_flags = NULL;
+unsigned long lastmod;
+notmuch_database_t *db;
+FILE *log_file = NULL;
+
+static void
+flog (const char *format, ...) {
+va_list va_args;
+
+if (log_file) {
+   va_start (va_args, format);
+   vfprintf (log_file, format, va_args);
+   fflush (log_file);
+   va_end (va_args);
+}
+}
+
+static unsigned long read_lastmod (const void *ctx, const char *dir) {
+char *filename = NULL;
+unsigned long num = 0;
+
+FILE *in;
+
+ASSERT(filename = talloc_asprintf (ctx, "%s/lastmod", dir));
+
+in = fopen (filename, "r");
+if (in) {
+   ASSERT(fscanf (in, "%zu", &num) == 1);
+} else {
+   if (errno != ENOENT) {
+   fprintf (stderr, "error opening lastmod file");
+   exit(EXIT_FAILURE);
+   }
+}
+
+flog ("loaded lastmod = %zu\n", num);
+
+return num;
+}
+
+static void
+cmd_capabilities () {
+fputs("import\nexport\nrefspec refs/heads/*:refs/notmuch/*\n\n", stdout);
+fflush (stdout);
+}
+
+static void
+cmd_list () {
+unsigned long current_lastmod;
+current_lastmod = notmuch_database_get_revision (db, NULL);
+printf("? refs/heads/master%s\n\n",
+  lastmod == current_lastmod ? " unchanged" : "");
+fflush (stdout);
+}
+
+static void
+usage() {
+fprintf (stderr, "usage: git-remote-nm ALIAS URL\n");
+exit(EXIT_FAILURE);
+}
+
+int
+main (int argc, char *argv[])
+{
+  notmuch_status_t status;
+  char *status_string = NULL;
+  const char* git_dir;
+  ssize_t nread;
+  size_t len = 0;
+  const char *log_file_name;
+
+  char *line = NULL;
+
+  debug_flags =

[PATCH 3/5] cli/git-remote: add support for import command

2024-08-28 Thread David Bremner
The output in default.import is based on a modified version
of Felipe's git-remote-nm with Blake2 hashing replaced by SHA1
(for portability). This enable git-pull, so test that as well.
---
 git-remote-notmuch.c| 129 
 test/T860-git-remote.sh |  38 +++-
 2 files changed, 166 insertions(+), 1 deletion(-)

diff --git a/git-remote-notmuch.c b/git-remote-notmuch.c
index cfc43a68..a4ed98e2 100644
--- a/git-remote-notmuch.c
+++ b/git-remote-notmuch.c
@@ -76,6 +76,54 @@ static unsigned long read_lastmod (const void *ctx, const 
char *dir) {
 return num;
 }
 
+static void
+store_lastmod (notmuch_database_t *notmuch, const char *dir) {
+char *filename = NULL;
+FILE *out;
+
+ASSERT(filename = talloc_asprintf (notmuch, "%s/lastmod", dir));
+
+ASSERT(out = fopen (filename, "w"));
+
+ASSERT(fprintf (out, "%zu\n", notmuch_database_get_revision (notmuch, 
NULL)) > 0);
+}
+
+static void
+read_one_line (FILE *stream, char **line_p, size_t *len_p) {
+ssize_t nread;
+
+nread = getline(line_p, len_p, stream);
+if (nread < 0) {
+   perror ("getline");
+   exit (EXIT_FAILURE);
+}
+ASSERT(line_p);
+
+chomp_newline(*line_p);
+}
+
+static const char*
+shell2string (const char* command) {
+FILE *out;
+char *line = NULL;
+size_t len;
+
+out = popen (command,"r");
+if (out == NULL) {
+   perror("popen");
+   exit(EXIT_FAILURE);
+}
+
+read_one_line (out, &line, &len);
+return line;
+}
+
+static void
+wr_data(const char *data) {
+printf ("data %zu\n", strlen(data));
+fputs (data, stdout);
+}
+
 static void
 cmd_capabilities () {
 fputs("import\nexport\nrefspec refs/heads/*:refs/notmuch/*\n\n", stdout);
@@ -97,6 +145,85 @@ usage() {
 exit(EXIT_FAILURE);
 }
 
+static void
+cmd_import (notmuch_database_t *notmuch) {
+const char* ident = NULL;
+const char* lastmod_str = NULL;
+notmuch_messages_t *messages;
+notmuch_status_t status;
+notmuch_query_t *query;
+char *mid_buf = NULL;
+size_t mid_buf_len = 0;
+
+ident = shell2string("git var GIT_COMMITTER_IDENT");
+
+printf ("feature done\ncommit refs/notmuch/master\nmark :1\ncommitter 
%s\n", ident);
+
+ASSERT(lastmod_str = talloc_asprintf (notmuch, "lastmod: %zu\n", lastmod));
+wr_data (lastmod_str);
+if (lastmod > 0)
+   puts("from refs/notmuch/master^0");
+puts("deleteall");
+
+status = notmuch_query_create_with_syntax (notmuch,
+  "",
+  NOTMUCH_QUERY_SYNTAX_XAPIAN,
+  &query);
+
+if (print_status_database ("git-remote-nm", notmuch, status))
+   exit(EXIT_FAILURE);
+
+if (debug_flags && strchr (debug_flags, 's'))
+   notmuch_query_set_sort (query, NOTMUCH_SORT_NEWEST_FIRST);
+else
+   notmuch_query_set_sort (query, NOTMUCH_SORT_UNSORTED);
+
+status = notmuch_query_search_messages (query, &messages);
+if (print_status_query ("git-remote-nm", query, status))
+   exit(EXIT_FAILURE);
+
+for (;
+notmuch_messages_valid (messages);
+notmuch_messages_move_to_next (messages)) {
+
+   const char* tag_buf = "";
+   const char* mid;
+
+   const char* hash;
+
+   notmuch_message_t *message = notmuch_messages_get (messages);
+   mid = notmuch_message_get_message_id (message);
+
+   if (hex_encode (notmuch, mid, &mid_buf, &mid_buf_len) != HEX_SUCCESS) {
+   fprintf (stderr, "Error: failed to hex-encode message-id %s\n", 
mid);
+   exit(EXIT_FAILURE);
+   }
+
+   /* we can't use _notmuch_sha1_from_string because we don't want
+* to include the null terminator */
+   GChecksum *sha1;
+   sha1 = g_checksum_new (G_CHECKSUM_SHA1);
+   g_checksum_update (sha1, (const guchar *) mid, strlen (mid));
+   hash = g_checksum_get_string (sha1);
+   printf ("M 644 inline %2.2s/%2.2s/%s/tags\n", hash, hash+2, mid_buf);
+
+   g_checksum_free (sha1);
+
+   for (notmuch_tags_t *tags = notmuch_message_get_tags (message);
+notmuch_tags_valid (tags);
+notmuch_tags_move_to_next (tags)) {
+   const char *tag_str = notmuch_tags_get (tags);
+   ASSERT(tag_buf=talloc_asprintf (message, "%s%s\n", tag_buf, 
tag_str));
+   }
+   wr_data (tag_buf);
+   notmuch_message_destroy (message);
+}
+puts("");
+puts("done");
+fflush (stdout);
+store_lastmod(notmuch, nm_dir);
+}
+
 int
 main (int argc, char *argv[])
 {
@@ -169,6 +296,8 @@ main (int argc, char *argv[])
 
   if (STRNCMP_LITERAL (s, "capabilities")== 0)
  cmd_capabilities ();
+  else if (STRNCMP_LITERAL (s, "import") == 0)
+ cmd_import (db);
   else if (STRNCMP_LITERAL (s, "list") == 0)
  cmd_list ();
 
diff --git a/test/T860-git-remote.sh b/test/T860-git-remote.sh
index 7b2b6b49..d5809e6b 

WIP: git-remote-notmuch

2024-08-28 Thread David Bremner
I wanted to try out Felipe's idea of using a remote helper to replace
/ augment the existing notmuch-git script, but I didn't want to
require language bindings. Porting Felipe's ruby script to C led to
a predictable amount of increase in the number of lines of code, but
it seems to work. There are a couple of points to note

0) Currently this is not used by notmuch-git at all.

1) Felipe's original script didn't have an explicit license grant, but
I added the standard notmuch GPL3+ license to my rewrite. Hopefully
that is OK for Felipe.

2) I renamed to git-remote-notmuch, so the corresponding URLs start with
   notmuch:: instead of nm::
   
3) The original script took a path to mail_root, but this doesn't
   really cover the possible split configurations; in particular it
   doesn't handle my (XDG) layout. The current code just looks for the
   "default" notmuch setup, and ignores the URL.  I am open to ideas
   for how a notmuch URL should look like. I'd imagine they
   should have the profile in them, but I'm not sure how much flexibility we 
need / want to suppot.
   
4) the code is a bit rough and ready, with error handling mainly
consisting of asserts.

5) There is currently no documentation, see test/T860 and
perf-test/T08 for hints.

6) The remote helper is potentially complimentary to git-notmuch/nmbug
as it provides a more standard (to git users) interface.
git-notmuch could probably transition to a wrapper.


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


Re: [PATCH] Install notmuch-git during make install

2024-08-23 Thread David Bremner
Michael J Gruber  writes:


> notmuch-git(1) mentions nmbug, so we'd want to install that as well, don't we?
>

FWIW, we do in Debian. But I am probably biased as one of the main users
of nmbug and the Debian package maintainer.

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


Re: [PATCH] implement a capf for address completion

2024-08-17 Thread David Bremner
Antoine Beaupré  writes:

>
> I'm fine with that too, what's the next step? A patch that actually
> replaces the notmuch-address.el stuff with tarsis's? A reply to tarsius'
> original patch? :)
>
> I can try either, but don't have the latter in my archives, i think.


My plan is as follows.

1) release 0.39 soonish, after applying some fixes currently under review.
(particularly the refresh fixs in emacs).

2) Deprecate emacs older than 27.1 in 0.39.

3) wait for address completion patches to test

I'll try to test the functionality [1] at some point in that interval, but
if we are going to replace the existing address completion code we'll
need updates to the tests and documentation. Other people testing their
use cases would be welcome as well.

d

[1]: https://github.com/tarsius/notmuch-addr
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH] NEWS: deprecate Emacs older than 27.1

2024-08-17 Thread David Bremner
The current requirement of 25.1 is more than 5 years old at this
point.
---
 NEWS | 5 +
 1 file changed, 5 insertions(+)

diff --git a/NEWS b/NEWS
index 8c0ab15b..da40354a 100644
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,11 @@ non-matched authors when showing threads. See
 `search.authors_separator` and `search.authors_matched_separator` in
 notmuch-config(1).
 
+Emacs
+-
+
+Support for Emacs older than 27.1 is deprecated with this release.
+
 Notmuch 0.38.3 (2024-03-09)
 ===
 
-- 
2.43.0

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


Re: [PATCH] emacs/mua: Correct autoload cookies

2024-08-16 Thread David Bremner
Pengji Zhang  writes:

> This is a follow-up to [1: 8d06dfce]. Per Info node '(elisp)Autoload',
> autoload cookies should start with ';;;###'.
>
> 1: 2024-04-04 8d06dfce175593aebae9a759c9167df4988a3444
>emacs: Autoload notmuch-user-agent related functions

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


[PATCH v2 4/4] doc/emacs: start subsection on message level actions

2024-08-14 Thread David Bremner
In particular this gives a place for documenting how to resume editing
drafts.
---
 doc/notmuch-emacs.rst | 38 ++
 1 file changed, 38 insertions(+)

diff --git a/doc/notmuch-emacs.rst b/doc/notmuch-emacs.rst
index bf862697..9c2dab47 100644
--- a/doc/notmuch-emacs.rst
+++ b/doc/notmuch-emacs.rst
@@ -357,6 +357,42 @@ The following motion/navigation bindings are also 
available in
 
 Move to previous matching message
 
+Actions
+---
+
+The following actions on messages are also available in
+:ref:`notmuch-tree` and :ref:`notmuch-unthreaded`.
+
+.. el:define-key:: b
+   M-x notmuch-show-resend-message
+
+   Resend (*bounce*) message.
+
+.. el:define-key:: e
+
+   Resume *editing* a message in :ref:`notmuch-message`. This is
+   particularly useful for :ref:`notmuch-emacs-drafts`, but can be
+   used for other messages as well.
+
+.. el:define-key:: f
+   M-x notmuch-show-forward-message
+
+   Forward (as a MIME attachment) message
+
+.. el:define-key:: r
+   M-x notmuch-show-reply-to-sender
+
+   Reply to sender (only) using :ref:`notmuch-message`
+
+.. el:define-key:: w
+   M-x notmuch-show-save-attachments
+
+   |docstring::notmuch-show-save-attachments|
+
+.. el:define-key:: R
+   M-x notmuch-show-reply
+
+   |docstring::notmuch-show-reply|
 
 Configuration
 -
@@ -667,6 +703,8 @@ Keybindings are the same as :any:`notmuch-tree`.
See also :el:defcustom:`notmuch-search-result-format` and
:el:defcustom:`notmuch-tree-result-format`.
 
+.. _notmuch-message:
+
 notmuch-message
 ===
 
-- 
2.43.0

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


[PATCH v2 3/4] doc/emacs: update keybindings list for 'e'

2024-08-14 Thread David Bremner
The mention of notmuch-tree-button-activate seems to have been an
error / obsolete.
---
 devel/emacs-keybindings.org | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/devel/emacs-keybindings.org b/devel/emacs-keybindings.org
index d8b443e6..ac98cb66 100644
--- a/devel/emacs-keybindings.org
+++ b/devel/emacs-keybindings.org
@@ -5,7 +5,7 @@
 | b| notmuch-search-scroll-down   | 
notmuch-show-resend-message   | 
notmuch-show-resend-message|
 | c| notmuch-search-stash-map | 
notmuch-show-stash-map| notmuch-show-stash-map  
   |
 | d|  |
   |
|
-| e|  |
   | (notmuch-tree-button-activate) 
|
+| e|  | 
notmuch-show-resume-message   | 
notmuch-tree-resume-message|
 | f|  | 
notmuch-show-forward-message  | 
notmuch-show-forward-message   |
 | g|  |
   |
|
 | h|  | 
notmuch-show-toggle-visibility-headers| 
   |
-- 
2.43.0

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


[PATCH v2 2/4] doc/emacs: refactor navigation commands

2024-08-14 Thread David Bremner
The amount of space saved here is minimal, but I want to migrate to a
more topic focused manual, as opposed to long alphabetical lists of
commands.
---
 doc/notmuch-emacs.rst | 52 ---
 1 file changed, 24 insertions(+), 28 deletions(-)

diff --git a/doc/notmuch-emacs.rst b/doc/notmuch-emacs.rst
index 48f87458..bf862697 100644
--- a/doc/notmuch-emacs.rst
+++ b/doc/notmuch-emacs.rst
@@ -320,6 +320,27 @@ pressing RET after positioning the cursor on a hidden part.
 
 :ref:`show-copy`
 
+.. el:define-key:: +
+   -
+
+Add or remove arbitrary tags from the current message.
+
+.. el:define-key:: !
+
+|docstring::notmuch-show-toggle-elide-non-matching|
+
+.. el:define-key:: ?
+
+Display full set of key bindings
+
+.. _show-navigation:
+
+Navigation
+--
+
+The following motion/navigation bindings are also available in
+:ref:`notmuch-tree` and :ref:`notmuch-unthreaded`.
+
 .. el:define-key:: N
 
 Move to next message
@@ -336,18 +357,9 @@ pressing RET after positioning the cursor on a hidden part.
 
 Move to previous matching message
 
-.. el:define-key:: +
-   -
-
-Add or remove arbitrary tags from the current message.
-
-.. el:define-key:: !
-
-|docstring::notmuch-show-toggle-elide-non-matching|
 
-.. el:define-key:: ?
-
-Display full set of key bindings
+Configuration
+-
 
 Display of messages can be controlled by the following variables; see also 
:ref:`show-large`.
 
@@ -522,7 +534,7 @@ notmuch-tree
 ``notmuch-tree-mode`` displays the results of a "notmuch tree" of your
 email archives. Each line in the buffer represents a single
 message giving the relative date, the author, subject, and any
-tags.
+tags. For common navigation commands see :ref:`show-navigation`.
 
 .. el:define-key:: c
 
@@ -532,22 +544,6 @@ tags.
 
Displays that message.
 
-.. el:define-key:: N
-
-Move to next message
-
-.. el:define-key:: P
-
-Move to previous message
-
-.. el:define-key:: n
-
-Move to next matching message
-
-.. el:define-key:: p
-
-Move to previous matching message
-
 .. el:define-key:: o
M-x notmuch-tree-toggle-order
 
-- 
2.43.0

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


[PATCH v2 1/4] doc/emacs: start a section on notmuch-message-mode

2024-08-14 Thread David Bremner
This is mostly just copying docstrings, but putting them into sections
makes them more discoverable.
---
 doc/conf.py   |  2 +-
 doc/notmuch-emacs.rst | 57 ---
 2 files changed, 49 insertions(+), 10 deletions(-)

diff --git a/doc/conf.py b/doc/conf.py
index ee1b336a..5270011d 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -47,7 +47,7 @@ if tags.has('WITH_EMACS'):
 # Hacky reimplementation of include to workaround limitations of
 # sphinx-doc
 lines = ['.. include:: /../emacs/rstdoc.rsti\n\n'] # in the source tree
-for file in ('notmuch.rsti', 'notmuch-lib.rsti', 'notmuch-hello.rsti', 
'notmuch-show.rsti', 'notmuch-tag.rsti', 'notmuch-tree.rsti'):
+for file in ('notmuch.rsti', 'notmuch-lib.rsti', 'notmuch-hello.rsti', 
'notmuch-show.rsti', 'notmuch-tag.rsti', 'notmuch-tree.rsti', 
'notmuch-maildir-fcc.rsti'):
 lines.extend(open(rsti_dir+'/'+file))
 rst_epilog = ''.join(lines)
 del lines
diff --git a/doc/notmuch-emacs.rst b/doc/notmuch-emacs.rst
index 91af6d14..48f87458 100644
--- a/doc/notmuch-emacs.rst
+++ b/doc/notmuch-emacs.rst
@@ -671,6 +671,54 @@ Keybindings are the same as :any:`notmuch-tree`.
See also :el:defcustom:`notmuch-search-result-format` and
:el:defcustom:`notmuch-tree-result-format`.
 
+notmuch-message
+===
+
+Notmuch uses a slighly customized version of the standard emacs email
+composition mode info:message.
+
+.. _notmuch-emacs-drafts:
+
+Drafts
+--
+
+.. el:define-key:: C-x C-p
+   M-x notmuch-draft-postpone
+
+   Postpone (save and bury) a draft.
+
+.. el:define-key:: C-x C-s
+   M-x notmuch-draft-save
+
+   Save a draft and continue editing.
+
+.. _notmuch-emacs-replies:
+
+.. _notmuch-emacs-fcc:
+
+Fcc
+---
+
+.. el:defcustom:: notmuch-fcc-dirs
+
+   |docstring::notmuch-fcc-dirs|
+
+.. el:defcustom:: notmuch-maildir-use-notmuch-insert
+
+   |docstring::notmuch-maildir-use-notmuch-insert|
+
+Replies
+---
+
+.. el:defcustom:: message-dont-reply-to-names
+
+   When composing mail replies, Emacs's message mode uses the
+   variable :code:`message-dont-reply-to-names` to exclude
+   recipients matching a given collection of regular expressions
+   or satisfying an arbitrary predicate.  Notmuch's MUA inherits
+   this standard mechanism and will honour your customization of
+   this variable.
+
 Global key bindings
 ===
 
@@ -770,15 +818,6 @@ Sending Mail
:code:`compose-mail`.  To use ``notmuch`` for this, customize this
variable to the symbol :code:`notmuch-user-agent`.
 
-.. el:defcustom:: message-dont-reply-to-names
-
-   When composing mail replies, Emacs's message mode uses the
-   variable :code:`message-dont-reply-to-names` to exclude
-   recipients matching a given collection of regular expressions
-   or satisfying an arbitrary predicate.  Notmuch's MUA inherits
-   this standard mechanism and will honour your customization of
-   this variable.
-
 Init File
 -
 
-- 
2.43.0

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


Emacs documentation updates v2

2024-08-14 Thread David Bremner
Sorry to send the second version so quickly, but I skipped two patches
which will probably make id:20240814105741.1456503-1-da...@tethera.net
impossible to apply cleanly.
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH] emacs/doc: start subsection on message level actions

2024-08-14 Thread David Bremner
In particular this gives a place for documenting how to resume editing
drafts.
---
 doc/notmuch-emacs.rst | 38 ++
 1 file changed, 38 insertions(+)

diff --git a/doc/notmuch-emacs.rst b/doc/notmuch-emacs.rst
index bf862697..9c2dab47 100644
--- a/doc/notmuch-emacs.rst
+++ b/doc/notmuch-emacs.rst
@@ -357,6 +357,42 @@ The following motion/navigation bindings are also 
available in
 
 Move to previous matching message
 
+Actions
+---
+
+The following actions on messages are also available in
+:ref:`notmuch-tree` and :ref:`notmuch-unthreaded`.
+
+.. el:define-key:: b
+   M-x notmuch-show-resend-message
+
+   Resend (*bounce*) message.
+
+.. el:define-key:: e
+
+   Resume *editing* a message in :ref:`notmuch-message`. This is
+   particularly useful for :ref:`notmuch-emacs-drafts`, but can be
+   used for other messages as well.
+
+.. el:define-key:: f
+   M-x notmuch-show-forward-message
+
+   Forward (as a MIME attachment) message
+
+.. el:define-key:: r
+   M-x notmuch-show-reply-to-sender
+
+   Reply to sender (only) using :ref:`notmuch-message`
+
+.. el:define-key:: w
+   M-x notmuch-show-save-attachments
+
+   |docstring::notmuch-show-save-attachments|
+
+.. el:define-key:: R
+   M-x notmuch-show-reply
+
+   |docstring::notmuch-show-reply|
 
 Configuration
 -
@@ -667,6 +703,8 @@ Keybindings are the same as :any:`notmuch-tree`.
See also :el:defcustom:`notmuch-search-result-format` and
:el:defcustom:`notmuch-tree-result-format`.
 
+.. _notmuch-message:
+
 notmuch-message
 ===
 
-- 
2.43.0

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


[PATCH] doc/emacs: start a section on notmuch-message-mode

2024-08-13 Thread David Bremner
This is mostly just copying docstrings, but putting them into sections
makes them more discoverable.
---
 doc/conf.py   |  2 +-
 doc/notmuch-emacs.rst | 57 ---
 2 files changed, 49 insertions(+), 10 deletions(-)

diff --git a/doc/conf.py b/doc/conf.py
index ee1b336a..5270011d 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -47,7 +47,7 @@ if tags.has('WITH_EMACS'):
 # Hacky reimplementation of include to workaround limitations of
 # sphinx-doc
 lines = ['.. include:: /../emacs/rstdoc.rsti\n\n'] # in the source tree
-for file in ('notmuch.rsti', 'notmuch-lib.rsti', 'notmuch-hello.rsti', 
'notmuch-show.rsti', 'notmuch-tag.rsti', 'notmuch-tree.rsti'):
+for file in ('notmuch.rsti', 'notmuch-lib.rsti', 'notmuch-hello.rsti', 
'notmuch-show.rsti', 'notmuch-tag.rsti', 'notmuch-tree.rsti', 
'notmuch-maildir-fcc.rsti'):
 lines.extend(open(rsti_dir+'/'+file))
 rst_epilog = ''.join(lines)
 del lines
diff --git a/doc/notmuch-emacs.rst b/doc/notmuch-emacs.rst
index 91af6d14..48f87458 100644
--- a/doc/notmuch-emacs.rst
+++ b/doc/notmuch-emacs.rst
@@ -671,6 +671,54 @@ Keybindings are the same as :any:`notmuch-tree`.
See also :el:defcustom:`notmuch-search-result-format` and
:el:defcustom:`notmuch-tree-result-format`.
 
+notmuch-message
+===
+
+Notmuch uses a slighly customized version of the standard emacs email
+composition mode info:message.
+
+.. _notmuch-emacs-drafts:
+
+Drafts
+--
+
+.. el:define-key:: C-x C-p
+   M-x notmuch-draft-postpone
+
+   Postpone (save and bury) a draft.
+
+.. el:define-key:: C-x C-s
+   M-x notmuch-draft-save
+
+   Save a draft and continue editing.
+
+.. _notmuch-emacs-replies:
+
+.. _notmuch-emacs-fcc:
+
+Fcc
+---
+
+.. el:defcustom:: notmuch-fcc-dirs
+
+   |docstring::notmuch-fcc-dirs|
+
+.. el:defcustom:: notmuch-maildir-use-notmuch-insert
+
+   |docstring::notmuch-maildir-use-notmuch-insert|
+
+Replies
+---
+
+.. el:defcustom:: message-dont-reply-to-names
+
+   When composing mail replies, Emacs's message mode uses the
+   variable :code:`message-dont-reply-to-names` to exclude
+   recipients matching a given collection of regular expressions
+   or satisfying an arbitrary predicate.  Notmuch's MUA inherits
+   this standard mechanism and will honour your customization of
+   this variable.
+
 Global key bindings
 ===
 
@@ -770,15 +818,6 @@ Sending Mail
:code:`compose-mail`.  To use ``notmuch`` for this, customize this
variable to the symbol :code:`notmuch-user-agent`.
 
-.. el:defcustom:: message-dont-reply-to-names
-
-   When composing mail replies, Emacs's message mode uses the
-   variable :code:`message-dont-reply-to-names` to exclude
-   recipients matching a given collection of regular expressions
-   or satisfying an arbitrary predicate.  Notmuch's MUA inherits
-   this standard mechanism and will honour your customization of
-   this variable.
-
 Init File
 -
 
-- 
2.43.0

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


Re: [PATCH] implement a capf for address completion

2024-08-13 Thread David Bremner
Antoine Beaupré  writes:

>
> So I'm not sure what to do with this. This certainly seems really
> precious stuff! Could we add this to notmuch-emacs, perhaps gated on the
> Emacs version?
>
> Running Emacs 29.4 from Debian bookworm-backports here, in case that
> matters.
>

I'm more interested in changing the baseline requirement for
notmuch-emacs to emacs 27 than in shipping two address completion
frameworks.  Emacs 27 is about 4 years old now, so should be available
for most people (but not all).

From a debian point of view, the last version that shipped with emacs
pre-27 has fallen out of long term support a month ago, and even that
version has emacs 27 in backports.  People on "enterprise" systems will
probably be worse off, per usual.

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


Re: Emacs: Generate autoloads during installation?

2024-08-12 Thread David Bremner
Pengji Zhang  writes:

>
> I wonder if we could generate and install a 'notmuch-autoloads.el' 
> file as well during installation, like mu4e[1]. So we only need to 
> load that file at Emacs startup, which should be much cheaper.

Currently notmuch-autoloads.el is generated by package.el
during installation. To try it out, run

make elpa

then

M-x package-install-file notmuch-emacs-$version.tar

I guess as long as it did not break the various package.el workflows, we
could consider running the same auto-generation code at build time.


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


Re: [PATCH] implement a capf for address completion

2024-08-10 Thread David Bremner
Antoine Beaupré  writes:

>
> I should have posted a followup to this patch already, and must say it's
> really not ready at all.
>
> I have found myself in the situation where my address completion is now
> completely broken. I don't even *know* how to restore the previous
> behavior.
>
> So clearly, this patch should be ignored for now... But I do feel we
> should somehow figure out how to hook ourselves in there. There's
> probably a way to do some asynchronous thing here, and indeed that's how
> even the normal tab completion works, from what I gathered.

Thanks for the update / explanation. Indeed, the existing address completion
stuff is pretty complex.

d

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


[PATCH 3/6] emacs: replace use of hook to draw hl-line in search mode

2024-08-10 Thread David Bremner
In the thread at id:87fsfuuxwn.fsf@thinkbox, a bug is discussed where
the point and hl-line overlay get out of sync, leading the user to
open the wrong message. As far as I can tell this is caused by
notmuch-hl-mode being invoked too early.

This change bypasses the logic preventing notmuch-search-hook being
called only once, so that the overlay is updated later after after the
buffer is full(er).

This change may lead to the overlay being updated multiple times; if
this is annoying we can add a similar buffer local variable to ensure
it is only called once.

The extra logic to check notmuch-search-target-line reduces the
flicker somewhat by not highlighting the first line every time.
---
 emacs/notmuch.el   | 8 ++--
 test/T312-emacs-hl-line.sh | 2 --
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 934ec894..2d7e0422 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -126,10 +126,9 @@ there will be called at other points of notmuch execution."
   :type 'file
   :group 'notmuch)
 
-(defcustom notmuch-search-hook '(notmuch-hl-line-mode)
+(defcustom notmuch-search-hook nil
   "List of functions to call when notmuch displays the search results."
   :type 'hook
-  :options '(notmuch-hl-line-mode)
   :group 'notmuch-search
   :group 'notmuch-hooks)
 
@@ -930,6 +929,11 @@ sets the :orig-tag property."
(notmuch-sexp-parse-partial-list 'notmuch-search-append-result
 results-buf))
   (with-current-buffer results-buf
+   (when (and notmuch-hl-line
+  (>=
+   (line-number-at-pos (point-max) t)
+   (or notmuch-search-target-line -1)))
+ (notmuch-hl-line-mode))
(notmuch--search-hook-wrapper)
 
 ;;; Commands (and some helper functions used by them)
diff --git a/test/T312-emacs-hl-line.sh b/test/T312-emacs-hl-line.sh
index 4cceed30..4697b671 100755
--- a/test/T312-emacs-hl-line.sh
+++ b/test/T312-emacs-hl-line.sh
@@ -104,7 +104,6 @@ test_emacs_expect_t '(let ((notmuch-hl-line t))
   (line-number-at-pos (overlay-start hl-line-overlay)) 
12))'
 
 test_begin_subtest "line 12, search, refresh"
-test_subtest_known_broken
 test_emacs_expect_t '(let ((notmuch-hl-line t))
(notmuch-search "tag:inbox")
(notmuch-test-wait)
@@ -140,7 +139,6 @@ test_emacs_expect_t '(let ((notmuch-hl-line t))
   (line-number-at-pos (overlay-start hl-line-overlay)) 
12))'
 
 test_begin_subtest "hl-line disabled, search"
-test_subtest_known_broken
 test_emacs_expect_t '(let ((notmuch-hl-line nil))
(notmuch-search "tag:inbox")
(notmuch-test-wait)
-- 
2.43.0

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


[PATCH 6/6] emacs/tree: add call to notmuch-hl-line-mode from process-filter

2024-08-10 Thread David Bremner
This removes the visual gap/stutter between when the screen fills and
when the hl-line "cursor" is drawn.  It is not obviously how to
robustly test this, since it the observable effect is purely a matter
of timing.
---
 emacs/notmuch-tree.el | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
index 481b0b34..301ffd6e 100644
--- a/emacs/notmuch-tree.el
+++ b/emacs/notmuch-tree.el
@@ -1139,7 +1139,10 @@ object, and with the tree results buffer as the current 
buffer.")
  (goto-char (point-max))
  (insert string))
(notmuch-sexp-parse-partial-list 'notmuch-tree-insert-forest-thread
-results-buf)
+results-buf))
+  (with-current-buffer results-buf
+   (when notmuch-hl-line
+ (notmuch-hl-line-mode))
 
 (defun notmuch-tree-worker (basic-query &optional query-context target
open-target unthreaded oldest-first
-- 
2.43.0

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


[PATCH 2/6] test/emacs: add tests for hl-line-mode integration

2024-08-10 Thread David Bremner
Most of the known broken tests replicate (my intepretation of) the bug
reported at id:87fsfuuxwn.fsf@thinkbox (or some unreported, but
probably related bugs in tree/unthreaded view). The last 3 broken
tests are just unimplimented planned functionality.
---
 test/T312-emacs-hl-line.sh | 170 +
 1 file changed, 170 insertions(+)
 create mode 100755 test/T312-emacs-hl-line.sh

diff --git a/test/T312-emacs-hl-line.sh b/test/T312-emacs-hl-line.sh
new file mode 100755
index ..4cceed30
--- /dev/null
+++ b/test/T312-emacs-hl-line.sh
@@ -0,0 +1,170 @@
+#!/usr/bin/env bash
+
+test_description="emacs hl-line-mode"
+. $(dirname "$0")/test-lib.sh || exit 1
+. $NOTMUCH_SRCDIR/test/test-lib-emacs.sh || exit 1
+
+EXPECTED=$NOTMUCH_SRCDIR/test/emacs.expected-output
+
+test_require_emacs
+add_email_corpus
+
+test_begin_subtest "line 1, search"
+test_emacs_expect_t '(let ((notmuch-hl-line t))
+   (notmuch-search "tag:inbox")
+   (notmuch-test-wait)
+   (notmuch-test-expect-equal
+(let ((start (overlay-start hl-line-overlay))
+  (end (overlay-end hl-line-overlay)))
+  (list start (> end start)))
+(list 1 t)))'
+
+test_begin_subtest "line 1, tree"
+test_subtest_known_broken
+test_emacs_expect_t '(let ((notmuch-hl-line t))
+   (notmuch-tree "tag:inbox")
+   (notmuch-test-wait)
+   (notmuch-test-expect-equal
+(let ((start (overlay-start hl-line-overlay))
+  (end (overlay-end hl-line-overlay)))
+  (list start (> end start)))
+(list 1 t)))'
+
+test_begin_subtest "line 1, unthreaded"
+test_subtest_known_broken
+test_emacs_expect_t '(let ((notmuch-hl-line t))
+   (notmuch-tree "tag:inbox")
+   (notmuch-test-wait)
+   (notmuch-test-expect-equal
+(let ((start (overlay-start hl-line-overlay))
+  (end (overlay-end hl-line-overlay)))
+  (list start (> end start)))
+(list 1 t)))'
+
+test_begin_subtest "line 1, search, refresh"
+test_emacs_expect_t '(let ((notmuch-hl-line t))
+   (notmuch-search "tag:inbox")
+   (notmuch-test-wait)
+   (notmuch-refresh-this-buffer)
+   (notmuch-test-wait)
+   (notmuch-test-expect-equal (overlay-start 
hl-line-overlay) 1))'
+
+test_begin_subtest "line 1, tree, refresh"
+test_subtest_known_broken
+test_emacs_expect_t '(let ((notmuch-hl-line t))
+   (notmuch-tree "tag:inbox")
+   (notmuch-test-wait)
+   (notmuch-refresh-this-buffer)
+   (notmuch-test-wait)
+   (notmuch-test-expect-equal
+(let ((start (overlay-start hl-line-overlay))
+  (end (overlay-end hl-line-overlay)))
+  (list start (> end start)))
+(list 1 t)))'
+
+test_begin_subtest "line 1, unthreaded, refresh"
+test_subtest_known_broken
+test_emacs_expect_t '(let ((notmuch-hl-line t))
+   (notmuch-tree "tag:inbox")
+   (notmuch-test-wait)
+   (notmuch-refresh-this-buffer)
+   (notmuch-test-wait)
+   (notmuch-test-expect-equal
+(let ((start (overlay-start hl-line-overlay))
+  (end (overlay-end hl-line-overlay)))
+  (list start (> end start)))
+(list 1 t)))'
+
+
+test_begin_subtest "line 12, notmuch-search"
+test_emacs_expect_t '(let ((notmuch-hl-line t))
+   (notmuch-search "tag:inbox")
+   (notmuch-test-wait)
+   (forward-line 11)
+   (notmuch-post-command)
+   (notmuch-test-expect-equal
+  (line-number-at-pos (overlay-start hl-line-overlay)) 
12))'
+
+test_begin_subtest "line 12, tree"
+test_emacs_expect_t '(let ((notmuch-hl-line t))
+   (notmuch-tree "tag:inbox")
+   (notmuch-test-wait)
+   (forward-line 11)
+   (notmuch-post-command)
+   (notmuch-test-expect-equal
+  (line-number-at-pos (overlay-start hl-line-overlay)) 
12))'
+
+test_begin_subtest "line 12, unthreaded"
+test_emacs_expect_t '(let ((notmuch-hl-line t))
+   (notmuch-unthreaded "tag:inbox")
+   (notmuch-test-wait)
+   (forward-line 11)
+   (notmuch-post-command

[PATCH 4/6] emacs/tree: condition hl-line-mode on notmuch-hl-line

2024-08-10 Thread David Bremner
It isn't clear that this call to hl-line-mode will survive the coming
re-organization to stop relying on hooks, but incrementally this at
least makes the disabling behviour consistent.
---
 emacs/notmuch-tree.el  | 3 ++-
 test/T312-emacs-hl-line.sh | 2 --
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
index 2332f020..24a9970f 100644
--- a/emacs/notmuch-tree.el
+++ b/emacs/notmuch-tree.el
@@ -1091,7 +1091,8 @@ Complete list of currently available key bindings:
 
 \\{notmuch-tree-mode-map}"
   (setq notmuch-buffer-refresh-function #'notmuch-tree-refresh-view)
-  (hl-line-mode 1)
+  (when notmuch-hl-line
+(hl-line-mode 1))
   (setq buffer-read-only t)
   (setq truncate-lines t)
   (when notmuch-tree-outline-enabled (notmuch-tree-outline-mode 1)))
diff --git a/test/T312-emacs-hl-line.sh b/test/T312-emacs-hl-line.sh
index 4697b671..dd27db0e 100755
--- a/test/T312-emacs-hl-line.sh
+++ b/test/T312-emacs-hl-line.sh
@@ -147,7 +147,6 @@ test_emacs_expect_t '(let ((notmuch-hl-line nil))
   nil))'
 
 test_begin_subtest "hl-line disabled, tree"
-test_subtest_known_broken
 test_emacs_expect_t '(let ((notmuch-hl-line nil))
(notmuch-tree "tag:inbox")
(notmuch-test-wait)
@@ -156,7 +155,6 @@ test_emacs_expect_t '(let ((notmuch-hl-line nil))
   nil))'
 
 test_begin_subtest "hl-line disabled, unthreaded"
-test_subtest_known_broken
 test_emacs_expect_t '(let ((notmuch-hl-line nil))
(notmuch-unthreaded "tag:inbox")
(notmuch-test-wait)
-- 
2.43.0

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


hl-line fixes

2024-08-10 Thread David Bremner
This is an expanded version of

 id:20240809114506.1081791-1-da...@tethera.net

It includes a fairly complete set of tests, and covers tree and
unthreaded views as well as search view.

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


[PATCH 5/6] emacs/tree: call notmuch-hl-line-mode from tree-sentinel

2024-08-10 Thread David Bremner
There is a a perceptible gap between when the tree shows up and when
the hl-line is visible, but this is better than the previous state
where the line did not show up at all until the user moved the cursor.
---
 emacs/notmuch-tree.el  | 2 ++
 test/T312-emacs-hl-line.sh | 6 --
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
index 24a9970f..481b0b34 100644
--- a/emacs/notmuch-tree.el
+++ b/emacs/notmuch-tree.el
@@ -1122,6 +1122,8 @@ object, and with the tree results buffer as the current 
buffer.")
(unless (= exit-status 0)
  (insert (format " (process returned %d)" exit-status)))
(insert "\n"
+ (when (and notmuch-hl-line (= exit-status 0))
+   (notmuch-hl-line-mode))
  (run-hook-with-args 'notmuch-tree-process-exit-functions proc))
 
 (defun notmuch-tree-process-filter (proc string)
diff --git a/test/T312-emacs-hl-line.sh b/test/T312-emacs-hl-line.sh
index dd27db0e..3402811c 100755
--- a/test/T312-emacs-hl-line.sh
+++ b/test/T312-emacs-hl-line.sh
@@ -20,7 +20,6 @@ test_emacs_expect_t '(let ((notmuch-hl-line t))
 (list 1 t)))'
 
 test_begin_subtest "line 1, tree"
-test_subtest_known_broken
 test_emacs_expect_t '(let ((notmuch-hl-line t))
(notmuch-tree "tag:inbox")
(notmuch-test-wait)
@@ -31,7 +30,6 @@ test_emacs_expect_t '(let ((notmuch-hl-line t))
 (list 1 t)))'
 
 test_begin_subtest "line 1, unthreaded"
-test_subtest_known_broken
 test_emacs_expect_t '(let ((notmuch-hl-line t))
(notmuch-tree "tag:inbox")
(notmuch-test-wait)
@@ -50,7 +48,6 @@ test_emacs_expect_t '(let ((notmuch-hl-line t))
(notmuch-test-expect-equal (overlay-start 
hl-line-overlay) 1))'
 
 test_begin_subtest "line 1, tree, refresh"
-test_subtest_known_broken
 test_emacs_expect_t '(let ((notmuch-hl-line t))
(notmuch-tree "tag:inbox")
(notmuch-test-wait)
@@ -63,7 +60,6 @@ test_emacs_expect_t '(let ((notmuch-hl-line t))
 (list 1 t)))'
 
 test_begin_subtest "line 1, unthreaded, refresh"
-test_subtest_known_broken
 test_emacs_expect_t '(let ((notmuch-hl-line t))
(notmuch-tree "tag:inbox")
(notmuch-test-wait)
@@ -115,7 +111,6 @@ test_emacs_expect_t '(let ((notmuch-hl-line t))
   (line-number-at-pos (overlay-start hl-line-overlay)) 
12))'
 
 test_begin_subtest "line 12, tree, refresh"
-test_subtest_known_broken
 test_emacs_expect_t '(let ((notmuch-hl-line t))
(notmuch-tree "tag:inbox")
(notmuch-test-wait)
@@ -127,7 +122,6 @@ test_emacs_expect_t '(let ((notmuch-hl-line t))
   (line-number-at-pos (overlay-start hl-line-overlay)) 
12))'
 
 test_begin_subtest "line 12, unthreaded, refresh"
-test_subtest_known_broken
 test_emacs_expect_t '(let ((notmuch-hl-line t))
(notmuch-tree "tag:inbox")
(notmuch-test-wait)
-- 
2.43.0

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


[PATCH 1/6] emacs: add defcustom to control hl-line mode

2024-08-10 Thread David Bremner
Currently the presence of hl-line highlighting is controlled
implicitely by hooks. In future commits it will be migrated to use
this variable.
---
 emacs/notmuch.el | 5 +
 1 file changed, 5 insertions(+)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 2a73ffa5..934ec894 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -133,6 +133,11 @@ there will be called at other points of notmuch execution."
   :group 'notmuch-search
   :group 'notmuch-hooks)
 
+(defcustom notmuch-hl-line t
+  "Use hl-line-mode to highlight current thread / message"
+  :type 'boolean
+  :group 'notmuch)
+
 ;;; Mime Utilities
 
 (defun notmuch-foreach-mime-part (function mm-handle)
-- 
2.43.0

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


git:// download of notmuch is currently broken

2024-08-10 Thread David Bremner


Apparently recent security related changes for git have broken our setup
for download of the notmuch repo via git:// protocol. I think not much
people use that, as it's been broken for months and nobody noticed until
recently.

Anyway, it's on my list of things to fix, but it's not really a
priority. I'd welcome _good_ reasons why people cannot switch to to
https, that might cause me to re-prioritize

The notmuch-wiki repo (which is the main reason to support git://
currently) should be working fine.

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


[PATCH] emacs: replace use of hook to draw hl-line in search mode

2024-08-09 Thread David Bremner
In the thread at id:87fsfuuxwn.fsf@thinkbox, a bug is discussed where
the point and hl-line overlay get out of sync, leading the user to
open the wrong message. As far as I can tell this is caused by
notmuch-hl-mode being invoked too early.

This change bypasses the logic preventing notmuch-search-hook being
called only once, so that the overlay is updated later after after the
buffer is full(er).

This change may lead to the overlay being updated multiple times; if
this is annoying we can add a similar buffer local variable to ensure
it is only called once.

The extra logic to check notmuch-search-target-line reduces the
flicker somewhat by not highlighting the first line every time.
---
 emacs/notmuch.el | 13 +++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index f55e9b42..108bccec 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -126,13 +126,17 @@ there will be called at other points of notmuch 
execution."
   :type 'file
   :group 'notmuch)
 
-(defcustom notmuch-search-hook '(notmuch-hl-line-mode)
+(defcustom notmuch-search-hook nil
   "List of functions to call when notmuch displays the search results."
   :type 'hook
-  :options '(notmuch-hl-line-mode)
   :group 'notmuch-search
   :group 'notmuch-hooks)
 
+(defcustom notmuch-hl-line t
+  "Use hl-line-mode to highlight current thread / message"
+  :type 'boolean
+  :group 'notmuch)
+
 ;;; Mime Utilities
 
 (defun notmuch-foreach-mime-part (function mm-handle)
@@ -925,6 +929,11 @@ sets the :orig-tag property."
(notmuch-sexp-parse-partial-list 'notmuch-search-append-result
 results-buf))
   (with-current-buffer results-buf
+   (when (and notmuch-hl-line
+  (>=
+   (line-number-at-pos (point-max) t)
+   (or notmuch-search-target-line -1)))
+ (notmuch-hl-line-mode))
(notmuch--search-hook-wrapper)
 
 ;;; Commands (and some helper functions used by them)
-- 
2.43.0

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


Re: Selection bug

2024-08-08 Thread David Bremner
David Bremner  writes:

> David Bremner  writes:
>
>>
>> This reproduces the problem for me. Indeed it looks a bit like a similar
>> "cursor jumping" problem I have seen (and someone else has reported on
>> IRC). I will see if I can figure anything more out now that I have a
>> reproducer.
>
> I think the following is a (simpler) reproducer of the same problem.
>
> 1) Do a search with at least 10 results
>
> 2) goto line 10
>
> 3) hit 'g'
>
> For me this consistently leaves the point on line 10 but the hl-line bar
> on line 1. I have not debugged it yet, but the proximate cause is that
> when notmuch-hl-line-mode is called, (point) is 1, so the bar ends up on
> the first line. The whys and wherefores I don't know yet.

I have been slowly trying to debug this. It is a kind of heisenbug
because the position of the hl-line-mode bar is affected by using the
debugger (because hl-line-mode uses post-command-hook).

My current understanding is

0) the refresh calls notmuch-search to rebuild the buffer contents.

1) hl-line-highlight is being called via notmuch-search-hook

2) notmuch-search-hook is being invoked asynchronously from
   notmuch-search-process-filter.

3) There is a buffer local variable notmuch--search-hook-run used to
   make sure this happens only once per call to notmuch-search.

4) Unfortunately when the hook is invoked, (point) is 1, and that
   is how the hl-line-mode bar ends up on the first line, rather than
   where the (point) is after the refresh completes.

A) one question is why notmuch-search-hook is being run so early. I
vaguely remember some discussion / reason for this but I have not dug it
up.

B) I have some hope this can be fixed by use of the existing variable
   notmuch-search-target-line, but it's a bit tricky because
   at the point where the hook is invoked, the buffer does not have
   that many lines yet.
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: Carriage returns in subject line cause problems in unthreaded and tree mode

2024-08-06 Thread David Bremner
Tomi Ollila  writes:

>
> -- and is the behavior different in some other modes (I (mostly) just use 
> notmuch-search and notmuch-show modes so cannot recall how other views
> look like...
>

Yes, the issue is exactly making the behaviour consistent between
modes. It's not just ^M but also tabs that cause messiness.

In the end I decided to apply the change to master, since the code
changes are relatively small (I admit the impact on the test suite is
larger than desirable).

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


Re: [PATCH] CLI/show: warn if crypto options are used with mbox format

2024-08-06 Thread David Bremner
David Bremner  writes:

> This limitation seems somewhat hard to fix, but at least try to warn
> users when combining crypto operations with mbox output format.
>
> Because the default is --decrypt=auto, the warning is omitted if
> --decrypt=auto is specified. While this is not great, it seems more
> wrong to always warn, or to change the default because of this.

Applied to master, with some minor whitespace cleanup.

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


Re: [PATCH] implement a capf for address completion

2024-08-06 Thread David Bremner
Antoine Beaupré  writes:

>
> Now, it seems to me a simple fix is to implement a proper
> capf (`completion-at-point-function') for notmuch. And that, in turn,
> is actually pretty simple compared to the code hidden underneath
> `notmuch-address-expand-name', which not only finds completion
> candidates, but also does the whole trouble of editing the buffer.

Disclaimer: I have not looked at 'capf' before today.

Did you see the note at the end of docstring for completion-at-point
functions

NOTE: These functions should be cheap to run since they’re sometimes
run from ‘post-command-hook’; and they should ideally only choose
which kind of completion table to use, and not pre-filter it based
on the current text between START and END (e.g., they should not
obey ‘completion-styles’).

I'm not sure how expensive #notmuch-address-options is with the
defaults, but calling it from post-command-hook does sound like it could
be problematic.

A second question I have about this change is how can we test
completion? It is quite complex already, and I'm nervous about breakage.
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH] Fix saved-search buffer titles

2024-08-06 Thread David Bremner
Rudolf Adamkovič  writes:

> From c0cb08a843b5c904642da639f94c4a5e43d1ef14 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Rudolf=20Adamkovi=C4=8D?= 
> Date: Wed, 13 Dec 2023 22:39:02 +0100
> Subject: [PATCH] emacs: Fix saved-search buffer titles
>
> REPRODUCTION STEPS:
>
>   (let ((notmuch-saved-searches
>  (list (list :name "Emacs List"
>  :query "query:lists-emacs")
>(list :name "All Lists"
>  :query "query:lists"
> (notmuch-search-buffer-title "query:lists-emacs" ))
>
> ACTUAL:
>
>   "*notmuch-saved-search-[ All Lists ]-emacs*"
>
> EXPECTED:
>
>"*notmuch-saved-search-Emacs List*"

If you can make a reproducer that does not rely on your private notmuch
config (query:list), I might be able to turn that into a test.

> +   (cl-loop with match
> +with match-length = 0
> +for candidate in notmuch-saved-searches
> +for length = (let* ((query* (notmuch-saved-search-get
> + candidate
> + :query))
> +(regexp (concat "^"
> +(regexp-quote query*
> +   (and (string-match regexp query)
> +(length (match-string 0 query
> +if (and length (> length match-length))
> +do (setq match candidate
> + match-length length)
> +finally return match))

Sorry, I don't really speak cl-loop. You can either hope someone else
reviews it and convinces me, or try a less intrusive restructuring of
the existing code.


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


Re: [PATCH] devel: document emacs keybindings u and U

2024-08-05 Thread David Bremner
David Bremner  writes:

> Thanks to changing the column widths to accomodate longer function
> names, the diff is rather large, but the content is two new rows for
> 'u' and 'U'

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


Re: [PATCH 0/4] Bug fixes for Debian packaging

2024-08-05 Thread David Bremner
Nicholas D Steeves  writes:

> James McCoy (1):
>   Convert notmuch-vim to Vim addon policy 2.0
>
> Nicholas D Steeves (3):
>   Add changelog entry for James McCoy's work
>   Allow neomutt to fulfill the "mutt" requirement of notmuch-mutt, and
>   Add Astroid as an alternative Recommends; this one is a GU

Series applied to release branch and uploaded to Debian unstable
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: bug: filename points to wrong location

2024-08-04 Thread David Bremner
Thorben Günther  writes:

> I noticed this when investigating an aerc bug report [1].
>
> When the notmuch config contains a different location for
> database.mail_root (e.g. ~/.mail/user) and database.path (unset,
> should default to ~/.local/share/notmuch/default), the filepath returned
> by "notmuch_message_get_filename" points to the database path instead of
> the mail_root path.
> Here is a simple reproduction in python [2], that uses the problematic
> "notmuch_message_get_filename".
> "notmuch show" on the other hand does have the correct filename/path.
>
>
> [1]: https://todo.sr.ht/~rjarry/aerc/106
> [2]: https://paste.xenrox.net/~xenrox/d7048c7b5392df940586b42673aeba97c176d489

According to an IRC comment from Thorben, this issue can be fixed on the
aerc side by changing the call to notmuch_database_open_with_config.

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


Re: [PATCH 1/3] Add Astroid as an alternative Recommends; this one is a GUI client…

2024-08-04 Thread David Bremner
Nicholas D Steeves  writes:

>
> I have an old clone from https://git.notmuchmail.org/git/notmuch; and I
> track two branches: debian/unstable and release.  I made sure both were
> up to date.  The presence of debian/unstable usually indicates DEP14
> layout, and I noticed all the other debian/codename remote branches...
>

Sorry, I'm not much for following DEP** even in Debian specific repos
(which this one is not). Anyway, thanks for resending the patches, I'll
try to have a look today.

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


Re: [PATCH 1/3] Add Astroid as an alternative Recommends; this one is a GUI client…

2024-08-03 Thread David Bremner
Nicholas D Steeves  writes:

> that may be less intimidating for new users.
> ---
>  debian/changelog | 7 +++
>  debian/control   | 2 +-
>  2 files changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/debian/changelog b/debian/changelog
> index 72a52546..442e22ed 100644
> --- a/debian/changelog
> +++ b/debian/changelog
> @@ -1,3 +1,10 @@
> +notmuch (0.29.1-3) UNRELEASED; urgency=medium
> +
> +  * Add Astroid as an alternative Recommends; this one is a GUI client that
> +may be less intimidating for new users.
> +
> + -- Nicholas D Steeves   Fri, 02 Aug 2024 16:37:20 -0400
> +

Hi Nicholas;

Thanks for the patches.

Unfortunately they are against 5 year old version of notmuch and don't
apply.

On debian you can try

$ debcheckout notmuch

For debian only stuff, patches against the release branch (default) are
fine.

Cheers,

d

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


[PATCH] devel: document emacs keybindings u and U

2024-07-29 Thread David Bremner
Thanks to changing the column widths to accomodate longer function
names, the diff is rather large, but the content is two new rows for
'u' and 'U'
---
 devel/emacs-keybindings.org | 121 ++--
 1 file changed, 61 insertions(+), 60 deletions(-)

diff --git a/devel/emacs-keybindings.org b/devel/emacs-keybindings.org
index 218677c2..d8b443e6 100644
--- a/devel/emacs-keybindings.org
+++ b/devel/emacs-keybindings.org
@@ -1,60 +1,61 @@
-|--++---+-|
-| Key  | Search Mode| Show Mode
 | Tree Mode   |
-|--++---+-|
-| a| notmuch-search-archive-thread  | 
notmuch-show-archive-message-then-next-or-next-thread | 
notmuch-tree-archive-message-then-next  |
-| b| notmuch-search-scroll-down | 
notmuch-show-resend-message   | 
notmuch-show-resend-message |
-| c| notmuch-search-stash-map   | 
notmuch-show-stash-map| notmuch-show-stash-map  
|
-| d||  
 | |
-| e||  
 | (notmuch-tree-button-activate)  |
-| f|| 
notmuch-show-forward-message  | 
notmuch-show-forward-message|
-| g||  
 | |
-| h|| 
notmuch-show-toggle-visibility-headers| 
|
-| i| notmuch-search-toggle-hide-excluded|  
 | notmuch-tree-toggle-hide-excluded   |
-| j| notmuch-jump-search| notmuch-jump-search  
 | notmuch-jump-search |
-| k| notmuch-tag-jump   | notmuch-tag-jump 
 | notmuch-tag-jump|
-| l| notmuch-search-filter  | 
notmuch-show-filter-thread| notmuch-tree-filter 
|
-| m| notmuch-mua-new-mail   | notmuch-mua-new-mail 
 | notmuch-mua-new-mail|
-| n| notmuch-search-next-thread | 
notmuch-show-next-open-message| 
notmuch-tree-next-matching-message  |
-| o| notmuch-search-toggle-order|  
 | notmuch-tree-toggle-order   |
-| p| notmuch-search-previous-thread | 
notmuch-show-previous-open-message| 
notmuch-tree-prev-matching-message  |
-| q| notmuch-bury-or-kill-this-buffer   | 
notmuch-bury-or-kill-this-buffer  | 
notmuch-bury-or-kill-this-buffer|
-| r| notmuch-search-reply-to-thread-sender  | 
notmuch-show-reply-sender | 
notmuch-show-reply-sender   |
-| s| notmuch-search | notmuch-search   
 | notmuch-search  |
-| t| notmuch-search-filter-by-tag   | 
toggle-truncate-lines | 
notmuch-tree-filter-by-tag  |
-| u||  
 | |
-| v||  
 | notmuch-show-view-all-mime-parts|
-| w|| 
notmuch-show-save-attachments | 
notmuch-show-save-attachments   |
-| x| notmuch-bury-or-kill-this-buffer   | 
notmuch-show-archive-message-then-next-or-exit| notmuch-tree-quit   
|
-| y||  
 | |
-| z| notmuch-tree   | notmuch-tree 
  

Re: [PATCH 2/2] Add notmuch-search-show-or-unthread

2024-07-29 Thread David Bremner
Sandra Snan  writes:

> David Bremner  writes:
>> 1) can you make a test (probably something in T465 can serve as 
>> a model
>
> What does T465 refer to?

test/T465-emacs-unthreaded.sh

>
> But if the treshhold is too big it won't prevent any crashes, 
> overloads, or uncomfortably unergonomic thread view. It needs to 
> be within a useful range. Maybe 35, 40 or so. I've been sticking 
> with the "< 11" threshold I sent in the patch.
>
I suggested a large value to make it "opt in", but if there is a broader
consensus I'm fine with a more "active" default.

>> There is a slight performance penalty from add notmuch count; 
>> I'm not sure if this is noticable.
>
> Right. Since my machine is very fast I've not noticed any 
> slowdown at all.

Let's get the function into master and documented and go from
their. Hopefully a few users will give us feedback on performance impact
(if any).

You can preview the documentation with e.g.

   make sphinx-html && firefox _build/html/notmuch-emacs.html

The docs in doc/notmuch-emacs.rst are sortof "semi-automated"; in
cheerful violation of Emacs documentation standards they use the
function docstrings in the manual.

At least the customize can be added, and if it makes sense with our
current level of indecision, the function could be added also (although
the docs are user focused, so they mainly talk about keybindings).

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


Re: [PATCH] config: allow custom separators in author lists

2024-07-26 Thread David Bremner
Lars Kotthoff  writes:

> Thanks David, I've attached the modified patch that I think addresses
> all your comments -- I'm still not 100% sure about the whitespace
> though.

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


Re: [PATCH 2/2] Add notmuch-search-show-or-unthread

2024-07-25 Thread David Bremner
Sandra Snan  writes:
>
> It shells out to notmuch count to see if the thread is big or small.
> "Big" is hardcoded to ten messages or lower, if we want to introduce a
> variable for that instead, that might be great.

Yes, I think a defcustom is called for.

>
> It's a deliberate choice to count all the messages in the thread, not
> just ones that are part of the search (a.k.a. the ones that will show
> up in the unthreaded view if the thread is big). The reason for that
> is that that's the number that matters when it comes to how well
> `notmuch-search-show-thread` can handle it. That's by design. So if
> there's a thread with 10 messages and four of them show up in the
> search (maybe because they have a particular tag or date), it'll see
> that the thread is big and "explode" it and then show those four new
> messages in a flat view.

Some of that explanation can maybe go in the docstring of the newly
defined customize variable
>  
> +(defun notmuch-search-show-or-unthread ()
> +  "If the thread is small, show it the normal notmuch way, and if
> +it's big, show the messages separatley in a buffer so you can
> +visit them individually."
> +  (interactive)
> +  (let ((thread-id (notmuch-search-find-thread-id)))
> +(if thread-id
> + (if (< 11 (notmuch-call-notmuch-sexp "count" thread-id))
> + (notmuch-search-unthread-thread)
> + (notmuch-search-show-thread))
emacs wants to indent this line differently, so please follow its lead here.

> +  (message "No such thread with that id found!")
> +  nil)))

I guess we should think about a default binding for this. One option is
to replace the default notmuch-search-show-thread binding, and just set
the threshhold very high so that most users will not notice the
change. There is a slight performance penalty from add notmuch count;
I'm not sure if this is noticable. 
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH 1/2] Add notmuch-search-unthread-thread

2024-07-25 Thread David Bremner
Sandra Snan  writes:

> +  (interactive "P")
> +  (let ((thread-id (notmuch-search-find-thread-id)))
> +(if thread-id
> + (notmuch-unthreaded (if entire thread-id
> +   (concat notmuch-search-query-string " and " 
> thread-id)))
> +  (message "No such thread with that id found!")
> +  nil)))
> +

Hi Sandra;

This seems reasonable enough. Two questions

1) can you make a test (probably something in T465 can serve as a model

2) Should this be bound by default, or is the function in the next patch
always the one users will want?
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH] Check for erroneous subjects

2024-07-25 Thread David Bremner
Tony Zorman  writes:

> Hi,
>
> this adds a new custom variable, `notmuch-mua-subject-regexp`, and an
> associated function, `notmuch-mua-subject-check`, to warn the user when
> the subject contains potentially troublesome things (e.g., nothing at
> all). The idea is the same as `notmuch-mua-attachment-regexp`—which has
> saved my skin quite a few times in the past—but for the subject instead
> of an attachment. By default, it checks for empty subjects, as that
> seems to be a reasonable thing to safeguard against.

Applied to master. Thanks for writing such nice tests.

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


Re: [PATCH v2 2/2] lib: thread-safe s-expression query parser

2024-07-25 Thread David Bremner
Kevin Boulain  writes:

> Follow-up of 6273966d, now that sfsexp 1.4.1 doesn't rely on globals
> anymore by default (https://github.com/mjsottile/sfsexp/issues/21).
>
> This simply defers the initial query generation to use the thread-safe
> helper (xapian_query_match_all) instead of Xapian::Query::MatchAll.

I squashed to the two commits together, so the test is now
more like a regression test. While the testing situation is not ideal,
this is an improvement on the status quo, so I've applied the change to
master.
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH] emacs/hello: refresh hello directly

2024-07-25 Thread David Bremner
David Bremner  writes:

> According to the now deleted commentary, the hack of using run-at-time
> was needed for Emacs 24. It seems to be no longer needed for Emacs
> 28.2, and removing it makes further changes to the code simpler.

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


Re: [PATCH] CLI/git: add reset command

2024-07-25 Thread David Bremner
David Bremner  writes:

> Sometimes merging is not what we want with tags; in particular it
> tends to keep tags in the local repo that have been removed elsewhere.
> This commit provides a new reset command; the reset itself is trivial,
> but the work is to provide a safety check that uses the existing
> --force and git.safe_fraction machinery.

Applied to master. Although I did not receive any feedback, I have been
using this code myself for a while now.

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


Re: [PATCH] config: allow custom separators in author lists

2024-07-25 Thread David Bremner
Lars Kotthoff  writes:

> Sorry, I dropped the ball on this -- here's the patch again with space/tab 
> inconsistencies fixed. I wasn't entirely sure about this as it's inconsistent 
> in the existing source, so I tried to make it as consistent as possible. 
> Cover included again below.
>

Hi Lars,

Thanks for sticking with this, and sorry I did not respond to the first
thread. There are still one or two minor whitespace issues.  If you have
"uncrustify" installed, then ./devel/check-notmuch-commit && git diff
will find the ones I'm thinking of. You can ignore the problems you
didn't introduce.

> The attached patch allows to customize the default ", " and "| "
> separators in author lists. The main rationale for supporting this is
> that the Python API uses the same functionality to get the list of
> authors -- if I want to separate them again afterwards, I have to
> split the returned string, which is error-prone with comma separators
> (e.g. name in email address is of form Lastname, Firstname).

Can you add a brief summary of the motivation to the commit message?

>  test/T030-config.sh |  2 ++
>  test/T055-path-config.sh|  4 
>  test/T590-libconfig.sh  | 10 ++

Thanks for adjusting the existing test suite.

Can you also add a simple test to check the functionality you
introduced? Testing the CLI is fine, or if you prefer something in the
style of test/T590-libconfig.sh
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: Editing the raw mail file?

2024-07-10 Thread David Bremner
Morten Kjeldgaard  writes:
> I would love to have just one function that carries out both tasks,
> opening the file in a temporary buffer, and after you finish with C-c
> C-c, it automatically does the reindexing for you. Unfortunately it's
> above my current Elisp skills to write this.
>

Maybe something like the re-edit draft as new interface (e), although
allowing arbitrary edits is a bit of a footgun, so we'd probably want to
make people confirm "are you sure, this could destroy your message" or
similar. I'm too far behind to do this myself, but I'll (eventually)
look at patches if someone wants to work something up.

d

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


Re: Editing the raw mail file?

2024-07-09 Thread David Bremner
Morten Kjeldgaard  writes:

>
> It's tedious to use the notmuch CLI client to search for the mail and
> then copy/paste the filename, and edit it to correct the date. It would
> be so much easier if it were possible to edit the raw file directly in
> Emacs. I can use 'V' to view the raw file, and then 'E' to be allowed to
> edit it, but Emacs has no idea of what file it is editing.
>
> Is there a way to solve this problem? Notmuch of course already knows
> the original filename.

you can use "c F" to copy the file name of the current message into the
the kill ring, then just yank wherever useful (e.g. to visit the file in
emacs).

After editing you will need to reindex that file. One way would be
to use "c i" to copy the message id into the kill ring, then yank it
into a shell command like

 notmuch reindex id:

If that seems to do what you want, then the steps can be automated
within emacs.

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


Re: Error when running notmuch new

2024-06-28 Thread David Bremner
Aidan Jones  writes:


>> 
>> This is the only line that caught my eye.
>> 
>> Can you try
>> 
>> $ notmuch config set maildir.synchronize_flags true
>
> That did it. Thanks for the help!

Glad to hear it. We should try to provide a more informative error
message here.

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


Re: Error when running notmuch new

2024-06-27 Thread David Bremner
Aidan Jones  writes:


> maildir.synchronize_flags=sync

This is the only line that caught my eye.

Can you try

$ notmuch config set maildir.synchronize_flags true

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


Re: Error when running notmuch new

2024-06-26 Thread David Bremner
Aidan Jones  writes:

> I am new to notmuch, so I apologize if this is just an operator
> error. I have a local maildir created using offlineimap. I have ran
> notmuch setup and configured notmuch to use the maildir as its
> archive. However, running notmuch new returns 'notmuch new: Illegal
> argument for function' Any ideas what I am doing wrong?

Can you share your configuration? It sounds like it might be a bad
regex.

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


Re: Selection bug

2024-06-19 Thread David Bremner
David Bremner  writes:

>
> This reproduces the problem for me. Indeed it looks a bit like a similar
> "cursor jumping" problem I have seen (and someone else has reported on
> IRC). I will see if I can figure anything more out now that I have a
> reproducer.

I think the following is a (simpler) reproducer of the same problem.

1) Do a search with at least 10 results

2) goto line 10

3) hit 'g'

For me this consistently leaves the point on line 10 but the hl-line bar
on line 1. I have not debugged it yet, but the proximate cause is that
when notmuch-hl-line-mode is called, (point) is 1, so the bar ends up on
the first line. The whys and wherefores I don't know yet.


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


Re: [PATCH v2 2/2] Replace `delete-line` with its definition

2024-06-19 Thread David Bremner
michaeljgruber+grubix+...@gmail.com writes:

> From: Michael J Gruber 
>
> 37c022ae ("Use `without-restriction` in 
> `with-temporary-notmuch-message-buffer`", 2024-03-14)
> introduced `delete-line` in a test, but this is Emacs 29 and above only.
> Replace it with its (almost) definition.

both v2 patches applied to master.

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


Re: [PATCH v2 2/2] Replace `delete-line` with its definition

2024-06-17 Thread David Bremner
michaeljgruber+grubix+...@gmail.com writes:

> From: Michael J Gruber 
>
> 37c022ae ("Use `without-restriction` in 
> `with-temporary-notmuch-message-buffer`", 2024-03-14)
> introduced `delete-line` in a test, but this is Emacs 29 and above only.
> Replace it with its (almost) definition.

The changes look reasonable to me. But so did the last ones ;P. Any
feedback Marc?
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: notmuch.el, needs without-restriction to properly save draft

2024-06-17 Thread David Bremner
Marc Fargas  writes:

> Hi,
>
> El lun. 17 de jun. 2024, Marc escribió:
>>
>> El lun. 17 de jun. 2024, Michael escribió:
 (...)
>>>
>>> Does this depend on emacs version by any chance, i.e. is
>>> `without-restriction` defined on all emacsen? In Fedora's copr
>>> infrastructure, all builds succeed but some tests fail with
>>> `Symbol'€™s function definition is void: without-restriction`. The
>>> picture is the following:
>
> So, I will have to update the patch in order to make the use of
> `without-restriction` conditional on its availability.
>
> I asked on Emacs chat @ Matrix on how to do this nicely and yantar92
> (org contributor) proposed the following macro:
>
>(defmacro notmuch--without-restriction (&rest body)
>  "Run BODY within `without-restriction', when it is available."
>  (declare (debug (body)))
>  (if (fboundp 'without-restriction)
>  `(without-restriction ,@body)
>`(progn ,@body)))

Assuming fboundp works for macros (without-restriction is a macro), then
sure
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: notmuch.el, needs without-restriction to properly save draft

2024-06-17 Thread David Bremner
David Bremner  writes:

> Marc Fargas  writes:
>
>> Hi,
>>
>> El lun. 17 de jun. 2024, Michael escribió:
>>>> (...)
>>>
>>> Does this depend on emacs version by any chance, i.e. is
>>> `without-restriction` defined on all emacsen? In Fedora's copr
>>> infrastructure, all builds succeed but some tests fail with
>>> `Symbol'€™s function definition is void: without-restriction`. The
>>> picture is the following:
>>
>> Apparently it was introduced in Emacs 29[1]. Strange that tests pass at
>> all on previous versions.
>>
>> What is the earliest Emacs version supported by notmuch? I can't find
>> any specific version in notmuch documentation.
>
> According to the docs, it is supposed to work with 25.1. Personally I
> would be fine updating this to 26.x or 27.x, but of course that won't
> help you here.

Using "docs", loosly here. This is the most recent announcement in NEWS,
which matches emacs/notmuch-pkg.el.tmpl
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: notmuch.el, needs without-restriction to properly save draft

2024-06-17 Thread David Bremner
Marc Fargas  writes:

> Hi,
>
> El lun. 17 de jun. 2024, Michael escribió:
>>> (...)
>>
>> Does this depend on emacs version by any chance, i.e. is
>> `without-restriction` defined on all emacsen? In Fedora's copr
>> infrastructure, all builds succeed but some tests fail with
>> `Symbol'€™s function definition is void: without-restriction`. The
>> picture is the following:
>
> Apparently it was introduced in Emacs 29[1]. Strange that tests pass at
> all on previous versions.
>
> What is the earliest Emacs version supported by notmuch? I can't find
> any specific version in notmuch documentation.

According to the docs, it is supposed to work with 25.1. Personally I
would be fine updating this to 26.x or 27.x, but of course that won't
help you here.
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: notmuch.el, needs without-restriction to properly save draft

2024-06-15 Thread David Bremner
Marc Fargas  writes:

> Hi again,
>
> El dom. 24 de mar. 2024, Marc escribió:
>> El mié. 13 de mar. 2024, Carl escribió:
>>> (...)
>>> Could you put your fix together in the form of a git-appliable patch?
>>> Such as by applying it to the notmuch source, running `git commit` and
>>> then `git format-patch HEAD~` or similar.
>>
>> Please disregard the previous patch, consider the one attached
>> here. Hope I did the "format-patch" thing properly.
>>
>> I had to move the `without-restriction` call to the top of the
>> `with-temporary-notmuch-message-buffer` defmacro. It does work properly
>> now.

Applied to master. Sorry for the long-ish silence.

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


Re: [PATCH] test/cli: Add known broken test for (missing) quoting in From

2024-06-15 Thread David Bremner
David Bremner  writes:

> In [1], Jakub Wilk observes that the current behaviour is confusing
> since it looks like there are two mailboxes in From, while in fact
> there is only one.  It seems to me that notmuch should at least quote
> the display-name part of a mailbox if it has "funny" characters in it,
> and perhaps always quote it. Either way will require changing the
> indexing code, since the structure is lost when writing the headers to
> the database.
>

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


Re: Emacs: text/calendar rendering fix

2024-06-15 Thread David Bremner
David Bremner  writes:

> The actual fix here is quite trivial, but it takes some work to test.
> Compared to the previous version in the thread at [1], this updates
> the 3rd patch in the series to actually duplicate the problem, and
> adds the 4th patch with the actual fix.
>
> [1]: id:m2wmneguh8@gmail.com

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


Re: desktop file to open mailto URLs in Emacs notmuch-message-mode

2024-06-13 Thread David Bremner
Arun Isaac  writes:

> This is a feature request.
>
> Emacs comes with emacs-mail.desktop and emacsclient-mail.desktop files
> that allows opening mailto URLs in message-mode. Can we provide similar
> desktop files for notmuch-emacs so that one can open mailto URLs in
> notmuch-message-mode?

There is emacs/notmuch-mua-mail.desktop in the source. This seems to do
what you ask for?
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: How to disable image and PDF preview in emacs notmuch-show buffer?

2024-06-11 Thread David Bremner
Viktor Larkin  writes:

> Hello, David. Seems like I've got it wrong. Could you please provide an
> example of how I should change mm-inline-override-types? I've tried this
> way
>
> (setq mm-inline-override-types '("image/.*"))
>
> It didn't work as I expect it to. I still see images in notmuch-show
> buffer as images, not as attachments.

I used M-x customize variable and your example worked fine for me. I
guess you will either need to use customize or find the right
incantation (setq-default maybe, but I did not test it).

Hope this helps

d

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


Re: [PATCH] emacs: Autoload notmuch-user-agent related functions

2024-06-10 Thread David Bremner
Jelle Licht  writes:

> Thanks for applying the patch, but I just noticed I made a mistake; each
> of the lines now have a ";;;#autoload" comment, instead of the proper
> ";;;###autoload" cookie. My apologies. Should I send a patch fixing
> this, or will you push a fix yourself?

Please send a patch, thanks

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


Re: How to disable image and PDF preview in emacs notmuch-show buffer?

2024-06-07 Thread David Bremner
curiousbarbar...@posteo.net writes:

> Hello.
>
> Is it possible to disable preview of images and PDF files in 
> notmuch-show buffer in emacs? I've tried to set gnus-inhibit-image to t, 
> but it looks like it doesn't affect previewing. Any possible built-in 
> solutions?
>
> Emacs 29.2
> notmuch 0.37

Try customizing mm-inline-override-types. Note that notmuch normally
adds "application/.*" to this, but won't if you customize it, so you may
want to add in to your list.

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


tags starting with / are effectively forbidden

2024-06-06 Thread David Bremner


Via ukleink on IRC

% notmuch tag --batch
+/foo -- id:87edveqpj6@tethera.net
notmuch tag: A Xapian exception occurred
A Xapian exception occurred parsing query: unmatched regex delimiter in 
'/foo'
Query string was: ( id:87edveqpj6@tethera.net ) and (not tag:/foo)

% notmuch tag +/foo -- id:87edveqpj6@tethera.net
notmuch tag: A Xapian exception occurred
A Xapian exception occurred parsing query: unmatched regex delimiter in 
'/foo'
Query string was: ( id:87edveqpj6@tethera.net ) and (not tag:/foo)

The problem here is the implicit query to avoid re-tagging things
already tagged /foo. There is some unfortunate use of strings to
construct a query in notmuch-tag.c. This string is parsed by same parser
as other notmuch queries, which means it attempts to support regexes.
In retrospect using strings to construct queries is pretty obviously a
bad idea, but we don't currently have a C API for constructing queries.
The closest is the sexp parse, but this would still require constructing
a serialized query (as a sexp) and then parsing it again.

Some potential solutions (roughly in order of effort and flexibility) include

- pushing the query optimization code inside libnotmuch, using the
  Xapian API directly. This has the advantage that it makes it available
  to all bindings users.

- extend the notmuch_query API to allow updating the underlying
  query using some operator and a single term, something like

  notmuch_query_modify(query, NOTMUCH_OP_ANDNOT, "tag", "/foo")

- providing a low level wrapper around Xapian::Query, taking care of
  translating prefixes.

  At the moment I think only this last would allow the elimination of
  constructing strings in the CLI code to pass to libnotmuch.

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


Re: Selection bug

2024-06-05 Thread David Bremner
Justus Winter  writes:

> David Bremner  writes:
>
> Uh, you are right.  I meant to pick mails form notmuch@, but this one is
> from another list.  I actually reduced the example further:
>
> mkdir -p /tmp/selection-bug/{tmp,new,cur}
> echo "[database]
> path=/tmp/selection-bug" > /tmp/selection-bug/notmuch-config
> NOTMUCH_CONFIG=/tmp/selection-bug/notmuch-config notmuch new
> NOTMUCH_CONFIG=/tmp/selection-bug/notmuch-config emacs -q --eval "(require 
> 'notmuch)"
> # M-x notmuch-hello, search for '*'
> notmuch show --format=raw id:87edvlanuh@tethera.net | 
> NOTMUCH_CONFIG=/tmp/selection-bug/notmuch-config notmuch insert
> # refresh search buffer, press down once, i.e. navigate to "End of search 
> results".
> notmuch show --format=raw id:87fsfuuxwn.fsf@thinkbox | 
> NOTMUCH_CONFIG=/tmp/selection-bug/notmuch-config notmuch insert
> # refresh search buffer, bug: your mail is green, mine is opened on pressing 
> enter

This reproduces the problem for me. Indeed it looks a bit like a similar
"cursor jumping" problem I have seen (and someone else has reported on
IRC). I will see if I can figure anything more out now that I have a
reproducer.

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


Re: [PATCH] emacs: Allow customizing :excluded in notmuch-saved-searches

2024-05-29 Thread David Bremner
mohk...@kisara.moe writes:

> From: Mohsin Kaleem 
>

applied to master, with a slightly expanded commit message.

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


Re: [PATCH 1/4] test: re-enable duplicate UI tests in T460-emacs-tree

2024-05-29 Thread David Bremner
David Bremner  writes:

> These were disabled (accidentally?) in f63d14a8c12a.
> ---
>  test/T460-emacs-tree.sh | 2 --
>  1 file changed, 2 deletions(-)

applied to master.

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


[PATCH 2/4] test/emacs: add regression test for display of calendar parts.

2024-05-29 Thread David Bremner
This will hopefully catch breakage due to either changes in
Emacs (especially Gnus) or changes to the notmuch-show code.
---
 test/T450-emacs-show.sh | 22 ++
 1 file changed, 22 insertions(+)

diff --git a/test/T450-emacs-show.sh b/test/T450-emacs-show.sh
index 559df8aa..438a7b9b 100755
--- a/test/T450-emacs-show.sh
+++ b/test/T450-emacs-show.sh
@@ -318,6 +318,28 @@ test_expect_equal "$(cat MESSAGES)" "COMPLETE"
 
 add_email_corpus attachment
 
+test_begin_subtest "display of text/calendar"
+test_emacs '(let ((notmuch-show-all-multipart/alternative-parts t))
+  (notmuch-show 
"id:yt3pr01mb10572efc9f7c81f9446214768ce...@yt3pr01mb10572.canprd01.prod.outlook.com"))
+   (test-visible-output "OUTPUT")'
+cat < EXPECTED
+David Bremner  (1970-01-01) (inbox)
+Subject: test
+To: "da...@tethera.net" 
+Date: Thu, 01 Jan 1970 00:00:00 +
+
+[ multipart/alternative ]
+[ text/plain ]
+This meeting will could have been an email
+[ text/calendar ]
+%%(and (diary-cyclic 1 5 27 2024) (diary-block 5 27 2024 8 27 2024)) 
17:00-17:30 test [In-person]
+ Desc: This meeting will could have been an email
+
+
+ Organizer: mailto:brem...@example.com
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
 test_begin_subtest "tar not inlined by default"
 test_emacs '(notmuch-show "id:874llc2bkp@curie.anarc.at")
(test-visible-output "OUTPUT")'
-- 
2.43.0

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


[PATCH 4/4] emacs/show: fix for text/calendar display

2024-05-29 Thread David Bremner
In certain scenarios involving symlinks and setting
find-file-visit-truename, text/calendar parts were not displayed
properly.

Following a suggestion of Al Haji-Ali [1], replace the use of
get-file-buffer with find-buffer-visiting.

[1]: id:m2wmneguh8@gmail.com
---
 emacs/notmuch-show.el   | 2 +-
 test/T450-emacs-show.sh | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 4c0ad74d..14e3c698 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -864,7 +864,7 @@ will return nil if the CID is unknown or cannot be 
retrieved."
(unless (icalendar-import-buffer file t)
  (error "Icalendar import error. %s"
 "See *icalendar-errors* for more information"))
-   (set-buffer (get-file-buffer file))
+   (set-buffer (find-buffer-visiting file))
(setq result (buffer-substring (point-min) (point-max)))
(set-buffer-modified-p nil)
(kill-buffer (current-buffer)))
diff --git a/test/T450-emacs-show.sh b/test/T450-emacs-show.sh
index 027062cd..7c6a946a 100755
--- a/test/T450-emacs-show.sh
+++ b/test/T450-emacs-show.sh
@@ -341,7 +341,6 @@ EOF
 test_expect_equal_file EXPECTED OUTPUT
 
 test_begin_subtest "display of text/calendar, symlinked tmpdir"
-test_subtest_known_broken
 mkdir real-tmp
 ln -s real-tmp tmp
 test_emacs "(let ((notmuch-show-all-multipart/alternative-parts t)
-- 
2.43.0

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


[PATCH 3/4] test/emacs: add tests for rendering text/calendar parts

2024-05-29 Thread David Bremner
The first test is just a general regression test, while the second
duplicates the problem discussed in the thread starting at [1].

[1]: id:m2leo2u0uo@gmail.com
---
 test/T450-emacs-show.sh | 27 +++
 1 file changed, 27 insertions(+)

diff --git a/test/T450-emacs-show.sh b/test/T450-emacs-show.sh
index 438a7b9b..027062cd 100755
--- a/test/T450-emacs-show.sh
+++ b/test/T450-emacs-show.sh
@@ -340,6 +340,33 @@ This meeting will could have been an email
 EOF
 test_expect_equal_file EXPECTED OUTPUT
 
+test_begin_subtest "display of text/calendar, symlinked tmpdir"
+test_subtest_known_broken
+mkdir real-tmp
+ln -s real-tmp tmp
+test_emacs "(let ((notmuch-show-all-multipart/alternative-parts t)
+ (temporary-file-directory \"tmp\")
+ (find-file-visit-truename t))
+(notmuch-show 
\"id:yt3pr01mb10572efc9f7c81f9446214768ce...@yt3pr01mb10572.canprd01.prod.outlook.com\"))
+   (test-visible-output \"OUTPUT\")"
+cat < EXPECTED
+David Bremner  (1970-01-01) (inbox)
+Subject: test
+To: "da...@tethera.net" 
+Date: Thu, 01 Jan 1970 00:00:00 +
+
+[ multipart/alternative ]
+[ text/plain ]
+This meeting will could have been an email
+[ text/calendar ]
+%%(and (diary-cyclic 1 5 27 2024) (diary-block 5 27 2024 8 27 2024)) 
17:00-17:30 test [In-person]
+ Desc: This meeting will could have been an email
+
+
+ Organizer: mailto:brem...@example.com
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
 test_begin_subtest "tar not inlined by default"
 test_emacs '(notmuch-show "id:874llc2bkp@curie.anarc.at")
(test-visible-output "OUTPUT")'
-- 
2.43.0

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


[PATCH 1/4] test/corpora: add example with text/calendar attachment

2024-05-29 Thread David Bremner
Initially for testing rendering in Emacs.
---
 test/corpora/attachment/text-calendar.eml | 55 +++
 1 file changed, 55 insertions(+)
 create mode 100644 test/corpora/attachment/text-calendar.eml

diff --git a/test/corpora/attachment/text-calendar.eml 
b/test/corpora/attachment/text-calendar.eml
new file mode 100644
index ..8e064f9b
--- /dev/null
+++ b/test/corpora/attachment/text-calendar.eml
@@ -0,0 +1,55 @@
+From: David Bremner 
+To: "da...@tethera.net" 
+Subject: test
+Date: Thu Jan 01 00:00:10 +
+Message-ID:
+ 

+Accept-Language: en-CA, en-US
+Content-Language: en-CA
+Content-Type: multipart/alternative;
+   boundary="_000_YT3PR01MB10572EFC9F7C81F9446214768CEF72YT3PR01MB10572CA_"
+MIME-Version: 1.0
+
+--_000_YT3PR01MB10572EFC9F7C81F9446214768CEF72YT3PR01MB10572CA_
+Content-Type: text/plain; charset="iso-8859-1"
+Content-Transfer-Encoding: quoted-printable
+
+This meeting will could have been an email
+
+
+--_000_YT3PR01MB10572EFC9F7C81F9446214768CEF72YT3PR01MB10572CA_
+Content-Type: text/calendar; charset="utf-8"; method=REQUEST
+Content-Transfer-Encoding: base64
+
+QkVHSU46VkNBTEVOREFSDQpNRVRIT0Q6UkVRVUVTVA0KUFJPRElEOk1pY3Jvc29mdCBFeGNoYW5n
+ZSBTZXJ2ZXIgMjAxMA0KVkVSU0lPTjoyLjANCkJFR0lOOlZUSU1FWk9ORQ0KVFpJRDpBdGxhbnRp
+YyBTdGFuZGFyZCBUaW1lDQpCRUdJTjpTVEFOREFSRA0KRFRTVEFSVDoxNjAxMDEwMVQwMjAwMDAN
+ClRaT0ZGU0VURlJPTTotMDMwMA0KVFpPRkZTRVRUTzotMDQwMA0KUlJVTEU6RlJFUT1ZRUFSTFk7
+SU5URVJWQUw9MTtCWURBWT0xU1U7QllNT05USD0xMQ0KRU5EOlNUQU5EQVJEDQpCRUdJTjpEQVlM
+SUdIVA0KRFRTVEFSVDoxNjAxMDEwMVQwMjAwMDANClRaT0ZGU0VURlJPTTotMDQwMA0KVFpPRkZT
+RVRUTzotMDMwMA0KUlJVTEU6RlJFUT1ZRUFSTFk7SU5URVJWQUw9MTtCWURBWT0yU1U7QllNT05U
+SD0zDQpFTkQ6REFZTElHSFQNCkVORDpWVElNRVpPTkUNCkJFR0lOOlZFVkVOVA0KT1JHQU5JWkVS
+O0NOPURhdmlkIEJyZW1uZXI6bWFpbHRvOmJyZW1uZXJAZXhhbXBsZS5jb20NCkFUVEVOREVFO1JP
+TEU9UkVRLVBBUlRJQ0lQQU5UO1BBUlRTVEFUPU5FRURTLUFDVElPTjtSU1ZQPVRSVUU7Q049ZGF2
+aWRAdGV0aA0KIGVyYS5uZXQ6bWFpbHRvOmRhdmlkQHRldGhlcmEubmV0DQpERVNDUklQVElPTjtM
+QU5HVUFHRT1lbi1DQTpUaGlzIG1lZXRpbmcgd2lsbCBjb3VsZCBoYXZlIGJlZW4gYW4gZW1haWxc
+blxuDQpSUlVMRTpGUkVRPURBSUxZO1VOVElMPTIwMjQwODI3VDE3MDAwMFo7SU5URVJWQUw9MQ0K
+VUlEOjA0MDAwMDAwODIwMEUwMDA3NEM1QjcxMDFBODJFMDA4MDAwMDAwMDAwRUE4NDFFNzk5QUZE
+QTAxMDAwMDAwMDAwMDAwMDAwDQogMDEwMDAwMDAwNjkyRkRFNzQzMzNGQ0I0N0JFNEY0REU5MDk0
+OThDQkUNClNVTU1BUlk7TEFOR1VBR0U9ZW4tQ0E6dGVzdCBbSW4tcGVyc29uXQ0KRFRTVEFSVDtU
+WklEPUF0bGFudGljIFN0YW5kYXJkIFRpbWU6MjAyNDA1MjdUMTQwMDAwDQpEVEVORDtUWklEPUF0
+bGFudGljIFN0YW5kYXJkIFRpbWU6MjAyNDA1MjdUMTQzMDAwDQpDTEFTUzpQVUJMSUMNClBSSU9S
+SVRZOjUNCkRUU1RBTVA6MjAyNDA1MjZUMTgyNDEwWg0KVFJBTlNQOk9QQVFVRQ0KU1RBVFVTOkNP
+TkZJUk1FRA0KU0VRVUVOQ0U6MA0KTE9DQVRJT047TEFOR1VBR0U9ZW4tQ0E6DQpYLU1JQ1JPU09G
+VC1DRE8tQVBQVC1TRVFVRU5DRTowDQpYLU1JQ1JPU09GVC1DRE8tT1dORVJBUFBUSUQ6MjEyMjcw
+MDA0Ng0KWC1NSUNST1NPRlQtQ0RPLUJVU1lTVEFUVVM6VEVOVEFUSVZFDQpYLU1JQ1JPU09GVC1D
+RE8tSU5URU5ERURTVEFUVVM6QlVTWQ0KWC1NSUNST1NPRlQtQ0RPLUFMTERBWUVWRU5UOkZBTFNF
+DQpYLU1JQ1JPU09GVC1DRE8tSU1QT1JUQU5DRToxDQpYLU1JQ1JPU09GVC1DRE8tSU5TVFRZUEU6
+MQ0KWC1NSUNST1NPRlQtRE9OT1RGT1JXQVJETUVFVElORzpGQUxTRQ0KWC1NSUNST1NPRlQtRElT
+QUxMT1ctQ09VTlRFUjpGQUxTRQ0KWC1NSUNST1NPRlQtUkVRVUVTVEVEQVRURU5EQU5DRU1PREU6
+SU5QRVJTT05SRVFVSVJFRA0KWC1NSUNST1NPRlQtSVNSRVNQT05TRVJFUVVFU1RFRDpUUlVFDQpY
+LU1JQ1JPU09GVC1MT0NBVElPTlM6W10NCkJFR0lOOlZBTEFSTQ0KREVTQ1JJUFRJT046UkVNSU5E
+RVINClRSSUdHRVI7UkVMQVRFRD1TVEFSVDotUFQxNU0NCkFDVElPTjpESVNQTEFZDQpFTkQ6VkFM
+QVJNDQpFTkQ6VkVWRU5UDQpFTkQ6VkNBTEVOREFSDQo=
+
+--_000_YT3PR01MB10572EFC9F7C81F9446214768CEF72YT3PR01MB10572CA_--
-- 
2.43.0

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


Emacs: text/calendar rendering fix

2024-05-29 Thread David Bremner
The actual fix here is quite trivial, but it takes some work to test.
Compared to the previous version in the thread at [1], this updates
the 3rd patch in the series to actually duplicate the problem, and
adds the 4th patch with the actual fix.

[1]: id:m2wmneguh8@gmail.com
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH 3/3] WIP/test: add tests for rendering text/calendar parts

2024-05-28 Thread David Bremner
Al Haji-Ali  writes:

>
> On my setup (MacOS, Emacs 29.1) this prints something like
>
> ,
> | Filename: /Users/al/link-tmp/notmuch-ical7MtHvd
> | get-file-buffer: nil
> | find-buffer-visiting: #
> | buffer-file-name: /private/tmp/notmuch-ical7MtHvd
> `

Here it prints

Filename: /home/bremner/link-tmp/notmuch-icalDC01xk
get-file-buffer: #
find-buffer-visiting: #
buffer-file-name: /home/bremner/link-tmp/notmuch-icalDC01xk

So I guess this is some system dependent (or emacs dependent; I have
29.3 here) behaviour. I can convert the test to a regression test after
the change is applied. It's not as nice, but it's better than not
testing it at all.
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: emacs warnings related to notmuch

2024-05-26 Thread David Bremner
Daniel Kahn Gillmor  writes:

> Hey notmuch folks--
>
> when i launch emacs these days i see the following in my *Warnings*
> buffer:
>
> Warning (comp): notmuch-hello.el:719:22: Warning: docstring wider than 80 
> characters Disable showing Disable logging
> Warning (comp): notmuch-hello.el:855:8: Warning: docstring wider than 80 
> characters Disable showing Disable logging
> Warning (comp): notmuch-hello.el:489:15: Warning: the function 
> ‘notmuch-search-format-buffer-name’ is not known to be defined. Disable 
> showing Disable logging
> Warning (comp): notmuch-show.el:2479:8: Warning: docstring wider than 80 
> characters Disable showing Disable logging

These should be fixed in the next (major) release of notmuch, i.e. 0.39
and not 0.38.4 (if the latter happens).

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


[PATCH 1/3] test/corpora: add example with text/calendar attachment

2024-05-26 Thread David Bremner
Initially for testing rendering in Emacs.
---
 test/corpora/attachment/text-calendar.eml | 55 +++
 1 file changed, 55 insertions(+)
 create mode 100644 test/corpora/attachment/text-calendar.eml

diff --git a/test/corpora/attachment/text-calendar.eml 
b/test/corpora/attachment/text-calendar.eml
new file mode 100644
index ..8e064f9b
--- /dev/null
+++ b/test/corpora/attachment/text-calendar.eml
@@ -0,0 +1,55 @@
+From: David Bremner 
+To: "da...@tethera.net" 
+Subject: test
+Date: Thu Jan 01 00:00:10 +
+Message-ID:
+ 

+Accept-Language: en-CA, en-US
+Content-Language: en-CA
+Content-Type: multipart/alternative;
+   boundary="_000_YT3PR01MB10572EFC9F7C81F9446214768CEF72YT3PR01MB10572CA_"
+MIME-Version: 1.0
+
+--_000_YT3PR01MB10572EFC9F7C81F9446214768CEF72YT3PR01MB10572CA_
+Content-Type: text/plain; charset="iso-8859-1"
+Content-Transfer-Encoding: quoted-printable
+
+This meeting will could have been an email
+
+
+--_000_YT3PR01MB10572EFC9F7C81F9446214768CEF72YT3PR01MB10572CA_
+Content-Type: text/calendar; charset="utf-8"; method=REQUEST
+Content-Transfer-Encoding: base64
+
+QkVHSU46VkNBTEVOREFSDQpNRVRIT0Q6UkVRVUVTVA0KUFJPRElEOk1pY3Jvc29mdCBFeGNoYW5n
+ZSBTZXJ2ZXIgMjAxMA0KVkVSU0lPTjoyLjANCkJFR0lOOlZUSU1FWk9ORQ0KVFpJRDpBdGxhbnRp
+YyBTdGFuZGFyZCBUaW1lDQpCRUdJTjpTVEFOREFSRA0KRFRTVEFSVDoxNjAxMDEwMVQwMjAwMDAN
+ClRaT0ZGU0VURlJPTTotMDMwMA0KVFpPRkZTRVRUTzotMDQwMA0KUlJVTEU6RlJFUT1ZRUFSTFk7
+SU5URVJWQUw9MTtCWURBWT0xU1U7QllNT05USD0xMQ0KRU5EOlNUQU5EQVJEDQpCRUdJTjpEQVlM
+SUdIVA0KRFRTVEFSVDoxNjAxMDEwMVQwMjAwMDANClRaT0ZGU0VURlJPTTotMDQwMA0KVFpPRkZT
+RVRUTzotMDMwMA0KUlJVTEU6RlJFUT1ZRUFSTFk7SU5URVJWQUw9MTtCWURBWT0yU1U7QllNT05U
+SD0zDQpFTkQ6REFZTElHSFQNCkVORDpWVElNRVpPTkUNCkJFR0lOOlZFVkVOVA0KT1JHQU5JWkVS
+O0NOPURhdmlkIEJyZW1uZXI6bWFpbHRvOmJyZW1uZXJAZXhhbXBsZS5jb20NCkFUVEVOREVFO1JP
+TEU9UkVRLVBBUlRJQ0lQQU5UO1BBUlRTVEFUPU5FRURTLUFDVElPTjtSU1ZQPVRSVUU7Q049ZGF2
+aWRAdGV0aA0KIGVyYS5uZXQ6bWFpbHRvOmRhdmlkQHRldGhlcmEubmV0DQpERVNDUklQVElPTjtM
+QU5HVUFHRT1lbi1DQTpUaGlzIG1lZXRpbmcgd2lsbCBjb3VsZCBoYXZlIGJlZW4gYW4gZW1haWxc
+blxuDQpSUlVMRTpGUkVRPURBSUxZO1VOVElMPTIwMjQwODI3VDE3MDAwMFo7SU5URVJWQUw9MQ0K
+VUlEOjA0MDAwMDAwODIwMEUwMDA3NEM1QjcxMDFBODJFMDA4MDAwMDAwMDAwRUE4NDFFNzk5QUZE
+QTAxMDAwMDAwMDAwMDAwMDAwDQogMDEwMDAwMDAwNjkyRkRFNzQzMzNGQ0I0N0JFNEY0REU5MDk0
+OThDQkUNClNVTU1BUlk7TEFOR1VBR0U9ZW4tQ0E6dGVzdCBbSW4tcGVyc29uXQ0KRFRTVEFSVDtU
+WklEPUF0bGFudGljIFN0YW5kYXJkIFRpbWU6MjAyNDA1MjdUMTQwMDAwDQpEVEVORDtUWklEPUF0
+bGFudGljIFN0YW5kYXJkIFRpbWU6MjAyNDA1MjdUMTQzMDAwDQpDTEFTUzpQVUJMSUMNClBSSU9S
+SVRZOjUNCkRUU1RBTVA6MjAyNDA1MjZUMTgyNDEwWg0KVFJBTlNQOk9QQVFVRQ0KU1RBVFVTOkNP
+TkZJUk1FRA0KU0VRVUVOQ0U6MA0KTE9DQVRJT047TEFOR1VBR0U9ZW4tQ0E6DQpYLU1JQ1JPU09G
+VC1DRE8tQVBQVC1TRVFVRU5DRTowDQpYLU1JQ1JPU09GVC1DRE8tT1dORVJBUFBUSUQ6MjEyMjcw
+MDA0Ng0KWC1NSUNST1NPRlQtQ0RPLUJVU1lTVEFUVVM6VEVOVEFUSVZFDQpYLU1JQ1JPU09GVC1D
+RE8tSU5URU5ERURTVEFUVVM6QlVTWQ0KWC1NSUNST1NPRlQtQ0RPLUFMTERBWUVWRU5UOkZBTFNF
+DQpYLU1JQ1JPU09GVC1DRE8tSU1QT1JUQU5DRToxDQpYLU1JQ1JPU09GVC1DRE8tSU5TVFRZUEU6
+MQ0KWC1NSUNST1NPRlQtRE9OT1RGT1JXQVJETUVFVElORzpGQUxTRQ0KWC1NSUNST1NPRlQtRElT
+QUxMT1ctQ09VTlRFUjpGQUxTRQ0KWC1NSUNST1NPRlQtUkVRVUVTVEVEQVRURU5EQU5DRU1PREU6
+SU5QRVJTT05SRVFVSVJFRA0KWC1NSUNST1NPRlQtSVNSRVNQT05TRVJFUVVFU1RFRDpUUlVFDQpY
+LU1JQ1JPU09GVC1MT0NBVElPTlM6W10NCkJFR0lOOlZBTEFSTQ0KREVTQ1JJUFRJT046UkVNSU5E
+RVINClRSSUdHRVI7UkVMQVRFRD1TVEFSVDotUFQxNU0NCkFDVElPTjpESVNQTEFZDQpFTkQ6VkFM
+QVJNDQpFTkQ6VkVWRU5UDQpFTkQ6VkNBTEVOREFSDQo=
+
+--_000_YT3PR01MB10572EFC9F7C81F9446214768CEF72YT3PR01MB10572CA_--
-- 
2.43.0

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


[PATCH 2/3] test/emacs: add regression test for display of calendar parts.

2024-05-26 Thread David Bremner
This will hopefully catch breakage due to either changes in
Emacs (especially Gnus) or changes to the notmuch-show code.
---
 test/T450-emacs-show.sh | 22 ++
 1 file changed, 22 insertions(+)

diff --git a/test/T450-emacs-show.sh b/test/T450-emacs-show.sh
index 559df8aa..438a7b9b 100755
--- a/test/T450-emacs-show.sh
+++ b/test/T450-emacs-show.sh
@@ -318,6 +318,28 @@ test_expect_equal "$(cat MESSAGES)" "COMPLETE"
 
 add_email_corpus attachment
 
+test_begin_subtest "display of text/calendar"
+test_emacs '(let ((notmuch-show-all-multipart/alternative-parts t))
+  (notmuch-show 
"id:yt3pr01mb10572efc9f7c81f9446214768ce...@yt3pr01mb10572.canprd01.prod.outlook.com"))
+   (test-visible-output "OUTPUT")'
+cat < EXPECTED
+David Bremner  (1970-01-01) (inbox)
+Subject: test
+To: "da...@tethera.net" 
+Date: Thu, 01 Jan 1970 00:00:00 +
+
+[ multipart/alternative ]
+[ text/plain ]
+This meeting will could have been an email
+[ text/calendar ]
+%%(and (diary-cyclic 1 5 27 2024) (diary-block 5 27 2024 8 27 2024)) 
17:00-17:30 test [In-person]
+ Desc: This meeting will could have been an email
+
+
+ Organizer: mailto:brem...@example.com
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
 test_begin_subtest "tar not inlined by default"
 test_emacs '(notmuch-show "id:874llc2bkp@curie.anarc.at")
(test-visible-output "OUTPUT")'
-- 
2.43.0

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


[PATCH 3/3] WIP/test: add tests for rendering text/calendar parts

2024-05-26 Thread David Bremner
The second test should apparently fail, but it doesn't.
---
 test/T450-emacs-show.sh | 26 ++
 1 file changed, 26 insertions(+)

diff --git a/test/T450-emacs-show.sh b/test/T450-emacs-show.sh
index 438a7b9b..85851e70 100755
--- a/test/T450-emacs-show.sh
+++ b/test/T450-emacs-show.sh
@@ -340,6 +340,32 @@ This meeting will could have been an email
 EOF
 test_expect_equal_file EXPECTED OUTPUT
 
+test_begin_subtest "display of text/calendar, symlinked tmpdir"
+test_subtest_known_broken
+mkdir real-tmp
+ln -s real-tmp tmp
+test_emacs "(let ((notmuch-show-all-multipart/alternative-parts t)
+  (temporary-file-directory \"tmp\"))
+  (notmuch-show 
\"id:yt3pr01mb10572efc9f7c81f9446214768ce...@yt3pr01mb10572.canprd01.prod.outlook.com\"))
+   (test-visible-output \"OUTPUT\")"
+cat < EXPECTED
+David Bremner  (1970-01-01) (inbox)
+Subject: test
+To: "da...@tethera.net" 
+Date: Thu, 01 Jan 1970 00:00:00 +
+
+[ multipart/alternative ]
+[ text/plain ]
+This meeting will could have been an email
+[ text/calendar ]
+%%(and (diary-cyclic 1 5 27 2024) (diary-block 5 27 2024 8 27 2024)) 
17:00-17:30 test [In-person]
+ Desc: This meeting will could have been an email
+
+
+ Organizer: mailto:brem...@example.com
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
 test_begin_subtest "tar not inlined by default"
 test_emacs '(notmuch-show "id:874llc2bkp@curie.anarc.at")
(test-visible-output "OUTPUT")'
-- 
2.43.0

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


notmuch-show-insert-part-text/calendar

2024-05-26 Thread David Bremner
Dear Al;

I'm not able to reproduce the problem you mention. Can you try (or
look at) the tests in this series and see if the second one matches
the problem you are trying to fix?

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


Re: notmuch.el question: reading all messages in thread

2024-05-26 Thread David Bremner
Matt Armstrong  writes:

> Sometimes a notmuch query matches only a subset of messages in a thread.
> When this happens only that subset of messages will be "open".  Many
> notmuch commands operate on the "open" messages only.  For example: SPC,
> 'n', 'p'.
>
> Often this is what I want.  It works well when I'm looking for a
> specific piece of information, or when I am interested in reading only
> the unread messages in a long thread that I have seen previously.
>
> Often this is not what I want.  I'm interested in seeing all messages
> when I am looking for entire conversations where a topic is being
> discussed.  E.g. when I want to re-read a long forgotten thread, or one
> that surfaced through specific search terms that appear only in a few of
> the messages in the thread.

In notmuch-show mode, M- opens all messages. 

> I looked for a way to easily re-query a tree view buffer such that all
> messages in all threads shown are "open" but did not find it.  Does this
> exist?

Not exactly an answer, but maybe this helps someone:

In tree-mode I would suggest using "N" and "P" to ignore the open/closed
status of a message. Or just move using the arrow keys / mouse and hit
return on the message you want to read.

If you really rarely want to the "*-matching-message" versions, then you
could swap the bindings
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH] test/cli: Add known broken test for (missing) quoting in From

2024-05-26 Thread David Bremner
In [1], Jakub Wilk observes that the current behaviour is confusing
since it looks like there are two mailboxes in From, while in fact
there is only one.  It seems to me that notmuch should at least quote
the display-name part of a mailbox if it has "funny" characters in it,
and perhaps always quote it. Either way will require changing the
indexing code, since the structure is lost when writing the headers to
the database.

[1]: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1021614
---
 test/T520-show.sh | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/test/T520-show.sh b/test/T520-show.sh
index 6bcf109c..8121c3db 100755
--- a/test/T520-show.sh
+++ b/test/T520-show.sh
@@ -45,6 +45,12 @@ if [ "${NOTMUCH_HAVE_SFSEXP-0}" = "1" ]; then
 
 fi
 
+test_begin_subtest "quoting in From"
+test_subtest_known_broken
+add_message '[from]="=?UTF-8?Q?=3Cfoo=40example.org=3E=2C?= 
"'
+output=$(notmuch show id:${gen_msg_id}|grep From:)
+test_expect_equal "${output}" 'From: "," '
+
 add_email_corpus duplicate
 
 ID1=debian/2.6.1.dfsg-4-1-g87ea161@87ea161e851dfb1ea324af00e4ecfccc18875e15
-- 
2.43.0

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


Re: Xapian commits unexpectedly slow

2024-05-26 Thread David Bremner
Matthew Schauer  writes:

>
> Nifty!  Here are the results -- I assume you know how to interpret them
> better than I do:
>
> T00-new.sh: Testing notmuch new [0.4 large]
> Wall(s) Usr(s)  Sys(s)  Res(K)  In/Out(512B)
>   Initial notmuch new   1163.05 854.26  45.97   444304  2343120/13645200
>   notmuch new #22.230.020.0393842144/8
>   notmuch new #30.010.010.0094600/8
>   notmuch new #40.010.010.0094280/8
>   notmuch new #50.010.000.0094680/8
>   notmuch new #60.010.010.0096920/8
>   new (52374 mv)1351.01 537.75  235.45  959524  1027288/8531616
>   new (52374 mv back)   834.15  489.27  213.97  967040  184/4754016
>   new (52374 cp)747.23  284.03  105.51  941992  0/4007120
>

Apologies, it looks like I never replied to this thread. Probably you
are not longer interested, but I can make a few observations, mainly
that there are a few relevant improvements in later notmuch.

1) This is about 3x slower than my current benchmark machine [1]. My
current machine is probably 4 years newer, so I would expect some
improvement in performance. 

2) I don't know if this is typical for spinning rust, but about about
25% of the time is (apparently) IO wait, since it it does not show up in
CPU time.  I do have access to a machine with both SSD and spinning
rust, but the latter is in some complicated RAID formation, so I don't
know how representative the results would be.

3) Some time after you reported these issues I implemented an
"autocommit" parameter, which should should help avoid large Xapian
large commits.

4) Your results show that notmuch new could be extra slow when dealing
with moving files on disk. This should be somewhat improved by changes
in notmuch 0.32 (I also see fairly dramatic impovements in
notmuch-reindex relative to notmuch new, but the underlying cause is
less clear).

[1] e.g. https://notmuchmail.org/perf-test-results/2024-05-26-minkowski/
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: Multiple files per message in emacs

2024-05-26 Thread David Bremner
Rafael Ávila de Espíndola  writes:

> Rafael Ávila de Espíndola  writes:
>
>>> If you can build from source, there is new support for viewing
>>> duplicates in master.
>>
>
> Just tested with 0.37 and it works. One thing that still seems to be
> missing is handling different tags. For example, there is no way to mark
> a new duplicated message as read.

Catching up on old messages in the mailing list, I'm not sure I
understand the desired behaviour. In principle if you get a second copy
of the same message, it should inherit the read/unread status of the
other copies (since tags are associated with message-ids). There are
some known limitations/bugs with that, but they are not emacs related
afaik.
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: Meaning of offset in notmuch search --output=files --offset=

2024-05-25 Thread David Bremner
Teemu Likonen  writes:

>
>> Perhaps the manual page needs a few more words to make it clear.
>
> --offset=[-]N
> Skip displaying the first N results. With the leading '-',
> start at the Nth result from the end.
>
> What if we change the first sentence to "Skip displaying the first N
> search results"?

For me personally that doesn't make it that much clearer, but I'm
willing to follow a concensus if there is one.

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


Re: notmuch-search not excluding excluded tags

2024-05-21 Thread David Bremner
erik colson  writes:

>
> Thanks for the hint, but tried setting the var with setq-default, but
> still same issue.. :
>
>   notmuch-search-hide-excluded is a variable defined in ‘notmuch-lib.el’.
>   
>   Its value is nil
>   Original value was t
>   Local in buffer *notmuch-saved-tree-1week and unread*; global value is t
>   
>   Hide mail tagged with a excluded tag.
>

Hmm. I can't duplicate that here. Can you try with a minimal
configuration? If you have the source you can run "./devel/try-emacs-mua
-q" to run without any personal configuration.

Another thing to try is to hit "i" in a search view and see if it
toggles properly.

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


Re: notmuch-search not excluding excluded tags

2024-05-20 Thread David Bremner
erik colson  writes:
> Hi,
>
> I recently upgraded from an older version in which excluded tags in the
> notmuch config were nicely hidden.  Now I have exactly the same problem
> as Stanton described.  I can see notmuch-search-hide-excluded is set
> globally to t, but in every search buffer it seems to be set to nil.  I
> can't figure what code I should change for thi to work as before..

It might matter how you are setting notmuch-search-hide-excluded. It
is buffer-local (that changed recently, I think) so you need to either
use customize or setq-default.
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH 4/4] emacs/tree: sanitize subjects when drawing tree

2024-05-20 Thread David Bremner
This fixes the bug reported in

 id:6f2ef901-8b4b-44ff-83c5-22f732ba9...@gmail.com

Unfortunately it turns out our test data has several tabs in the
subject lines. The expected output was updated to reflect their
removal and the ripple effect of several more subjects matching the
previous ones.
---
 emacs/notmuch-tree.el |  4 +++-
 test/T460-emacs-tree.sh   |  1 -
 test/emacs-tree.expected-output/inbox-outline | 14 ++--
 .../notmuch-tree-single-thread|  4 ++--
 .../notmuch-tree-tag-inbox| 22 +--
 .../notmuch-tree-tag-inbox-oldest-first   | 22 +--
 .../notmuch-tree-tag-inbox-tagged | 22 +--
 .../notmuch-tree-tag-inbox-thread-tagged  | 22 +--
 .../result-format-function| 22 +--
 9 files changed, 67 insertions(+), 66 deletions(-)

diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
index faec89c4..2332f020 100644
--- a/emacs/notmuch-tree.el
+++ b/emacs/notmuch-tree.el
@@ -946,7 +946,9 @@ unchanged ADDRESS if parsing fails."
'face face)))
 
  ((string-equal field "subject")
-  (let ((bare-subject (notmuch-show-strip-re (plist-get headers :Subject)))
+  (let ((bare-subject
+(notmuch-sanitize
+ (notmuch-show-strip-re (plist-get headers :Subject
(previous-subject notmuch-tree-previous-subject)
(face (if match
  'notmuch-tree-match-subject-face
diff --git a/test/T460-emacs-tree.sh b/test/T460-emacs-tree.sh
index 69a9df74..4243f65a 100755
--- a/test/T460-emacs-tree.sh
+++ b/test/T460-emacs-tree.sh
@@ -223,7 +223,6 @@ test_emacs '(let ((notmuch-tree-outline-enabled t))
 test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox OUTPUT
 
 test_begin_subtest "notmuch-tree for message with subject with embedded CRNL"
-test_subtest_known_broken
 add_message "[subject]=\"=?UTF-8?B?8J+Pi++4jw==?= A SALE to boost your 
=?UTF-8?Q?workout=0D=0A?=\" [body]=the-message-body" 
 test_emacs "(notmuch-tree \"id:${gen_msg_id}\")
(notmuch-test-wait)
diff --git a/test/emacs-tree.expected-output/inbox-outline 
b/test/emacs-tree.expected-output/inbox-outline
index 9119a916..4acb62a9 100644
--- a/test/emacs-tree.expected-output/inbox-outline
+++ b/test/emacs-tree.expected-output/inbox-outline
@@ -1,24 +1,24 @@
   2010-12-29  François Boulogne ─►[aur-general] Guidelines: cp, mkdir vs 
install  (inbox unread)
   2010-12-16  Olivier Berger─►Essai accentué   
   (inbox unread)
   2009-11-18  Chris Wilson  ─►[notmuch] [PATCH 1/2] Makefile: evaluate 
pkg-config once (inbox unread)
-  2009-11-18  Alex Botero-Lowry ┬►[notmuch] [PATCH] Error out if no query 
is supplied to searchinstead of going into an infinite loop (attachment 
inbox unread)
+  2009-11-18  Alex Botero-Lowry ┬►[notmuch] [PATCH] Error out if no query 
is supplied to search instead of going into an infinite loop (attachment inbox 
unread)
   2009-11-17  Ingmar Vanhassel  ┬►[notmuch] [PATCH] Typsos 
   (inbox unread)
   2009-11-17  Adrian Perez de Cast  ┬►[notmuch] Introducing myself 
   (inbox signed unread)
   2009-11-17  Israel Herraiz┬►[notmuch] New to the list
   (inbox unread)
   2009-11-17  Jan Janak ┬►[notmuch] What a great idea! 
   (inbox unread)
   2009-11-17  Jan Janak ┬►[notmuch] [PATCH] Older versions of 
install do not support -C. (inbox unread)
   2009-11-17  Aron Griffis  ┬►[notmuch] archive
   (inbox unread)
-  2009-11-17  Keith Packard ┬►[notmuch] [PATCH] Make notmuch-show 'X' 
(and 'x') commands removeinbox (and unread) tags (inbox unread)
+  2009-11-17  Keith Packard ┬►[notmuch] [PATCH] Make notmuch-show 'X' 
(and 'x') commands remove inbox (and unread) tags (inbox unread)
   2009-11-17  Lars Kellogg-Stedman  ┬►[notmuch] Working with Maildir storage?  
   (inbox signed unread)
-  2009-11-17  Mikhail Gusarov   ┬►[notmuch] [PATCH 1/2] Close message file 
after parsing message   headers (inbox unread)
-  2009-11-18  Keith Packard ┬►[notmuch] [PATCH] Create a default 
notmuch-show-hook thathighlights URLs and uses word-wrap (inbox unread)
+  2009-11-17  Mikhail Gusarov   ┬►[notmuch] [PATCH 1/2] Close message file 
after parsing message headers (inbox unread)
+  2009-11-18  Keith Packard ┬►[notmuch] [PATCH] Create a default 
notmuch-show-hook that highlights URLs and uses word-wrap (inbox unread)
   2009-11-18  Alexander Botero-Low  ─►[notmuch] request for pull   
   (inbox unread)
   2009-11-18  Jjgod Jiang   ┬►[notmuch] Mac OS X/Darwin compatibility 
issues  (inbox unread)
   2009-11-18  Rolland Santimano ─►[not

[PATCH 1/4] test: re-enable duplicate UI tests in T460-emacs-tree

2024-05-20 Thread David Bremner
These were disabled (accidentally?) in f63d14a8c12a.
---
 test/T460-emacs-tree.sh | 2 --
 1 file changed, 2 deletions(-)

diff --git a/test/T460-emacs-tree.sh b/test/T460-emacs-tree.sh
index 6ef5c54a..9388a8ed 100755
--- a/test/T460-emacs-tree.sh
+++ b/test/T460-emacs-tree.sh
@@ -222,8 +222,6 @@ test_emacs '(let ((notmuch-tree-outline-enabled t))
 # folding all messages by height or depth should look the same
 test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox OUTPUT
 
-test_done
-
 add_email_corpus duplicate
 
 ID3=87r2ecrr6x@zephyr.silentflame.com
-- 
2.43.0

___
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   >