From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id gLCdNiprv2KU5gAAbAwnHQ (envelope-from ) for ; Fri, 01 Jul 2022 23:46:18 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id 6GV2Niprv2LKjwAA9RJhRA (envelope-from ) for ; Fri, 01 Jul 2022 23:46:18 +0200 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 66B742B8D7 for ; Fri, 1 Jul 2022 23:46:18 +0200 (CEST) Received: from yantan.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 710885F80E; Fri, 1 Jul 2022 21:46:01 +0000 (UTC) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by mail.notmuchmail.org (Postfix) with ESMTP id DF66E5F807 for ; Fri, 1 Jul 2022 21:45:57 +0000 (UTC) Received: by fethera.tethera.net (Postfix, from userid 1001) id 1442B5FBD7; Fri, 1 Jul 2022 17:45:56 -0400 (EDT) Received: (nullmailer pid 462226 invoked by uid 1000); Fri, 01 Jul 2022 21:45:50 -0000 From: David Bremner To: notmuch@notmuchmail.org Subject: [PATCH 9/9] emacs/reply: reply to correct duplicate Date: Fri, 1 Jul 2022 18:45:48 -0300 Message-Id: <20220701214548.461943-10-david@tethera.net> X-Mailer: git-send-email 2.35.2 In-Reply-To: <20220701214548.461943-1-david@tethera.net> References: <20220701214548.461943-1-david@tethera.net> MIME-Version: 1.0 Message-ID-Hash: LWOI77XAAO32XHOUMX73QRDR3SOPZ5DZ X-Message-ID-Hash: LWOI77XAAO32XHOUMX73QRDR3SOPZ5DZ 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-To: larch@yhetil.org X-Migadu-Country: DE ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1656711978; 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=mH3WklepkkO0ebfDospe9F0jkvyhbaSsFdV/E+ujyOs=; b=K4BsTAQBTkuYC2r9EKXOfLzcJEQ2iK6pngTshH20+MA4QTiFYwHlPQ6o3NHqQofdcVdX2e iLGha81bWH17zSv3xqkLUIAUAAZn5uOtJfl3IiT+/DNazVB3MeTt0neYm0XsP+T1TNUQGK ZPWw0K5983OeQjD6p4e73qas+iSycct7HOQBW5/LPDSWqfs1XAMKnkV+jGDqiMku14ghpP aIW8KGXYlicFJwBciYIgQCQ+UiMkZ4/qoKAcMxoaD1jHXb/YATt990BY3rdML4vWKPXV/q 0NuoPm/DQuWigfL0zHh3bnDFU8jFAjknFs/F2d9AE2u7/cnxwmx5fqo8ygbcdw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1656711978; a=rsa-sha256; cv=none; b=m0PlY040OLWx4Kf4lTa6fehV4yb2ciraMTAvKM9VbG4B8QXuzr6wtezvKVKPCKwLoAP4Ac Iay9UqyXw7+j+O6/vFfHEdPhHvQo/2mCDm23tuSbtNB9Q+lyVGiF0MSI1DV5kjbwtwLOSz eZuHdKOMrXnEwDbB1N++tOqSzbIaOM70/LjlIkYX0tvbvoeHJeSQsu7I4GwH/BJKzWQQtS GQQjdkmq39kydkzzXpiRYm7Y4i6Tehn/f610um9PqQfvT3ZT6130oZ2btuRtUO2BhwoSjc 6tjDtBGC3zeHdBwXJ+idlZkAYf6pw7vyryAatbdXKIfyvL9TdpahBs8WzMPRDg== 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.20 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: 66B742B8D7 X-Spam-Score: -1.20 X-Migadu-Scanner: scn1.migadu.com X-TUID: +HhUnAC+G1Co Essentially we just need to arrange to pass the right --duplicate argument to notmuch reply. As a side-effect, correct the previously unused value of EXPECTED in T453-emacs-reply.sh. --- emacs/notmuch-mua.el | 18 +++++---- emacs/notmuch-show.el | 6 ++- test/T453-emacs-reply.sh | 39 ++++++++++++++++++- .../notmuch-reply-duplicate-4 | 21 ++++++++++ 4 files changed, 73 insertions(+), 11 deletions(-) create mode 100644 test/emacs-reply.expected-output/notmuch-reply-duplicate-4 diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el index 0f9ef3c2..ac878a61 100644 --- a/emacs/notmuch-mua.el +++ b/emacs/notmuch-mua.el @@ -237,11 +237,12 @@ Typically this is added to `notmuch-mua-send-hook'." ;;; Mua reply -(defun notmuch-mua-reply (query-string &optional sender reply-all) - (let ((args '("reply" "--format=sexp" "--format-version=5")) - (process-crypto notmuch-show-process-crypto) - reply - original) +(defun notmuch-mua-reply (query-string &optional sender reply-all duplicate) + (let* ((duparg (and duplicate (list (format "--duplicate=%d" duplicate)))) + (args `("reply" "--format=sexp" "--format-version=5" ,@duparg)) + (process-crypto notmuch-show-process-crypto) + reply + original) (when process-crypto (setq args (append args '("--decrypt=true")))) (if reply-all @@ -540,12 +541,13 @@ the From: address." (message-hide-headers) (set-buffer-modified-p nil)))) -(defun notmuch-mua-new-reply (query-string &optional prompt-for-sender reply-all) +(defun notmuch-mua-new-reply (query-string &optional prompt-for-sender reply-all duplicate) "Compose a reply to the message identified by QUERY-STRING. If PROMPT-FOR-SENDER is non-nil, the user will be prompted for the From: address first. If REPLY-ALL is non-nil, the message -will be addressed to all recipients of the source message." +will be addressed to all recipients of the source message. If +DUPLICATE is non-nil, based the reply on that duplicate file" ;; `select-active-regions' is t by default. The reply insertion code ;; sets the region to the quoted message to make it easy to delete ;; (kill-region or C-w). These two things combine to put the quoted @@ -560,7 +562,7 @@ will be addressed to all recipients of the source message." (let ((sender (and prompt-for-sender (notmuch-mua-prompt-for-sender))) (select-active-regions nil)) - (notmuch-mua-reply query-string sender reply-all) + (notmuch-mua-reply query-string sender reply-all duplicate) (deactivate-mark))) ;;; Checks diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index ee01e470..cc34876b 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -2020,13 +2020,15 @@ any effects from previous calls to (defun notmuch-show-reply (&optional prompt-for-sender) "Reply to the sender and all recipients of the current message." (interactive "P") - (notmuch-mua-new-reply (notmuch-show-get-message-id) prompt-for-sender t)) + (notmuch-mua-new-reply (notmuch-show-get-message-id) prompt-for-sender t + (notmuch-show-get-prop :duplicate))) (put 'notmuch-show-reply-sender 'notmuch-prefix-doc "... and prompt for sender") (defun notmuch-show-reply-sender (&optional prompt-for-sender) "Reply to the sender of the current message." (interactive "P") - (notmuch-mua-new-reply (notmuch-show-get-message-id) prompt-for-sender nil)) + (notmuch-mua-new-reply (notmuch-show-get-message-id) prompt-for-sender nil + (notmuch-show-get-prop :duplicate))) (put 'notmuch-show-forward-message 'notmuch-prefix-doc "... and prompt for sender") diff --git a/test/T453-emacs-reply.sh b/test/T453-emacs-reply.sh index c26c4473..0a27d066 100755 --- a/test/T453-emacs-reply.sh +++ b/test/T453-emacs-reply.sh @@ -4,7 +4,7 @@ test_description="emacs reply" . $(dirname "$0")/test-lib.sh || exit 1 . $NOTMUCH_SRCDIR/test/test-lib-emacs.sh || exit 1 -EXPECTED=$NOTMUCH_SRCDIR/test/emacs-show.expected-output +EXPECTED=$NOTMUCH_SRCDIR/test/emacs-reply.expected-output test_require_emacs @@ -31,4 +31,41 @@ EOF notmuch_dir_sanitize < OUTPUT.raw > OUTPUT test_expect_equal_file EXPECTED OUTPUT +add_email_corpus duplicate + +ID2=87r2geywh9.fsf@tethera.net +for dup in {1..2}; do + test_begin_subtest "body, duplicate=${dup}" + test_emacs "(notmuch-show \"id:${ID2}\") + (notmuch-test-wait) + (notmuch-show-choose-duplicate $dup) + (notmuch-test-wait) + (notmuch-show-reply) + (test-visible-output \"OUTPUT.raw\")" + output=$(grep '^> # body' OUTPUT.raw) + test_expect_equal "$output" "> # body ${dup}" +done + +ID3=87r2ecrr6x.fsf@zephyr.silentflame.com +test_begin_subtest "duplicate=3, subject" +test_emacs "(notmuch-show \"id:${ID3}\") + (notmuch-test-wait) + (notmuch-show-choose-duplicate 3) + (notmuch-test-wait) + (notmuch-show-reply) + (test-visible-output \"OUTPUT\")" +output=$(sed -n 's/^Subject: //p' OUTPUT) +file=$(notmuch search --output=files id:${ID3} | head -n 3 | tail -n 1) +subject=$(sed -n 's/^Subject: //p' $file) +test_expect_equal "$output" "Re: $subject" + +test_begin_subtest "duplicate=4" +test_emacs "(notmuch-show \"id:${ID3}\") + (notmuch-show-choose-duplicate 4) + (notmuch-test-wait) + (notmuch-show-reply) + (test-visible-output \"OUTPUT.raw\")" +notmuch_dir_sanitize < OUTPUT.raw > OUTPUT +test_expect_equal_file_nonempty $EXPECTED/notmuch-reply-duplicate-4 OUTPUT + test_done diff --git a/test/emacs-reply.expected-output/notmuch-reply-duplicate-4 b/test/emacs-reply.expected-output/notmuch-reply-duplicate-4 new file mode 100644 index 00000000..836f77b1 --- /dev/null +++ b/test/emacs-reply.expected-output/notmuch-reply-duplicate-4 @@ -0,0 +1,21 @@ +From: Notmuch Test Suite +To: Sean Whitton , 916811@bugs.debian.org, 916805@bugs.debian.org, 916807@bugs.debian.org, 916808@bugs.debian.org, 916809@bugs.debian.org, 916811@bugs.debian.org, 916867@bugs.debian.org, 916869@bugs.debian.org, 916872@bugs.debian.org, 916875@bugs.debian.org, 916876@bugs.debian.org +Subject: Re: [Pkg-emacsen-addons] Bug#916811: Increase severity to 'serious' +In-Reply-To: <87r2ecrr6x.fsf@zephyr.silentflame.com> +Fcc: MAIL_DIR/sent +--text follows this line-- +Sean Whitton writes: + +> control: severity -1 serious +> +> Hello, +> +> Emacs 26.1 has reached Debian unstable (sooner than expected; sorry for +> all the e-mails). +> +> -- +> Sean Whitton +> _______________________________________________ +> Pkg-emacsen-addons mailing list +> Pkg-emacsen-addons@alioth-lists.debian.net +> https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/pkg-emacsen-addons -- 2.35.2