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 ms5.migadu.com with LMTPS id 4GG+E0oQ/GJ46QAAbAwnHQ (envelope-from ) for ; Tue, 16 Aug 2022 23:46:50 +0200 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 IOzBE0oQ/GIEzQAAauVa8A (envelope-from ) for ; Tue, 16 Aug 2022 23:46:50 +0200 Received: from mail.notmuchmail.org (yantan.tethera.net [135.181.149.255]) (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 054AC3E2AA for ; Tue, 16 Aug 2022 23:46:50 +0200 (CEST) Received: from yantan.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 714F15FD30; Tue, 16 Aug 2022 21:40:47 +0000 (UTC) Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by mail.notmuchmail.org (Postfix) with ESMTPS id 21E0C5F3E2 for ; Tue, 16 Aug 2022 21:40:45 +0000 (UTC) Received: from fencepost.gnu.org ([2001:470:142:3::e]:42048) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oO4Ik-0001No-Vb; Tue, 16 Aug 2022 17:40:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:Subject:To:From:in-reply-to: references; bh=stm4HSjqpS1pUT2y0Iu8QM+QqipjMp8ZOr3NF7PNgSk=; b=jzIVy7wy8axB9e 7x1jNLA+J6PF+qyA0HbEbGWoGQ4JSD6s8Wy6NaCo7oASs9001cOg7YMBG/qqhQ10D0Ak9kqe400T8 byF62nV8kpRqDRhI0+Eo6/tXlga5/qo6c+kWM/gXRVosi3OCC4J5omuj7x5gW4b21SF45s84X3nN/ f8g0Ekgo63oRV7U3Qd7lBIi3+/qQRJOSFvf5/lTYzRbmv86j/zCa2/hLO2Xm4a1O0nPveBTZDBE7L E1QiV3tTKMK2iK5J+4iFI8T0nHQJEzcRNqU4VGJq0bHUwkFEPAJxzq2PYTKtKwe9pLgX5qBjyNanA U8MsMlorQ6xTXqjqI/2A==; Received: from cpc103048-sgyl39-2-0-cust502.18-2.cable.virginm.net ([92.233.85.247]:37216 helo=rivendell.localdomain) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oO4Ik-0008MI-J1; Tue, 16 Aug 2022 17:40:42 -0400 From: jao To: notmuch@notmuchmail.org Subject: [PATCH] emacs: new notmuch-tree-process-hook Date: Tue, 16 Aug 2022 22:40:23 +0100 Message-Id: <20220816214023.1523322-1-jao@gnu.org> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 Message-ID-Hash: OQTJINP2NXE62NDEE6SZRDALDFPWRTAI X-Message-ID-Hash: OQTJINP2NXE62NDEE6SZRDALDFPWRTAI X-MailFrom: jao@gnu.org 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 CC: jao 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=1660686410; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-owner:list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=J2t0tA9q9X31ww9yzOg86yG0vztlWxz4T//1uJyob9k=; b=opxXEp+NZUT93jTD3w0JO5JWZMqZIimuWF3z6CnDEj/w+696kkliOWGHRNZrHm3kYRxncd Wsytye7JGifUBbWU9e1qnPVzrHn0yZwPgPkve6TosvphYLSwaW51yOtrp1TyUYfXgSTazR ohWdfbPzX/LB6/ba6K4oDLGdRj38RQ9m8YhXaao2SufocZWRDp1FKEmzvZYmENPtESPKeF WiG8h5x9qTfMBLj/kj8wn3WEs8DxzbHtPORIxRP0IzZiuHOdeDgbuq/FdHrV3en/ltKdfB tX2SoBWdlO3Zku2QWL3bVkc20jl/AgGy5jXYDcKNCgvizyz1kRJ6ErG5JR8Y/Q== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1660686410; a=rsa-sha256; cv=none; b=AwKfogbfdAIwaoSiB2B8+KHuaC6s/4PHwYu+xk0pXAUL1R2WVzWP1V9URWBGq5/06jJnqL MLkHT+JioowkEYj/Xhnn8hATSLX22CylfHSzL0fgoRzv5r2GuldEoMvwOioOuKPfOr0zWt iLpXnMnjzoelbh4OI/hgbSL5CGGC9ab3gf0wI4tk0BcnZH96qRlCiLr1+8NFnn+nBooL8k Nq9hjL0BiEo5cU6iPhjdqh/MBCXryHEJIuk9pmwtVeZHIwxRk8VFl0oLjkNYfjLeLOU/y5 xObF7YvAy91j1mbQnIpKFoGBDsrpDb/S98fiOvMrgq6xdFrqz08EePunDcLiLw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gnu.org header.s=fencepost-gnu-org header.b=jzIVy7wy; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gnu.org (policy=none); spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 135.181.149.255 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: 7.71 Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gnu.org header.s=fencepost-gnu-org header.b=jzIVy7wy; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gnu.org (policy=none); spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 135.181.149.255 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: 054AC3E2AA X-Spam-Score: 7.71 X-Migadu-Scanner: scn0.migadu.com X-TUID: r+IV0eqPZeG8 Hook run when the tree insertion process finishes its job. -- Right now, it can be used for silly things like removing or changing the the "End of search." hardcoded message in the tree buffer. But also for more sophisticated things like folding all threads in add-ons like my outline mode for tree buffers (to be submitted). Signed-off-by: jao --- emacs/notmuch-tree.el | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el index f63ac9a5..265f7c1f 100644 --- a/emacs/notmuch-tree.el +++ b/emacs/notmuch-tree.el @@ -1084,6 +1084,12 @@ Complete list of currently available key bindings: (setq buffer-read-only t) (setq truncate-lines t)) +(defvar notmuch-tree-process-hook nil + "Hook executed when the process inserting a tree of results finishes. + +Functions in this hook are called with one argument, the process +object, with the tree results buffer as the current buffer.") + (defun notmuch-tree-process-sentinel (proc _msg) "Add a message to let user know when \"notmuch tree\" exits." (let ((buffer (process-buffer proc)) @@ -1102,7 +1108,8 @@ Complete list of currently available key bindings: (insert "End of search results.") (unless (= exit-status 0) (insert (format " (process returned %d)" exit-status))) - (insert "\n"))))))))) + (insert "\n")))) + (run-hook-with-args 'notmuch-tree-process-hook proc)))))) (defun notmuch-tree-process-filter (proc string) "Process and filter the output of \"notmuch show\" for tree view." -- 2.37.2