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 yKTbAkYs02IdLAEAbAwnHQ (envelope-from ) for ; Sat, 16 Jul 2022 23:23:18 +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 yMz+AkYs02JjfwEA9RJhRA (envelope-from ) for ; Sat, 16 Jul 2022 23:23:18 +0200 Received: from mail.notmuchmail.org (yantan.tethera.net [IPv6:2a01:4f9:c011:7a79::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id B920F3C08C for ; Sat, 16 Jul 2022 23:23:13 +0200 (CEST) Received: from yantan.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id E4C7B60834; Sat, 16 Jul 2022 21:22:50 +0000 (UTC) Received: from fethera.tethera.net (fethera.tethera.net [IPv6:2607:5300:60:c5::1]) by mail.notmuchmail.org (Postfix) with ESMTP id 733316082E for ; Sat, 16 Jul 2022 21:22:48 +0000 (UTC) Received: by fethera.tethera.net (Postfix, from userid 1001) id D387F5FBD0; Sat, 16 Jul 2022 17:22:47 -0400 (EDT) Received: (nullmailer pid 56479 invoked by uid 1000); Sat, 16 Jul 2022 21:22:37 -0000 From: David Bremner To: notmuch@notmuchmail.org Subject: [PATCH 1/6] emacs: update defcustom for notmuch-search-result-format. Date: Sat, 16 Jul 2022 17:22:23 -0400 Message-Id: <20220716212228.56432-2-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: LRXG2VH2GRQLI7ZEXQ3EHFHIGGIPZFXK X-Message-ID-Hash: LRXG2VH2GRQLI7ZEXQ3EHFHIGGIPZFXK 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=1658006593; 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=R/c7sQ8mlvhHttrMvTAmiiD67Epa2814wBBU99erppA=; b=DEdKxn9WfIXAwl3+Q4tnagZGkz1fURtVZ9ORCTBNjM4x8IqpwfNs462hlPeIMuCWbY61zj Q1Da3YJ13qCYFTwb+x8t+ET5y/ct/rNyoP7vsgdPUm8Sjd7P8Gra5UPv85dnuWQsyHbDba 15mextt5eE9u4vgCeVPAA2XY33/Ibn2A/HKxuwtPkG65WVjLnt5zcwYESKkjbCWoYw0f2O i+PFIK+MuJ1kZQCy2LA9st1GS9uddjBmGMqMPpli0HLmQpMCgkzq5aUtzoaxg+U0N6ztAu gYtv6beJn/nUfLFpi/SZn01rcPhXL6ukdj8WblLCjqGcOXuKOEg/Wam6VVjirg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1658006593; a=rsa-sha256; cv=none; b=KnpN6ps40HuZbtxHs58o7Pw2TUGNOWQHb5n71eiw/3xekUUVDPAiVnCu3oGA8Xv2myM6t2 +RvUu1m9w6wyUBFXc/qJo36A0oo6085uUf3U19AZjQDZQGCqEVSyZTtPsnIS64qKihvFyq +56d4RNyLfHRG1TKPCUVSXJgsIKo4lTSmcT2pKXFjJisVpm60+Q007XYubi4OmDhVNDuGL p7DBKYggwp0gWny24FsiEnKdg2rCQfKnhRFQUHSabPL/Oo+6cW37yK0BrD2FCbObkbP4CR LNR9pSUtQRtthKpXnbRjqbgtDBGhLJdR2QmQldvNzbJVsAAvMdWdjHpnnw/a3w== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2a01:4f9:c011:7a79::1 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: -2.20 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2a01:4f9:c011:7a79::1 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: B920F3C08C X-Spam-Score: -2.20 X-Migadu-Scanner: scn0.migadu.com X-TUID: ren5GVLbQI8I It seems redundant to have the previous example, since the default value is always show by describe variable. Enforce more restrictions on the keys in the alist, since arbitrary strings don't work as field names. Document that functions can be used in lieu of field names. --- emacs/notmuch.el | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/emacs/notmuch.el b/emacs/notmuch.el index 01a92997..5cb7acd2 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -90,11 +90,11 @@ ("tags" . "(%s)")) "Search result formatting. -Supported fields are: date, count, authors, subject, tags. -For example: - (setq notmuch-search-result-format - \\='((\"authors\" . \"%-40s\") - (\"subject\" . \"%s\"))) +List of pairs of (field . format-string). Supported field +strings are: \"date\", \"count\", \"authors\", \"subject\", +\"tags\". It is also supported to pass a function in place of a +field name. In this case the function is passed the thread +object (plist) and format string. Line breaks are permitted in format strings (though this is currently experimental). Note that a line break at the end of an @@ -102,7 +102,16 @@ currently experimental). Note that a line break at the end of an place it instead at the beginning of the following field. To enter a line break when setting this variable with setq, use \\n. To enter a line break in customize, press \\[quoted-insert] C-j." - :type '(alist :key-type string :value-type string) + :type '(alist + :key-type + (choice + (const :tag "Date" "date") + (const :tag "Count" "count") + (const :tag "Authors" "authors") + (const :tag "Subject" "subject") + (const :tag "Tags" "tags") + function) + :value-type (string :tag "Format")) :group 'notmuch-search) ;; The name of this variable `notmuch-init-file' is consistent with the -- 2.35.1