[PATCH] CLI/new: check status of notmuch_message_maildir_flags_to_tags
This improves error reporting since it prints the specifics of the exception. --- notmuch-new.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/notmuch-new.c b/notmuch-new.c index 1169184f..119aea20 100644 --- a/notmuch-new.c +++ b/notmuch-new.c @@ -404,8 +404,11 @@ add_file (notmuch_database_t *notmuch, const char *filename, break; /* Non-fatal issues (go on to next file). */ case NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID: - if (state->synchronize_flags) - notmuch_message_maildir_flags_to_tags (message); + if (state->synchronize_flags) { + status = notmuch_message_maildir_flags_to_tags (message); + if (print_status_message("add_file", message, status)) + goto DONE; + } break; case NOTMUCH_STATUS_FILE_NOT_EMAIL: fprintf (stderr, "Note: Ignoring non-mail file: %s\n", filename); -- 2.30.2 ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
Re: nmbug update
On Fri, Apr 23, 2021 at 8:21 PM David Bremner wrote: > Currently nmweb is not a good source of patches (it needs a "raw > download" link for a message, or perhaps a "download as mbox" link for a > thread). If you're interested in working on that (and like Django) then > let me know and I can provide you with a copy of the current source. Would you consider moving to a different web framework? If so, I could take a bite creating such a site, except probably with a Ruby framework. Cheers. -- Felipe Contreras ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
Re: Possible threading issues in nm 0.32
David Bremner venit, vidit, dixit 2021-05-05 14:29:38: > Michael J Gruber writes: > > > After updating to notmuch 0.32 I noticed a few strange threadings that > > went away after downgrading to 0.31.3 and reindexing. I can't pin-point > > that yet but wanted to give an early warning so you can look out for > > that, too. > > I'm not aware of any threading relevant changes in 0.32, but there was a > lot of churn in the library. If you could bisect or give a reproducer > that would be great. I could not reproduce by reindexing with nm 0.32, so I started using nm 0.32 again. Indeed, I got another mis-threading. I reindexed with nm 0.32 (without downgrading) and the thread got separated correctly again. That explains why I was not able to create a reproducer. So it seems: - The mis-threading happens during `notmuch new`, not with `notmuch reindex`. - In this new case (and if I remember correctly also in the others), it's always a new message getting worngly put into an existing thread, and if I'm not mistaken, the existing thread was tagged as trash before in all cases. Michael ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
[PATCH] perf-test/T00-new: fix backup creation.
"xargs tar cf backup.tar < $manifest" recreates the tar file with each "batch" execed by xargs. In general this results in only a fraction of the desired files being backed up. --- I'm not sure if this is worth including in the point release: both the risk and the benefit are relatively low since breaking the performance suite probably mainly annoys me. performance-test/T00-new.sh | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/performance-test/T00-new.sh b/performance-test/T00-new.sh index 53de1c27..de260b2d 100755 --- a/performance-test/T00-new.sh +++ b/performance-test/T00-new.sh @@ -5,16 +5,16 @@ test_description='notmuch new' . $(dirname "$0")/perf-test-lib.sh || exit 1 uncache_database - time_start +manifest=$(mktemp manifestXX) +find mail -type f ! -path 'mail/.notmuch/*' | sed -n '1~4 p' > $manifest +xargs tar uf backup.tar < $manifest + for i in $(seq 2 6); do time_run "notmuch new #$i" 'notmuch new' done -manifest=$(mktemp manifestXX) - -find mail -type f ! -path 'mail/.notmuch/*' | sed -n '1~4 p' > $manifest # arithmetic context is to eat extra whitespace on e.g. some BSDs count=$((`wc -l < $manifest`)) @@ -26,8 +26,6 @@ perl -nle 'rename "$_.renamed", $_' $manifest time_run "new ($count mv back)" 'notmuch new' -xargs tar cf backup.tar < $manifest - perl -nle 'unlink $_; unlink $_.copy' $manifest time_run "new ($count rm)" 'notmuch new' -- 2.30.2 ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
[PATCH 1/3] test: add known broken tests for notuch-{before,after}-tag-hook
These tests illustrate the bug reported in id:87v97ytd2s@fastmail.fm --- test/T310-emacs.sh | 24 test/test-lib.el | 3 +++ 2 files changed, 27 insertions(+) diff --git a/test/T310-emacs.sh b/test/T310-emacs.sh index 78ac19a8..5ebc8e66 100755 --- a/test/T310-emacs.sh +++ b/test/T310-emacs.sh @@ -161,6 +161,30 @@ test_emacs "(notmuch-show \"$os_x_darwin_thread\") output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize) test_expect_equal "$output" "thread:XXX 2009-11-18 [4/4] Jjgod Jiang, Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox unread)" +test_begin_subtest "notmuch-show: before-tag-hook is run, variables are defined" +test_subtest_known_broken +output=$(test_emacs '(let ((notmuch-test-tag-hook-output nil) + (notmuch-before-tag-hook (function notmuch-test-tag-hook))) + (notmuch-show "id:ddd65cda0911171950o4eea4389v86de9525e4605...@mail.gmail.com") + (execute-kbd-macro "+activate-hook\n") + (execute-kbd-macro "-activate-hook\n") + notmuch-test-tag-hook-output)') +test_expect_equal "$output" \ +'(("id:ddd65cda0911171950o4eea4389v86de9525e4605...@mail.gmail.com" "-activate-hook") + ("id:ddd65cda0911171950o4eea4389v86de9525e4605...@mail.gmail.com" "+activate-hook"))' + +test_begin_subtest "notmuch-show: after-tag-hook is run, variables are defined" +test_subtest_known_broken +output=$(test_emacs '(let ((notmuch-test-tag-hook-output nil) + (notmuch-after-tag-hook (function notmuch-test-tag-hook))) + (notmuch-show "id:ddd65cda0911171950o4eea4389v86de9525e4605...@mail.gmail.com") + (execute-kbd-macro "+activate-hook\n") + (execute-kbd-macro "-activate-hook\n") + notmuch-test-tag-hook-output)') +test_expect_equal "$output" \ +'(("id:ddd65cda0911171950o4eea4389v86de9525e4605...@mail.gmail.com" "-activate-hook") + ("id:ddd65cda0911171950o4eea4389v86de9525e4605...@mail.gmail.com" "+activate-hook"))' + test_begin_subtest "Message with .. in Message-Id:" add_message [id]=123..456@example '[subject]="Message with .. in Message-Id"' test_emacs '(notmuch-search "id:\"123..456@example\"") diff --git a/test/test-lib.el b/test/test-lib.el index 4de5b292..32d53736 100644 --- a/test/test-lib.el +++ b/test/test-lib.el @@ -99,6 +99,9 @@ running, quit if it terminated." (add-hook 'notmuch-hello-refresh-hook (lambda () (cl-incf notmuch-hello-refresh-hook-counter))) +(defvar notmuch-test-tag-hook-output nil) +(defun notmuch-test-tag-hook () (push (cons query tag-changes) notmuch-test-tag-hook-output)) + (defun notmuch-test-mark-links () "Enclose links in the current buffer with << and >>." ;; Links are often created by jit-lock functions -- 2.30.2 ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
[PATCH 3/3] NEWS: add NEWS for notmuch-{before,after}-tag-hook fixes
--- NEWS | 9 + 1 file changed, 9 insertions(+) diff --git a/NEWS b/NEWS index 44a18951..a3e59da4 100644 --- a/NEWS +++ b/NEWS @@ -1,10 +1,19 @@ Notmuch 0.32.1 (UNRELEASED) === +General +--- + Restore handling of relative values for `database.path` that was broken by 0.32. Extend this handling to `database.mail_root`, `database.backup_dir`, and `database.hook_dir`. +Emacs +- + +Restore the dynamically bound variables `tag-changes` and `query` in +in `notmuch-before-tag-hook` and `notmuch-after-tag-hook`. + Notmuch 0.32 (2021-05-02) = -- 2.30.2 ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
Updated fix for notmuch-{before,after}-tag-hook
The gist is the same, I just added some tests and a minimal NEWS item, Jonas, I somehow failed at my last attempt to ask you about Kyle's patch, so here it is again. ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
[PATCH 2/3] emacs: restore tag-changes and query bindings for tag hooks
From: Kyle Meyer notmuch-before-tag-hook and notmuch-after-tag-hook are supposed to have access to two dynamic variables, tag-changes and query, but these were lost with the switch to lexical binding in fc4cda07 (emacs: use lexical-bindings in all libraries, 2021-01-13). Add a variant of Emacs's dlet (not available until Emacs 28) and use it in notmuch-tag to expose tag-changes and query to the hooks. --- emacs/notmuch-compat.el | 12 emacs/notmuch-tag.el| 8 ++-- test/T310-emacs.sh | 2 -- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/emacs/notmuch-compat.el b/emacs/notmuch-compat.el index ad134dfe..179bf59c 100644 --- a/emacs/notmuch-compat.el +++ b/emacs/notmuch-compat.el @@ -41,6 +41,18 @@ (unless (fboundp 'message--fold-long-headers) (add-hook 'message-header-hook 'notmuch-message--fold-long-headers)) +;; `dlet' isn't available until Emacs 28.1. Below is a copy, with the +;; addition of `with-no-warnings'. +(defmacro notmuch-dlet (binders body) + "Like `let*' but using dynamic scoping." + (declare (indent 1) (debug let)) + `(let (_) + (with-no-warnings ; Quiet "lacks a prefix" warning. + ,@(mapcar (lambda (binder) + `(defvar ,(if (consp binder) (car binder) binder))) +binders)) + (let* ,binders ,@body))) + (provide 'notmuch-compat) ;;; notmuch-compat.el ends here diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el index f348d4ae..ebccb5a0 100644 --- a/emacs/notmuch-tag.el +++ b/emacs/notmuch-tag.el @@ -486,7 +486,9 @@ notmuch-after-tag-hook will be run." (unless query (error "Nothing to tag!")) (when tag-changes -(run-hooks 'notmuch-before-tag-hook) +(notmuch-dlet ((tag-changes tag-changes) + (query query)) + (run-hooks 'notmuch-before-tag-hook)) (if (<= (length query) notmuch-tag-argument-limit) (apply 'notmuch-call-notmuch-process "tag" (append tag-changes (list "--" query))) @@ -494,7 +496,9 @@ notmuch-after-tag-hook will be run." (let ((batch-op (concat (mapconcat #'notmuch-hex-encode tag-changes " ") " -- " query))) (notmuch-call-notmuch-process :stdin-string batch-op "tag" "--batch"))) -(run-hooks 'notmuch-after-tag-hook))) +(notmuch-dlet ((tag-changes tag-changes) + (query query)) + (run-hooks 'notmuch-after-tag-hook (defun notmuch-tag-change-list (tags reverse) "Convert TAGS into a list of tag changes. diff --git a/test/T310-emacs.sh b/test/T310-emacs.sh index 5ebc8e66..e6489246 100755 --- a/test/T310-emacs.sh +++ b/test/T310-emacs.sh @@ -162,7 +162,6 @@ output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize) test_expect_equal "$output" "thread:XXX 2009-11-18 [4/4] Jjgod Jiang, Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox unread)" test_begin_subtest "notmuch-show: before-tag-hook is run, variables are defined" -test_subtest_known_broken output=$(test_emacs '(let ((notmuch-test-tag-hook-output nil) (notmuch-before-tag-hook (function notmuch-test-tag-hook))) (notmuch-show "id:ddd65cda0911171950o4eea4389v86de9525e4605...@mail.gmail.com") @@ -174,7 +173,6 @@ test_expect_equal "$output" \ ("id:ddd65cda0911171950o4eea4389v86de9525e4605...@mail.gmail.com" "+activate-hook"))' test_begin_subtest "notmuch-show: after-tag-hook is run, variables are defined" -test_subtest_known_broken output=$(test_emacs '(let ((notmuch-test-tag-hook-output nil) (notmuch-after-tag-hook (function notmuch-test-tag-hook))) (notmuch-show "id:ddd65cda0911171950o4eea4389v86de9525e4605...@mail.gmail.com") -- 2.30.2 ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
Re: The future of Ruby bindings
On Fri, Apr 30, 2021 at 5:14 PM Felipe Contreras wrote: > I understand why Ali Polatel did commit c7893408 (ruby: Kill garbage > collection related cruft., 2010-05-26); because the order of the object > destruction cannot be ensured in Ruby, however, there's ways to > workaround that. > > 1. We can steal the object > 2. We can increase the reference count > 3. We can add a second parent I attempted all options, and none of these worked in practice, except #1. I have the patches ready, but first they need the cleanups in [1]. Any feedback would be appreciated. Cheers. [1] id:20210504081749.715768-1-felipe.contre...@gmail.com -- Felipe Contreras ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org