From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id 2F9YBjIs02JtJgEAbAwnHQ (envelope-from ) for ; Sat, 16 Jul 2022 23:22:58 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id wDRRBTIs02J43QAAG6o9tA (envelope-from ) for ; Sat, 16 Jul 2022 23:22:58 +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 C8AFC3BD5C for ; Sat, 16 Jul 2022 23:22:57 +0200 (CEST) Received: from yantan.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 5FCD960825; Sat, 16 Jul 2022 21:22:46 +0000 (UTC) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by mail.notmuchmail.org (Postfix) with ESMTP id 870AE5E53F for ; Sat, 16 Jul 2022 21:22:42 +0000 (UTC) Received: by fethera.tethera.net (Postfix, from userid 1001) id D7F525FBD0; Sat, 16 Jul 2022 17:22:41 -0400 (EDT) Received: (nullmailer pid 56488 invoked by uid 1000); Sat, 16 Jul 2022 21:22:37 -0000 From: David Bremner To: notmuch@notmuchmail.org Subject: [PATCH 4/6] doc/emacs: add docstring and example for n-tree-result-format Date: Sat, 16 Jul 2022 17:22:26 -0400 Message-Id: <20220716212228.56432-5-david@tethera.net> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220716212228.56432-1-david@tethera.net> References: <20220716212228.56432-1-david@tethera.net> MIME-Version: 1.0 Message-ID-Hash: NAWV5CPZXKRIM6TUNO777V3OFCIGMZLA X-Message-ID-Hash: NAWV5CPZXKRIM6TUNO777V3OFCIGMZLA 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=1658006577; 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=OjeoMlzqmV6a349sI6CXLj4fGmViwMwr1U3sQxHTEJE=; b=odSRWFiaQHhddDWhgm/2+cpMlJMr9pE19IfUKVmxw+nlh267yp4erRveocWEcY/wVGZrAb PZCQLECaaBvwae9q4JqNECnnInO/7b3ctYqB5wOTXEAKIDS9AiCZP83iNqXo8uAhqOV4VQ apHsDTQ/lFnJfI++80ZvFUbKRHB2yzQG2glEbHFLB0XajiHQ18vhG4rqBrFWhfD1mnGEqW 28HO+7aSSiyxsahpQPef7y5kRX18iw7CzEffSYJ/5RamUdiiKr1Rvi3b8lZgnQptKkzx1z C/OtI9IL3q1Dw3yDbN0HrYAY/0zVVM9WCzhGi4jkiHNmq806I/ue/gFsjE2j5A== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1658006577; a=rsa-sha256; cv=none; b=Ttn41Otk2EtFatVEuFHY2zhkMWyv55M4OSz9Vdz9KdahzrljY1HlTMmHvzw0iL+NhjSCrK /qJinGaDJ+8X3V7X6vGkOjWtU2ZipouE6f4XzBlRJyy9uDQgxJfYgerFBNq7J/H6tnnkIC FDIoGnRCes+TNuS/4xTrPl72xllHeSqM0CmKjDbecUH9W742yVDFPg7uLUd6QGuTP3UxYe 8Y5UB1U+OxDZ4qMLZ9dQnijffPNi2jaJ8Re61Eb2Tu3XKzMpNzaBJkdMaWN6p628oVNTBY k2sO/uFxcJqKU3aslTm5Ly+v6AO1kaDM3S0UMGTDrfe3tmMT9xGc8Vm8FgB/dg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=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: -1.75 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=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: C8AFC3BD5C X-Spam-Score: -1.75 X-Migadu-Scanner: scn0.migadu.com X-TUID: c+65VCS1+ryg This example is based on one originally by Jon Hurst. --- doc/notmuch-emacs.rst | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/doc/notmuch-emacs.rst b/doc/notmuch-emacs.rst index 49111d28..44dca384 100644 --- a/doc/notmuch-emacs.rst +++ b/doc/notmuch-emacs.rst @@ -253,6 +253,8 @@ variables. ("subject" . "%s ") ("tags" . "(%s)"))) + See also :emacsvar:`notmuch-tree-result-format`. + .. emacsvar:: notmuch-search-oldest-first Display the oldest threads at the top of the buffer @@ -475,6 +477,39 @@ tags. As is the case with :ref:`notmuch-search`, the presentation of results can be controlled by the variable ``notmuch-search-oldest-first``. +.. emacsvar:: notmuch-tree-result-format + + |docstring::notmuch-tree-result-format| + + The following example shows how to optionally display recipients instead + of authors for sent mail (assuming the user is named Mustermann). + + .. code:: lisp + + (defun -notmuch-authors-or-to (format-string result) + (let* ((headers (plist-get result :headers)) + (to (plist-get headers :To)) + (author (plist-get headers :From)) + (face (if (plist-get result :match) + 'notmuch-tree-match-author-face + 'notmuch-tree-no-match-author-face))) + (propertize + (format format-string + (if (string-match "Mustermann" author) + (concat "To:" (notmuch-tree-clean-address to)) + author)) + 'face face))) + + (setq notmuch-tree-result-format + '(("date" . "%12s ") + (-notmuch-authors-or-to . "%-20.20s") + ((("tree" . "%s") + ("subject" . "%s")) + . " %-54s ") + ("tags" . "(%s)"))) + + See also :emacsvar:`notmuch-search-result-format`. + .. _notmuch-unthreaded: notmuch-unthreaded -- 2.35.1