From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.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 QNDHDs7n+2GRGwEAgWs5BA (envelope-from ) for ; Thu, 03 Feb 2022 15:33:50 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id eNhnC87n+2F0vQAAauVa8A (envelope-from ) for ; Thu, 03 Feb 2022 15:33:50 +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 DBBE22B76F for ; Thu, 3 Feb 2022 15:33:49 +0100 (CET) Received: from yantan.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 3BBAE5F73C; Thu, 3 Feb 2022 14:33:11 +0000 (UTC) Received: from fethera.tethera.net (fethera.tethera.net [IPv6:2607:5300:60:c5::1]) by mail.notmuchmail.org (Postfix) with ESMTP id CD16E5F726 for ; Thu, 3 Feb 2022 14:33:07 +0000 (UTC) Received: by fethera.tethera.net (Postfix, from userid 1001) id 510925FC01; Thu, 3 Feb 2022 09:33:07 -0500 (EST) Received: (nullmailer pid 3348422 invoked by uid 1000); Thu, 03 Feb 2022 14:32:56 -0000 From: David Bremner To: notmuch@notmuchmail.org Subject: [RFC PATCH v2 10/12] emacs: redirect undo to notmuch-tag-undo Date: Thu, 3 Feb 2022 10:32:52 -0400 Message-Id: <20220203143254.3344753-11-david@tethera.net> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220203143254.3344753-1-david@tethera.net> References: <20220203143254.3344753-1-david@tethera.net> MIME-Version: 1.0 Message-ID-Hash: E7G3BQHCXWFPCY4K5DGKECRGGCVURUOK X-Message-ID-Hash: E7G3BQHCXWFPCY4K5DGKECRGGCVURUOK X-MailFrom: bremner@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=1643898829; 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=zDAIXFIlE3FDmIRWL1bMB6bwCbmFplMKWYa1m9Y8U7w=; b=mYplaukszmhIlcYuiivnjJ9bJl+fTAhQkBilpGjN1+pKTGmgqzhz9TTr4H2cVvjkbvg/sd 710xoL5GLxDdYHKiinUSUEKW16tx5WX9iPZ9aTol1J8weaubs2d1hj0YvyOD1PRkeKBK36 e39sVqECYGZiBRtXOrpd7w91z4jcBaHeuJdCAxTmgn5a2W/OeCtYTd0Vmxr+kALrTjzL17 TYGNH/JjwBdjcyyft16ZfD9TI4IHOPJ730NGWFGtwT1ZXh4NecSW1109ltVSsoBUAMxBOa hHL7nry+HPEr+26qU1ehe0j5/uSjNR+NKQCSJLDG7OC4weeL6cgfF3oJCKMH5A== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1643898829; a=rsa-sha256; cv=none; b=quHTe0NMkvl7VZiCJ8f0oO2qHaYIQ4EYWzJd4xLbFPaBVgq38FdJB3GqqRtfWPP8+fTAAE n66+/bJYeFEIR3QjJEEQAgdnFzL4lkoF1Ej3iLzuQQapFxpDI2qGO7KxBPaK+me8DztrXn U78FneKRixGPnZKjnawHiOBuahHEIQLOSKsTrkg9cbLOvc5buj5wQW2slNNU0NYDDpG06d lHolJn453YKul6mqVYHrzj5Ckw/syjPHRWLR9UQ7X7yApk1098SzZa9t6gNalBYDdv9DK+ QSaWaBb2i+BMiHrppA/PDBWnI0gqLXaL5E65j8gBLkZfcTdqK29TZHVuVusTSw== 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: -1.35 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: DBBE22B76F X-Spam-Score: -1.35 X-Migadu-Scanner: scn1.migadu.com X-TUID: eJM4N71YsY9t The double remap is a bit ugly, but it seems better than adding another layer of keymaps for those modes where notmuch-tag-undo makes sense. --- emacs/notmuch-hello.el | 3 +++ emacs/notmuch-lib.el | 1 + test/T315-emacs-tagging.sh | 10 +++++++++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index beb25382..4662e704 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -710,6 +710,9 @@ with `notmuch-hello-query-counts'." ;; that when we modify map it does not modify widget-keymap). (let ((map (make-composed-keymap (list (make-sparse-keymap) widget-keymap)))) (set-keymap-parent map notmuch-common-keymap) + ;; Currently notmuch-hello-mode supports free text entry, but not + ;; tagging operations, so provide standard undo. + (define-key map [remap notmuch-tag-undo] #'undo) map) "Keymap for \"notmuch hello\" buffers.") diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index 45817e13..6fc71cc7 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -166,6 +166,7 @@ For example, if you wanted to remove an \"inbox\" tag and add an (define-key map (kbd "M-=") 'notmuch-refresh-all-buffers) (define-key map "G" 'notmuch-poll-and-refresh-this-buffer) (define-key map "j" 'notmuch-jump-search) + (define-key map [remap undo] 'notmuch-tag-undo) map) "Keymap shared by all notmuch modes.") diff --git a/test/T315-emacs-tagging.sh b/test/T315-emacs-tagging.sh index d76b5ab8..c9e3e53a 100755 --- a/test/T315-emacs-tagging.sh +++ b/test/T315-emacs-tagging.sh @@ -153,7 +153,15 @@ for mode in search show tree unthreaded; do output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize) notmuch tag "-one-$mode" "-three-$mode" $os_x_darwin_thread test_expect_equal "$output" "thread:XXX 2009-11-18 [4/4] Jjgod Jiang, Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox three-$mode unread)" -done + test_begin_subtest "undo tagging in $mode mode (via binding)" + test_emacs "(let ((notmuch-tag-history nil)) + (notmuch-$mode \"$os_x_darwin_thread\") + (notmuch-test-wait) + (execute-kbd-macro \"+tag-to-be-undone-$mode\") + (execute-kbd-macro (kbd \"C-x u\")))" + count=$(notmuch count "tag:tag-to-be-undone-$mode") + test_expect_equal "$count" "0" +done test_done -- 2.34.1