From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id EEz8EIaW+mFmbwAAgWs5BA (envelope-from ) for ; Wed, 02 Feb 2022 15:34:46 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id YCRKDoaW+mFBWgEA9RJhRA (envelope-from ) for ; Wed, 02 Feb 2022 15:34:46 +0100 Received: from mail.notmuchmail.org (yantan.tethera.net [IPv6:2a01:4f9:c011:7a79::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 387412DF2F for ; Wed, 2 Feb 2022 15:34:45 +0100 (CET) Received: from yantan.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 2F3EC5F6DD; Wed, 2 Feb 2022 14:34:42 +0000 (UTC) Received: from fethera.tethera.net (fethera.tethera.net [IPv6:2607:5300:60:c5::1]) by mail.notmuchmail.org (Postfix) with ESMTP id 7BFEF5F5EE for ; Wed, 2 Feb 2022 14:34:39 +0000 (UTC) Received: by fethera.tethera.net (Postfix, from userid 1001) id 90BFB5FBD2; Wed, 2 Feb 2022 09:34:38 -0500 (EST) Received: (nullmailer pid 740205 invoked by uid 1000); Wed, 02 Feb 2022 14:34:37 -0000 From: David Bremner To: notmuch@notmuchmail.org Subject: Re: [RFC PATCH v2 8/8] WIP: add notmuch-tag-undo In-Reply-To: <20220129194439.2790761-9-david@tethera.net> References: <20220129194439.2790761-1-david@tethera.net> <20220129194439.2790761-9-david@tethera.net> Date: Wed, 02 Feb 2022 10:34:37 -0400 Message-ID: <87tudhxrpe.fsf@tethera.net> MIME-Version: 1.0 Message-ID-Hash: ZNKC2VQDLIHU3Z3FKIZJJOUA7UQINGSW X-Message-ID-Hash: ZNKC2VQDLIHU3Z3FKIZJJOUA7UQINGSW X-MailFrom: david@tethera.net X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.3 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN X-Migadu-Country: DE ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1643812486; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-owner:list-unsubscribe:list-subscribe:list-post; bh=p2wuXeRpRZO8CKuIxSP2V1f8cYE6AzoppAlS7b2NF5M=; b=JK8C35aI6ish0F+kaunvdan8DVXgv8tTa3pGvnVr60uv4L5wE9W9IxA2Qmv0zQJPAuZ8A5 /XvCfhZwMAZOSEK9YmV35kk0JnQPtRSPBKTFRNhPKazQ+Zs3rAx014vQtYAUAP+YRckSsr ZiU80cMjylIIw3DPTr5fVMphOhdLLZs57USBaAKXUzEXVnc952ENU8E3OIvgxeV+/MTEtp LbAwB6fKWSqy9o2dR8QsFQFtocIW7laBZhBKMbUvOG+AmWXcnd0EvAmvuMxid3y0hnPEMS 9nB4TadlqtibbGPD/bGzDTqpXhIHZJ5kecDO+HJDShNlKoHLcDulWU6j9Vm7MQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1643812486; a=rsa-sha256; cv=none; b=KY+iLoLHXlEwWZZ89w1menlgy2zxdEFki3YBNNA7L5621/1e/h/cmBRySUnW5QCLfKTUW4 K3dfb3DBjgBuhKxHX3WpMlBL5WEomu/KGjYIiQKbuHW0MvY4/LZAG6ske/Xef6ntH4o2GH ukmwKr8WhCaV/Uf95YomRprXcMzJG+hLjJeeyAoIJcLbcYa1XQ7hx5mOzbDMstApnpWmZM 1Klrfr7a3KVP39O2J3tBUhv2vFogRP7O5yfB7c5SmgpkIjbOm72jxieQxm6JnSi3odw8rW nn+FK4xHzWLYtoJOIqK87e8V5opY1Sj4g0AEkpuuy3ZKXk9zhTlWQ+3JOA1Daw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2a01:4f9:c011:7a79::1 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: -2.83 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2a01:4f9:c011:7a79::1 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: 387412DF2F X-Spam-Score: -2.83 X-Migadu-Scanner: scn0.migadu.com X-TUID: /WwCMTxCEsMK David Bremner writes: > +(defun notmuch-tag-undo () > + (interactive) > + (when (null notmuch-tag-history) > + (error "no further notmuch undo information")) > + (let* ((action (pop notmuch-tag-history)) > + (from (plist-get action :from)) > + (to (plist-get action :to)) > + (changes (notmuch-tag-change-list (plist-get action :tag-changes) t)) > + (query (format "lastmod:%d..%d" from to))) > + (when (<= from to) > + (notmuch-tag query changes t)))) I got pretty far down this path before I realized there is a fundamantal flaw with using lastmod info for undo. With some extra work, we can only manage one level of undo, since the undo operation itself invalidates the queries in the undo history. So now I don't really know the best approach. d