Re: notmuch-emacs inline image display broken in emacs-29

2023-03-01 Thread Alex Murray
On Sat, 2023-02-25 at 09:48:08 -0400, David Bremner wrote:

> David Bremner  writes:
>
>> Alex Murray  writes:
>>
>> I tried replacing indent-rigidly with a simplified version the and that
>> leaves the image inserted, but unfortunately doesn't indent it
>> properly. If you want to play with it, my half working patch is
>> attached.
>>
>
> Actually, the current implementation using indent-rigidly doesn't indent
> inlined images properly either, so maybe that is a way forward. I
> remember from last time I considered globally replacing our use of
> indent-rigidly [1] there were a few issues to be dealt with, but maybe
> this is a reasonable approach.
>

Thanks for the patch David - I tried the one attached to the previous
email it but it doesn't seem to fix the issue for me.

I also tried the one in [1] and that did seem to help - images in
replies (and hence emails that by default are displayed with an indent)
show up now, but not for emails that are the first ones in a thread (and
hence have no indent by default).

(although I notice in a recent conversation in #notmuch that it did
appear to work for one user - but not sure which patch they were using).

Any ideas where I should start trying to debug this on my side?

I am using a pretty recent build of emacs from master with a the latest
notmuch-emacs bits from MELPA - https://melpa.org/#/notmuch (and the
notmuch binary 0.37 - as packaged in Ubuntu 23.04 with version
0.37-1ubuntu3 FWIW).

> [1]: 
> https://nmbug.notmuchmail.org/nmweb/show/20211214121726.2631714-1-da...@tethera.net
> ___
> notmuch mailing list -- notmuch@notmuchmail.org
> To unsubscribe send an email to notmuch-le...@notmuchmail.org
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH 2/2] lib/message-property: sync removed properties to the database

2023-03-01 Thread Kevin Boulain
_notmuch_message_remove_all_properties wasn't syncing the message back
to the database but was still invalidating the metadata, giving the
impression the properties had actually been removed.

Also move the metadata invalidation to _notmuch_message_remove_terms
to be closer to what's done in _notmuch_message_modify_property and
_notmuch_message_remove_term.
---
Don't we need to talloc_free the talloc_asprintf'd term_prefix?

 lib/message-property.cc   |  4 ++-
 lib/message.cc|  2 ++
 test/T610-message-property.sh | 61 ---
 3 files changed, 33 insertions(+), 34 deletions(-)

diff --git a/lib/message-property.cc b/lib/message-property.cc
index d5afa30c..0d658038 100644
--- a/lib/message-property.cc
+++ b/lib/message-property.cc
@@ -123,7 +123,6 @@ _notmuch_message_remove_all_properties (notmuch_message_t 
*message, const char *
 if (status)
return status;
 
-_notmuch_message_invalidate_metadata (message, "property");
 if (key)
term_prefix = talloc_asprintf (message, "%s%s%s", _find_prefix 
("property"), key,
   prefix ? "" : "=");
@@ -133,6 +132,9 @@ _notmuch_message_remove_all_properties (notmuch_message_t 
*message, const char *
 /* XXX better error reporting ? */
 _notmuch_message_remove_terms (message, term_prefix);
 
+if (! _notmuch_message_frozen (message))
+   _notmuch_message_sync (message);
+
 return NOTMUCH_STATUS_SUCCESS;
 }
 
diff --git a/lib/message.cc b/lib/message.cc
index 1b1a071a..53f35dd1 100644
--- a/lib/message.cc
+++ b/lib/message.cc
@@ -719,6 +719,8 @@ _notmuch_message_remove_terms (notmuch_message_t *message, 
const char *prefix)
/* Ignore failure to remove non-existent term. */
}
 }
+
+_notmuch_message_invalidate_metadata (message, "property");
 }
 
 
diff --git a/test/T610-message-property.sh b/test/T610-message-property.sh
index 7ebddae3..dd397e16 100755
--- a/test/T610-message-property.sh
+++ b/test/T610-message-property.sh
@@ -89,17 +89,6 @@ testkey2 = NULL
 EOF
 test_expect_equal_file EXPECTED OUTPUT
 
-test_begin_subtest "notmuch_message_remove_all_properties"
-cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR}
-EXPECT0(notmuch_message_remove_all_properties (message, NULL));
-print_properties (message, "", FALSE);
-EOF
-cat <<'EOF' >EXPECTED
-== stdout ==
-== stderr ==
-EOF
-test_expect_equal_file EXPECTED OUTPUT
-
 test_begin_subtest "testing string map binary search (via message properties)"
 cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR}
 {
@@ -162,6 +151,17 @@ testkey1 = testvalue1
 EOF
 test_expect_equal_file EXPECTED OUTPUT
 
+test_begin_subtest "notmuch_message_remove_all_properties"
+cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR}
+EXPECT0(notmuch_message_remove_all_properties (message, NULL));
+print_properties (message, "", FALSE);
+EOF
+cat <<'EOF' >EXPECTED
+== stdout ==
+== stderr ==
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
 test_begin_subtest "notmuch_message_properties: multiple values"
 cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR}
 EXPECT0(notmuch_message_add_property (message, "testkey1", "bob"));
