Re: Forcing a sync of maildir flags?
Hello David, On Sun 01 May 2022 at 08:23PM -03, David Bremner wrote: > Sean Whitton writes: >> >> Thanks. Let me record in this thread what I will believe it will take a >> reproduce this in a test: >> >> 1) inbox and sent are Maildirs >> >> 1) Compose mail to a mailing list which will return copies of >>submissions, with `Fcc: sent -unread` > > Since you mention Fcc, are you using notmuch insert? notmuch-maildir-use-notmuch-insert is t so I think I am? > # next line is a no-op, because it already doesn't have the unread tag > notmuch tag -unread folder:sent Seems also worth noting that to my mind it ultimately shouldn't be necessary to run that command -- notmuch should notice that one copy of the message has different maildir flags to the other in a way that's out of sync with the notmuch tags it has. > The key point is that from notmuch's point of view the message never has > the unread tag, so there is no change for "notmuch tag" to sync with > maildir flags. > > It doesn't seem to make a difference if I put the copy in inbox/new or > inbox/cur, so I don't think it is related to the previous efforts not to > prematurely move files out of new/. > > As far as I can tell, notmuch-new (unlike notmuch-insert) does not call > notmuch_message_tags_to_maildir_flags, so the maildir flags on the newly > discovered copy are not updated. Perhaps it should, but that seems like > a pretty big change, so I want to proceed with caution. It makes sense to me for notmuch-new to call that function too, fwiw. -- Sean Whitton ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
Re: [PATCH 1/1] emacs: Make notmuch-show-next-thread return nil on failure
David Bremner writes: > Leo writes: > >> From: Leo Okawa Ericson >> >> Having notmuch-show-next-thread return non-nil on success and nil on >> failure makes it easier for users to interact with notmuch via elisp. > > You talk about notmuch-show-next-thread, but you seem to be modifying > notmuch-search-show-thread. That actually seems like a bit of a strange > function to invoke programatically, since it deduces the argument from > the current buffer. It might be better for your code to call > notmuch-show directly, since notmuch-search-show-thread is pretty tied > to the internals of notmuch-search-mode. > I mentioned this in the reroll of the patch, but I modified notmuch-search-show-thread because the return value of notmuch-show-next-thread depends on it. In case this is an XY problem[1], what I want is the ability to go through each email in the search buffer (like notmuch-show-next-thread does), and when there are no more messages left I want to call a function. Changing notmuch-search-show-thread (and thereby notmuch-show-next-thread), seemed to be the least intrusive way to do it. [1] https://en.wikipedia.org/wiki/XY_problem /Leo ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
[PATCH v2 2/2] emacs: Make notmuch-show-next-thread return nil on failure
Having notmuch-show-next-thread return non-nil on success and nil on failure makes it easier for users to interact with notmuch via elisp. This commit changes notmuch-search-show-thread too since the return value of notmuch-show-next-thread depends on notmuch-search-show-thread. --- I've added docstrings and tests, but I'm not sure if the location I put the tests in is appropriate. emacs/notmuch-show.el | 4 +++- emacs/notmuch.el| 7 +-- test/T450-emacs-show.sh | 16 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 7c1f02c9..5a2bbe5c 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -2205,7 +2205,9 @@ (defun notmuch-show-next-thread ( show previous) If SHOW is non-nil, open the next item in a show buffer. Otherwise just highlight the next item in the search buffer. If PREVIOUS is non-nil, move to the previous item in the -search results instead." +search results instead. + +Return non-nil on success." (interactive "P") (let ((parent-buffer notmuch-show-parent-buffer)) (notmuch-bury-or-kill-this-buffer) diff --git a/emacs/notmuch.el b/emacs/notmuch.el index c1ddb06b..a87d416a 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -520,7 +520,9 @@ (defun notmuch-search-show-thread ( elide-toggle) With a prefix argument, invert the default value of `notmuch-show-only-matching-messages' when displaying the -thread." +thread. + +Return non-nil on success." (interactive "P") (let ((thread-id (notmuch-search-find-thread-id))) (if thread-id @@ -532,7 +534,8 @@ (defun notmuch-search-show-thread ( elide-toggle) (format "*%s*" (truncate-string-to-width (notmuch-search-find-subject) 30 nil nil t))) - (message "End of search results." + (message "End of search results.") + nil))) (defun notmuch-tree-from-search-current-query () "Tree view of current query." diff --git a/test/T450-emacs-show.sh b/test/T450-emacs-show.sh index 057ad37e..ee25a403 100755 --- a/test/T450-emacs-show.sh +++ b/test/T450-emacs-show.sh @@ -62,6 +62,22 @@ test_emacs '(let ((notmuch-crypto-process-mime nil)) (test-visible-output))' test_expect_equal_file $EXPECTED/notmuch-show-process-crypto-mime-parts-on OUTPUT +test_begin_subtest "notmuch-search-show-thread returns non-nil on success" +test_emacs_expect_t '(notmuch-search "id:20091117203301.gv3...@dottiness.seas.harvard.edu") + (when (notmuch-search-show-thread) + (error "Expected non-nil when successfully showing a thread")) + (when (notmuch-show-next-thread) + (error "Expected nil when there are no more threads")) + t' + +test_begin_subtest "notmuch-show-next-thread returns non-nil on success" +test_emacs_expect_t '(notmuch-search "id:20091117203301.gv3...@dottiness.seas.harvard.edu") + (when (notmuch-show-next-thread) + (error "Expected non-nil when successfully showing a thread")) + (when (notmuch-show-next-thread) + (error "Expected nil when there are no more threads")) + t)' + test_begin_subtest "notmuch-show: don't elide non-matching messages" test_emacs '(let ((notmuch-show-only-matching-messages nil)) (notmuch-search "from:l...@seas.harvard.edu and subject:\"Maildir storage\"") -- 2.36.0 ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
[PATCH v2 1/2] emacs: Make indentation more consistent in notmuch-search-show-thread
--- emacs/notmuch.el | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/emacs/notmuch.el b/emacs/notmuch.el index c9cf80dc..c1ddb06b 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -525,13 +525,13 @@ (defun notmuch-search-show-thread ( elide-toggle) (let ((thread-id (notmuch-search-find-thread-id))) (if thread-id (notmuch-show thread-id - elide-toggle - (current-buffer) - notmuch-search-query-string - ;; Name the buffer based on the subject. - (format "*%s*" (truncate-string-to-width - (notmuch-search-find-subject) - 30 nil nil t))) + elide-toggle + (current-buffer) + notmuch-search-query-string + ;; Name the buffer based on the subject. + (format "*%s*" (truncate-string-to-width + (notmuch-search-find-subject) + 30 nil nil t))) (message "End of search results." (defun notmuch-tree-from-search-current-query () base-commit: e3ad0087f3453c89871acac8b11da8bab1ac54df -- 2.36.0 ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org