From 4929cb81ac2cda79e4f4b411711130d6e0f8173f Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Thu, 13 Aug 2026 09:32:08 +0200 Subject: docs(backlog): record item 44 as done The tagging rules moved from the shell post-new hook to a shared JSON store both qtmaildir and mailctl read. Seventeen real rules were converted, each keeping its shell comment as a note, and the conversion was proved against the real index before anything was installed. Four findings are recorded in CLAUDE.md rather than only here, because they will outlive the item: a stored query carries no scope and the hook parenthesises it (a disjunction would otherwise escape tag:new and match everything); notmuch's parser rejects almost nothing, so a test asserting a provoked query failure fails against correct code; rule counts must count messages rather than threads; and a count request must not bump the query generation, which would blank the message pane. --- CHANGELOG.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'CHANGELOG.md') diff --git a/CHANGELOG.md b/CHANGELOG.md index a555fb4..846e5c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,15 @@ point at which they are stable. ### Added +- The rules that tag your mail as it arrives are now visible and editable from + Message > Tagging rules, and each one shows how much mail it matches so you + can judge a rule before the next sync applies it. They live in a shared file, + `~/.config/mailrules/rules.json`, which the notmuch `post-new` hook reads to + do the tagging and which the companion `mailctl` tool can read too. The rules + previously lived inside the hook as shell, where nothing but a text editor + could see them. Each rule keeps a note, so the reasoning behind it (which + senders it deliberately excludes, and why) travels with the rule instead of + being a comment only one program could read. - A tag change now syncs itself out, about two seconds after you stop making changes, instead of waiting for the Sync button or your cron job. The delay is a debounce, so tagging several threads in a row produces one sync rather than @@ -37,6 +46,31 @@ point at which they are stable. message you are reading in Unread gets marked read, the pane keeps showing it and offers "Show it anyway" instead of going blank. +### Upgrading + +The tagging rules moved out of the notmuch `post-new` hook and into +`~/.config/mailrules/rules.json`. The dialog reads and writes that file, but +nothing applies the rules until the new hook is installed, so this needs two +files copied from the companion `mailctl` project into your notmuch hooks +directory: + +```bash +DB="$(notmuch config get database.path)" +cp post-new mailrules.py "$DB/.notmuch/hooks/" +chmod +x "$DB/.notmuch/hooks/post-new" +``` + +Keep a backup of your previous hook until a sync has run with the new one. Your +existing rules do not convert themselves: each `notmuch tag` line becomes one +entry in the JSON file, with the part after `tag:new and` as its query. Leave +`tag:new` out of the stored query, the hook adds it, and do not carry over the +final `notmuch tag -new` line, which the hook now does itself. + +Two behaviours of the new hook are worth knowing. It refuses to remove `unread` +or `inbox`, since neither belongs in an unattended job that runs every ten +minutes, and it will not consume the `tag:new` marker if the rules file fails +to load, so a broken file delays tagging rather than losing it. + ## [0.15.0] - 2026-08-11 Sent mail becomes a place you can go. A Sent button beside Inbox, Unread and -- cgit v1.2.3