@@ -173,7 +173,6 @@ cat <<'EOF' >EXPECTED
 == stdout ==
 testkey1 = alice
 testkey1 = bob
-testkey1 = testvalue1
 testkey1 = testvalue2
 == stderr ==
 EOF
@@ -186,23 +185,10 @@ EXPECT0(notmuch_message_add_property (message, 
"testkey3", "testvalue3"));
 EXPECT0(notmuch_message_add_property (message, "testkey3", "alice3"));
 print_properties (message, "testkey", FALSE);
 EOF
-# expected: 4 values for testkey1, 3 values for testkey3
-# they are not guaranteed to be sorted, so sort them, leaving the first
-# line '== stdout ==' and the end ('== stderr ==' and whatever error
-# may have been printed) alone
-mv OUTPUT unsorted_OUTPUT
-awk ' NR == 1 { print; next } \
-  NR < 6  { print | "sort"; next } \
-  NR == 6 { close("sort") } \
-  NR < 9  { print | "sort"; next } \
-  NR == 9 { close("sort") } \
-  { print }' unsorted_OUTPUT > OUTPUT
-rm unsorted_OUTPUT
 cat <<'EOF' >EXPECTED
 == stdout ==
 testkey1 = alice
 testkey1 = bob
-testkey1 = testvalue1
 testkey1 = testvalue2
 testkey3 = alice3
 testkey3 = bob3
@@ -246,9 +232,23 @@ cat <<'EOF' >EXPECTED
 EOF
 test_expect_equal_file EXPECTED OUTPUT
 
+test_begin_subtest "notmuch_message_remove_all_properties_with_prefix"
+cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR}
+EXPECT0(notmuch_message_remove_all_properties_with_prefix (message, 
"testkey3"));
+print_properties (message, "", FALSE);
+EOF
+cat <<'EOF' >EXPECTED
+== stdout ==
+testkey1 = alice
+testkey1 = bob
+testkey1 = testvalue2
+== stderr ==
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
 test_begin_subtest "dump message properties"
 cat < PROPERTIES
-#= 4efc743a.3060...@april.org 
fancy%20key%20with%20%c3%a1cc%c3%a8nts=import%20value%20with%20= testkey1=alice 
testkey1=bob testkey1=testvalue1 testkey1=testvalue2 testkey3=alice3 
testkey3=bob3 testkey3=testvalue3
+#= 

[PATCH 1/2] test: display key name in property tests

2023-03-01 Thread Kevin Boulain
To ease the review of the next patch.
---
 test/T610-message-property.sh | 26 +-
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/test/T610-message-property.sh b/test/T610-message-property.sh
index 2685f3b5..7ebddae3 100755
--- a/test/T610-message-property.sh
+++ b/test/T610-message-property.sh
@@ -12,7 +12,7 @@ void print_properties (notmuch_message_t *message, const char 
*prefix, notmuch_b
 notmuch_message_properties_t *list;
 for (list = notmuch_message_get_properties (message, prefix, exact);
  notmuch_message_properties_valid (list); 
notmuch_message_properties_move_to_next (list)) {
-   printf("%s\n", notmuch_message_properties_value(list));
+   printf("%s = %s\n", notmuch_message_properties_key(list), 
notmuch_message_properties_value(list));
 }
 notmuch_message_properties_destroy (list);
 }
@@ -157,7 +157,7 @@ print_properties (message, "testkey1", TRUE);
 EOF
 cat <<'EOF' >EXPECTED
 == stdout ==
-testvalue1
+testkey1 = testvalue1
 == stderr ==
 EOF
 test_expect_equal_file EXPECTED OUTPUT
@@ -171,10 +171,10 @@ print_properties (message, "testkey1", TRUE);
 EOF
 cat <<'EOF' >EXPECTED
 == stdout ==
-alice
-bob
-testvalue1
-testvalue2
+testkey1 = alice
+testkey1 = bob
+testkey1 = testvalue1
+testkey1 = testvalue2
 == stderr ==
 EOF
 test_expect_equal_file EXPECTED OUTPUT
@@ -200,13 +200,13 @@ awk ' NR == 1 { print; next } \
 rm unsorted_OUTPUT
 cat <<'EOF' >EXPECTED
 == stdout ==
-alice
-bob
-testvalue1
-testvalue2
-alice3
-bob3
-testvalue3
+testkey1 = alice
+testkey1 = bob
+testkey1 = testvalue1
+testkey1 = testvalue2
+testkey3 = alice3
+testkey3 = bob3
+testkey3 = testvalue3
 == stderr ==
 EOF
 test_expect_equal_file EXPECTED OUTPUT
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: crash on incoming email

2023-03-01 Thread David Bremner
Antoine Beaupré  writes:
>
> Still, one has to wonder: if emacs can just dump core if someone messes
> with my eln-cache, that's... bad, no?

Yes, it is bad, but the native compilation functionality is new, so
hopefully things will get better over time.
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org