From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-18.7 required=3.0 tests=AWL,BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com [IPv6:2607:f8b0:4864:20::62c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id E31B91F405 for ; Wed, 24 Jan 2024 22:51:11 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20230601 header.b=vBRc/55e; dkim-atps=neutral Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-1d780a392fdso12131265ad.3 for ; Wed, 24 Jan 2024 14:51:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1706136670; x=1706741470; darn=public-inbox.org; h=content-disposition:mime-version:message-id:subject:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=keQLnRFlqGYDLLJrM2Q2tXt7mAelFw2+83o0JqM4jKs=; b=vBRc/55ezkotLKiCHp1/VQ5rFLV1mP0o3Q0HkSW9KMWOODBzYnjPGKb5ROgYGGHW+G 5+ohNfacFVcj8rHny602LAaXajkD8krRHuzBw/Iu1AffawDwCRQWWUsWL3rUjxrAGaTo vQ0VD3rL/RBRO0E5zQhrjT4z3ZAWmoRWxF78OweVXRmUe4LS2HzRVRU7aTwc6p8RXHUl NDq+8rrlrkBBKm4Z/QyoIDhplWdHfps71Sg4uoHMmaoTTWSQT02Vwe6iL/Pv57fwYQPH nv5v5vSNArW0iJ1NzuHi6PqvBnfEC1gzQh/D+9qxfcru+Exmen/yyixne0FlbH4zw2m7 fc2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706136670; x=1706741470; h=content-disposition:mime-version:message-id:subject:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=keQLnRFlqGYDLLJrM2Q2tXt7mAelFw2+83o0JqM4jKs=; b=kHJouYkcL8W5Wy8hxzv79j+TDDkPkjEXDB23rW6SbM8MhKXxrFgmSQCRkca8/4bsmU MN4JVLpBfTxy6bv3KGgwnYqx1nlWJyrB0dvJ4ZfJXqJXd8R/pq46iZc0vgZK8wQIIfHo cr3z48owz0wXv6jiuxBwp48NlxosFfVNjwh1SWsTHU1E45/JRrFOK4b/4G6ErX+uCCsx BPZ59+AJtXJwn85M61d5vFVuft8fHeQxKVVdsrb11tBjuMcp6GlSJ+hRhwEL9nVO1QmJ D2jkUpAo5V60Di40GQjh9NuZJvipxraekK6MEMZUXTr6N6a2inehfceYPaKiiho2qLTl hAZg== X-Gm-Message-State: AOJu0YyAfXh5m4MUsY0nm0fybIAy+6s/s7onV27NkaCOv7/jdcA1Es7f x6aDFC97ixahE+3gPS/daZe0b/IwGhsn2b6IUO3WKwUHGj4xOJ//2d5vyuNND7/uC12bySCub4P rlw== X-Google-Smtp-Source: AGHT+IE2VbcSWJbeXTqL0DppJbVXnfv0wvthUoFUYf+q1Xb33g7WVRdnqv6uVUragV3lWUHq4xJWSQ== X-Received: by 2002:a05:6a20:160a:b0:19b:4435:e425 with SMTP id l10-20020a056a20160a00b0019b4435e425mr211355pzj.30.1706136669931; Wed, 24 Jan 2024 14:51:09 -0800 (PST) Received: from google.com ([2620:15c:2d3:204:d7bd:1f81:98c2:d318]) by smtp.gmail.com with ESMTPSA id gu15-20020a056a004e4f00b006dd8a4bbbc7sm2167095pfb.101.2024.01.24.14.51.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 14:51:09 -0800 (PST) Date: Wed, 24 Jan 2024 14:51:04 -0800 From: Josh Steadmon To: meta@public-inbox.org Subject: How do I write labels back to the source Maildir? Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline List-Id: Hi folks, This ended up being a longer email than I wanted, so to summarize, my main question is: is it possible to have lei write labels created with `lei-tag` back to the source Maildir which was indexed with `lei-index`? Additional details below: I'm a Git developer, and I am subscribed to git@vger.kernel.org. I sync that mail from my corp Gmail account to a local Maildir with mbsync. I would like that single Maildir to be the canonical source of mail, which I generally read with Mutt. Within that Maildir, I would like to be able to quickly find emails about unit tests. I can find these on lore.kernel.org with a query like: "dfn:t/unit-tests OR s:unit OR ((nq:bug OR nq:regression) AND nq:unit)" Ideally, I'd like some sort of automated lei setup to tag messages matching the above query, and then I can use Mutt's built-in filtering to show me only those threads. Since I want the mbsync-ed Maildir to be the canonical source of mail, it sounds like `lei-index` is what I want. I ran `lei index ~/.mail/gmail/git-external` and it seems to be OK. Next I want to see if I can search those indexed mails, so I run `lei q dfn:t/unit-tests OR s:unit OR \(\(nq:bug OR nq:regression\) AND nq:unit\)` and I get some JSON containing email metadata matching the query. So far, so good. Now I want to label those matching messages. After a bit of experimentation, I come up with the following combination of lei-q and lei-tag: ``` lei q -f mboxrd dfn:t/unit-tests OR s:unit OR \(\(nq:bug OR nq:regression\) AND nq:unit\) \ | lei tag -F mboxrd - +L:git-unit-tests ``` To make sure the label was applied, I run `lei q L:git-unit-tests` and I get back the same set of emails I expect. Great. However, now I'm stuck trying to get that label metadata back into my Maildir. I've tried both `lei refresh-mail-sync` and `lei export-kw` with various combinations of options, but nothing is updating the Maildir. I thought that at least one of these commands would update the matching emails with an "X-Label: git-unit-tests" header, although now I can't find any reference to X-Label in the lei docs, so I probably confused myself somehow about that. I *can* get lei-q to write these matching emails to a separate Maildir using `lei q -o /tmp/git-unit-tests dfn:t/unit-tests ...`, but this workflow is more annoying than I'd hoped for, as metadata is not automatically synced between the various Maildirs, and it's a bit slower in Mutt to switch Maildirs than to filter the currently open one. So to repeat my original question, is there any way to get lei to somehow update the source Maildir to reflect the labels on these tagged messages? Thanks in advance for any advice, Josh