From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.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 gC+yAjWnkGKrcgEAbAwnHQ (envelope-from ) for ; Fri, 27 May 2022 12:25:57 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id 8Le0AjWnkGKyKQEA9RJhRA (envelope-from ) for ; Fri, 27 May 2022 12:25:57 +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 7BF9612BDD for ; Fri, 27 May 2022 12:25:56 +0200 (CEST) Received: from yantan.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id C97515F79D; Fri, 27 May 2022 10:19:23 +0000 (UTC) Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by mail.notmuchmail.org (Postfix) with ESMTPS id 9D32B5E00F for ; Fri, 27 May 2022 00:26:09 +0000 (UTC) Received: from fencepost.gnu.org ([2001:470:142:3::e]:48548) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nuNnq-0001MY-J3; Thu, 26 May 2022 20:26:06 -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:References:In-Reply-To:Subject:To: From; bh=di86dTnmV1jDUqnlQCMr7jZ4xUDnv6jVF/rdb40I9tY=; b=UZc4y3Fp5yJRs//+8qFo 4QjsExNI9iG7x+KBesBAUrPBlIsANjbiqR/ZM3d2QjIWYgovU0NEL0xrmZ4PY2dE0kLY+jVMLmUML rlg3Ly0kx0xbShTRJ3GN/bRPwoyoDfnwrdixOr3nkloqESpLl6xwMtix9UaR6GG6c8NKh5lBbgxUN 6prOrNAGjAW0XYj/jz/bAV8D2M1HV8ZQlv36nKDiGfB4rkeP3vNGVP/XPgLLYURID2mbCINsYUOLN 6P2s9YaJQaAtQzHaR3OZcuW6Ep7EdDZuzlV0h44aDFTbGfgw3NE5dDS/ghDWmI5VnVjSWYaTryw1O ADP7knkr8JZu3Q==; Received: from cpc103048-sgyl39-2-0-cust502.18-2.cable.virginm.net ([92.233.85.247]:38432 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 1nuNnq-0002OY-6R; Thu, 26 May 2022 20:26:06 -0400 Received: from localhost (rivendell.localdomain [local]) by rivendell.localdomain (OpenSMTPD) with ESMTPA id c3ea6c6b; Fri, 27 May 2022 00:26:03 +0000 (UTC) From: Jose A Ortega Ruiz To: David Bremner , notmuch@notmuchmail.org Subject: Re: [PATCH] emacs: notmuch-show-header-line: allow format strings and functions In-Reply-To: <87zgj34zuf.fsf@tethera.net> References: <20220518192956.1440103-1-jao@gnu.org> <20220518192956.1440103-2-jao@gnu.org> <87zgj34zuf.fsf@tethera.net> X-Attribution: jao X-Clacks-Overhead: GNU Terry Pratchett X-URL: Date: Fri, 27 May 2022 01:26:03 +0100 Message-ID: <87czfzg6sk.fsf@gnus.jao.io> MIME-Version: 1.0 X-MailFrom: jao@gnu.org X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0 Message-ID-Hash: LX4QYCWC5OOJAPGVFZECGES7QLAFTXDF X-Message-ID-Hash: LX4QYCWC5OOJAPGVFZECGES7QLAFTXDF X-Mailman-Approved-At: Fri, 27 May 2022 10:19:22 +0000 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=1653647156; 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:dkim-signature; bh=SdsJKenvsc6MFZWNuIWRZxNhcJjCBbcxptb+Foy0mH4=; b=PWQHAqB4dhpHylz/2tAEWhuddIjoeD+IigUCkBgZwQ88BoWiqKImWLLoQQV5577BBruq6e QV2sxtVmTLk74jcACe1isMuj0McU4nDHAh58oFu7FzJ6YBRxwpxRQ8/SajALfUUhjd6xuc ZmMKNUbcuKQ9QlG2XEFIZZu8QtHEmls0Y3Eyq9R9FPytPer3zYOKNp91owbGv2jJe+vJPn Gc+VDEoK6ClwbzFwkEUTsvv3YQ//0eCz46FewtPRi/ZOMAKcWMkIIVK9GQCAm1Tw0gRBrY tWQ/uGAqVcdhDppliibfS9gFZcYSiYwVgLR2gH0CO9kpGX3cbkQPaoLe8pqk6g== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1653647156; a=rsa-sha256; cv=none; b=IovX4lY8IB6l+rp2sHQ4w493Rhoe4S+se538PoTnUYrgcnNjL6OS68sqFflJEpR7K+4nwL g6aeeLnKdSNho8ci95bvNT9IBXk5Wjv6xr2HWhqklCuignOCYk1vCoGwJBUCsrE5VLKbxs umkNWi5FD3SOVXCR/SsDG6MMMjHpPI336crKZP7u5d1ZWVyU0PwohXEzbZ+Wmcce1qeynt Ij/jh6Va4UAw8miP2yCbxvvT26e4/GPjU8MlThKSRWTReNSPYganHqRl2IDRt+LzMF9n6o NF5czPXaU+krmqxTjbvR5UbrDOhZCYxkqBiE21geYxyuKarrYIt/baljpmXUzA== 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=UZc4y3Fp; 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.45 Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gnu.org header.s=fencepost-gnu-org header.b=UZc4y3Fp; 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: 7BF9612BDD X-Spam-Score: 7.45 X-Migadu-Scanner: scn1.migadu.com X-TUID: XTz8MyueH8WR On Thu, May 26 2022, David Bremner wrote: > jao writes: > >> If a string value is assigned to notmuch-show-header-line, it's used >> as a format string to be passed passed to format-spec with `%s` >> substituted by the message's subject. If a function is given, it's >> called with the subject as argument, and its return value used as >> header line. > > The API defined here (function taking the subject as a string) seems a > bit limited. What if the user wants to use some other message header in > the header-line? Or list tags? well, the function is called with the message buffer being current, so it has access to all the message properties... we could even remove the subject argument, but there's some convenient cleaning up on it that, i think, makes it convenient. > I would complain about missing test, but I think the test machinery > works via buffer-substring-no-properties, which excludes header and > mode lines. yes, i didn't find an easy way of testing. > On the other hand, it should be possible to update the manual, at > least with a copy of the docstring. yes, i'll add it once we settle on a final version. one can play nice tricks with this, such as returning a mode line format specification from that function (since the result is assigned to the header-line-format), and have an even more dynamic header (i put in there an '(:eval fun-that-computes-thread-message-read/unread-counts) one)... cheers, jao -- "It is easy to be blinded to the essential uselessness of computers by the sense of accomplishment you get from getting them to work at all." - Douglas Adams