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 wO6RCoQYCGJOywAAgWs5BA (envelope-from ) for ; Sat, 12 Feb 2022 21:28:52 +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 WAjoB4QYCGKMHQEA9RJhRA (envelope-from ) for ; Sat, 12 Feb 2022 21:28:52 +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)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id CD5712BCF0 for ; Sat, 12 Feb 2022 21:28:51 +0100 (CET) Received: from yantan.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 588DB5F738; Sat, 12 Feb 2022 20:28:41 +0000 (UTC) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by mail.notmuchmail.org (Postfix) with ESMTP id 72B215F731 for ; Sat, 12 Feb 2022 20:28:38 +0000 (UTC) Received: by fethera.tethera.net (Postfix, from userid 1001) id B57ED5FBD2; Sat, 12 Feb 2022 15:28:37 -0500 (EST) Received: (nullmailer pid 2577370 invoked by uid 1000); Sat, 12 Feb 2022 20:27:56 -0000 From: David Bremner To: notmuch@notmuchmail.org Subject: [PATCH v4 09/11] emacs: redirect undo to notmuch-tag-undo Date: Sat, 12 Feb 2022 16:27:40 -0400 Message-Id: <20220212202742.2577237-10-david@tethera.net> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220212202742.2577237-1-david@tethera.net> References: <20220212202742.2577237-1-david@tethera.net> MIME-Version: 1.0 Message-ID-Hash: 6PSW2KONGCH5XN2MXQNRTQQQFEDYPSR3 X-Message-ID-Hash: 6PSW2KONGCH5XN2MXQNRTQQQFEDYPSR3 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=1644697731; 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=ag6JCEHTkOSXTxhcby507LfFt/bjVPxQyLJqdEnCqWw=; b=YtG8NqGcyWuVNUJlGC6pDwJDnf9wQ5HeoBVTpfYd+ZGnNFb2x/jmsKck7TE6pqUgM93WvJ Lhk+jBO6ovFdiUJVY5bLt6rWPqWVguW3C/ZtjnijQxz5paPKrTRLq8TPmVSOXHZ57HNW7v 76H6qZS+b3/9Wr96YhAC+8H4nqShCaB/swW3F05j9JWQrb9rHkRPDhzqAbOwnHqpqAlj3F EHptuZaXDR1tp2HgMBFLYnMwI9zHmOpUe6nx4popT/mWotHloE9+Gcb8c7KNSIuK9AIVI1 CvI3Ask3WqkjP6KwvH9IaKHbPCsJWdZ0j30LRtruAV5OghdttSxdQSFcjU4i4g== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1644697731; a=rsa-sha256; cv=none; b=csoVVG84hgu32AkJzy3LmsCg4YkIn452/oOkCtbhysRSsQXIPgE2Pus2Y2DEyxvScnqSol XwTIHy0fwlI0ivbKvlx2Wut7PYZDYzMvpSSpXtBN0Ox84ZzWDKOQJVMbmWLTKbZW7mCKiE ZznoUG1dh/262LZXZ2ogzhdo1V8L0BS4t1rH/Wye3xrvSG4EuweSxkTDZw9cL7Hg/HJdb3 X6LypZG8EU3LPsapW5/9oEIFozc23VQ5eeW67t+NC+d/LKvFPXzxr54aru+HB3DWfwr0mP FwAtwBB9835wVG1P33M23tBIfk2HR8BGlcF0q9L4vQQn+XewLikE7D0tSUkYlw== 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.84 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: CD5712BCF0 X-Spam-Score: -1.84 X-Migadu-Scanner: scn0.migadu.com X-TUID: 7Oth+XhCTTIW 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 | 11 ++++++++++- 3 files changed, 14 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 fbaf5f22..c26413ce 100755 --- a/test/T315-emacs-tagging.sh +++ b/test/T315-emacs-tagging.sh @@ -151,7 +151,16 @@ 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\")) + (notmuch-test-wait))" + count=$(notmuch count "tag:tag-to-be-undone-$mode") + test_expect_equal "$count" "0" +done test_done -- 2.34.1