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 ACA7GPkt02JDMQAAbAwnHQ (envelope-from ) for ; Sat, 16 Jul 2022 23:30:33 +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 wLFcGPkt02LvZwEA9RJhRA (envelope-from ) for ; Sat, 16 Jul 2022 23:30:33 +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 DEB3F2D407 for ; Sat, 16 Jul 2022 23:30:32 +0200 (CEST) Received: from yantan.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id E53645E53F; Sat, 16 Jul 2022 21:30:30 +0000 (UTC) Received: from fethera.tethera.net (fethera.tethera.net [IPv6:2607:5300:60:c5::1]) by mail.notmuchmail.org (Postfix) with ESMTP id B65665E01E for ; Sat, 16 Jul 2022 21:30:27 +0000 (UTC) Received: by fethera.tethera.net (Postfix, from userid 1001) id 068055FBD0; Sat, 16 Jul 2022 17:30:27 -0400 (EDT) Received: (nullmailer pid 59129 invoked by uid 1000); Sat, 16 Jul 2022 21:30:25 -0000 From: David Bremner To: Jon Hurst , notmuch@notmuchmail.org Subject: Re: Feature request: show destination in tree view when appropriate In-Reply-To: <877d4dry2i.fsf@hursts.org.uk> References: <87a699e6wn.fsf@hursts.org.uk> <87ilnx5mxq.fsf@tethera.net> <877d4dry2i.fsf@hursts.org.uk> Date: Sat, 16 Jul 2022 17:30:25 -0400 Message-ID: <87cze468zy.fsf@tethera.net> MIME-Version: 1.0 Message-ID-Hash: C6JZTKQQ7JPNDMCCWJEAMPC6OCP4P4QF X-Message-ID-Hash: C6JZTKQQ7JPNDMCCWJEAMPC6OCP4P4QF X-MailFrom: david@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=1658007032; 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=FUiOIrr0aEegH5QS3yp6jdUJO3DFI0OSgUHp3S2uWjg=; b=PpLElo33hX6fNt/E6Hxf9ZfMJ3VISSLAJ59kyxd7YrQSeNEuorwtO9R1E2m5e2aeQvwZJH DbN/vn8LcDsusLmJEcOo3d2tnysW64Okxonu4T2Tx7JcIPM0EjcHIUmVu+CHScc/J3ur9Z d3ehIB6CDvyXoQI2/iAEMDXVbwxR9fWILjBzniz36JmVheXvezVtQk+WraFJk0MPuCG0HV GVU7hOV8dCN+feQd1UH1Ygi/mdG0nUfk7ceWE8jitwd/xmvZY4LAqjSQ2nsmmwcEHK45uJ GWyXda0vzi/z4fVZfrwZD5waYo73w+7b27xPJOsReMtggV6vWp3dneg3YS7dmw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1658007032; a=rsa-sha256; cv=none; b=jZGl0RVfQVz6DgzI/DBaJTDsQ3u4qmXY6pY+hsXSr1zW2nnG9H41vRBp7JaH+/SijDBs+g UlGPL3i5ra3MgOPky12TlBvRk4k0LBiEd5nTgOKk1Ns+IuV/wEgdA71B18eb3Kp9gAPab/ 3ODvHFkw3tKcUu4SoJnPpccNSlAC07hFWV4ZvL9Xt7k90tuyvc2w82TaDTkDJZY1nr6FzP E3GSE/haKG41kb0D5fGfVHp/v2ta4vIwmD28sU4q+HPlBCWEAB2xtQI5wsJeubodiR/f6G YJIMQ9dKkM4lF6AdQ/BBosLaEjt4vJaM78c+fxAKFe5lYi28myHR20GkHd52vA== 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: -2.25 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: DEB3F2D407 X-Spam-Score: -2.25 X-Migadu-Scanner: scn1.migadu.com X-TUID: y3chw3w9AoXM Jon Hurst writes: > Many thanks David; just what I needed. > >> tested either, but I suppose you would need to write a function like >> author-or-to that decides for each message which of those to insert. > > For the record: > > > (defun -notmuch-authors-or-to (format-string result) > (let* ((headers (plist-get result :headers)) > (match (plist-get result :match)) > (to (plist-get headers :To)) > (author (notmuch-tree-clean-address (plist-get headers :From))) > (len (length (format format-string ""))) > (face (if match > 'notmuch-tree-match-author-face > 'notmuch-tree-no-match-author-face))) > (if (string= author "Jon Hurst") > (setq author (concat "To:" (notmuch-tree-clean-address to)))) > (when (> (length author) len) > (setq author (substring author 0 len))) > (propertize (format format-string author) 'face face))) > > > (setq notmuch-tree-result-format > '(("date" . "%12s ") > (-notmuch-authors-or-to . "%-25s") > ((("tree" . "%s") > ("subject" . "%s")) > . " %-54s ") > ("tags" . "(%s)"))) Nice. I hope you don't mind, but I used a modified version of this code as an example for the the documentation: https://nmbug.notmuchmail.org/nmweb/show/20220716212228.56432-5-david%40tethera.net