From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id gACLMHQLK2A9fgAA0tVLHw (envelope-from ) for ; Tue, 16 Feb 2021 00:01:56 +0000 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id sHJlLHQLK2A7NAAAbx9fmQ (envelope-from ) for ; Tue, 16 Feb 2021 00:01:56 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [IPv6:2607:5300:201:3100::1657]) (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 6299721AC5 for ; Tue, 16 Feb 2021 01:01:56 +0100 (CET) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id E242626A3A; Mon, 15 Feb 2021 19:01:47 -0500 (EST) Received: from mail.hostpark.net (mail.hostpark.net [212.243.197.30]) by mail.notmuchmail.org (Postfix) with ESMTPS id DD66E1FC6C for ; Mon, 15 Feb 2021 19:01:44 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mail.hostpark.net (Postfix) with ESMTP id 44A16165C1 for ; Tue, 16 Feb 2021 01:01:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=bernoul.li; h= content-transfer-encoding:mime-version:x-mailer:message-id:date :date:subject:subject:from:from:received:received; s=sel2011a; t=1613433699; bh=WoAlpgkcFuamIOGl995geofRr+FeyUEsz33k4tzXky8=; b= 3c4jgi//4UgIfr4wmcmLOlQfK+noXOIEke4ZYWs9LOo+gxQTyuaSKCWvGpAEFeYL Ym6ED/mPeY/L5pwJOb7cMdacqr4uClanGpSS09EAHQg+C1OF2QhoByH5pLF7MvSP bJkFnkdrf7Bv/oJ1cUjy+o3DnbrnLOtCqKE9hscfwSo= X-Virus-Scanned: by Hostpark/NetZone Mailprotection at hostpark.net Received: from mail.hostpark.net ([127.0.0.1]) by localhost (mail0.hostpark.net [127.0.0.1]) (amavisd-new, port 10224) with ESMTP id 6Myo531zWSga for ; Tue, 16 Feb 2021 01:01:39 +0100 (CET) Received: from customer (localhost [127.0.0.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 mail.hostpark.net (Postfix) with ESMTPSA id 18C9C165C8 for ; Tue, 16 Feb 2021 01:01:39 +0100 (CET) From: Jonas Bernoulli To: notmuch@notmuchmail.org Subject: [PATCH] emacs: notmuch-tree: mark the initial message at point as read Date: Tue, 16 Feb 2021 01:01:38 +0100 Message-Id: <20210216000138.19625-1-jonas@bernoul.li> X-Mailer: git-send-email 2.30.1 MIME-Version: 1.0 Message-ID-Hash: XZVIWYOB7B7PARFPYZMPGQ25EZLM4WCI X-Message-ID-Hash: XZVIWYOB7B7PARFPYZMPGQ25EZLM4WCI X-MailFrom: jonas@bernoul.li 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; suspicious-header X-Mailman-Version: 3.2.1 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: 1.55 Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=bernoul.li header.s=sel2011a header.b="3c4jgi//"; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2607:5300:201:3100::1657 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: 6299721AC5 X-Spam-Score: 1.55 X-Migadu-Scanner: scn0.migadu.com X-TUID: PaMVMY/9GtJb When moving between message in a tree or show buffer, the message at point is marked as read. Likewise when creating such a buffer, then the message that is initially at point is supposed to be marked as read as well. The latter worked for `notmuch-show' but not for `notmuch-tree'. Press "RET" or "M-RET" in a search buffer to observe these behaviors. In both cases the marking is supposed to be done by the function `notmuch-show-command-hook'. In the case of `notmuch-show' that function is added directly to `post-command-hook'. `notmuch-tree' instead adds the function `notmuch-tree-command-hook' to `post-command-hook' and that calls `notmuch-show-command-hook', in the respective show buffer, but of course only if that exists. Because the tree buffer is created asynchronously, the show buffer doesn't exist yet by the time the `post-command-hook' is run, so we have to explicitly run `notmuch-tree-command-hook' once the show buffer exists. The show buffer is created when `notmuch-tree-goto-and-insert-msg' calls `notmuch-tree-show-message-in'. `notmuch-tree-process-filter' is what finally brings us here. --- emacs/notmuch-tree.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el index 13007a13..d9265fd5 100644 --- a/emacs/notmuch-tree.el +++ b/emacs/notmuch-tree.el @@ -949,7 +949,8 @@ (defun notmuch-tree-goto-and-insert-msg (msg) (goto-char (point-max)) (forward-line -1) (when notmuch-tree-open-target - (notmuch-tree-show-message-in))))) + (notmuch-tree-show-message-in) + (notmuch-tree-command-hook))))) (defun notmuch-tree-insert-tree (tree depth tree-status first last) "Insert the message tree TREE at depth DEPTH in the current thread. -- 2.30.1