Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id A5F28431FBD for ; Fri, 5 Feb 2010 11:55:27 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -3.177 X-Spam-Level: X-Spam-Status: No, score=-3.177 tagged_above=-999 required=5 tests=[ALL_TRUSTED=-1.8, AWL=1.222, BAYES_00=-2.599] autolearn=ham Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3LZ92c3o4p4a; Fri, 5 Feb 2010 11:55:26 -0800 (PST) Received: from yoom.home.cworth.org (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 9B0B3431FAE; Fri, 5 Feb 2010 11:55:26 -0800 (PST) Received: by yoom.home.cworth.org (Postfix, from userid 1000) id 541FC254181; Sat, 6 Feb 2010 08:55:26 +1300 (NZDT) From: Carl Worth To: "Aneesh Kumar K.V" , aneesh.kumar@linux.vnet.ibm.com In-Reply-To: <1259758178-26584-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> References: <1259684149-9574-3-git-send-email-aneesh.kumar@gmail.com> <1259758178-26584-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> Date: Fri, 05 Feb 2010 11:55:26 -0800 Message-ID: <87bpg3e9u9.fsf@yoom.home.cworth.org> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Cc: "Aneesh Kumar K.V" , notmuch@notmuchmail.org Subject: Re: [notmuch] [PATCH -v2] notmuch.el: Support for customizing search result display X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Feb 2010 19:55:27 -0000 --=-=-= Content-Transfer-Encoding: quoted-printable On Wed, 2 Dec 2009 18:19:38 +0530, "Aneesh Kumar K.V" wrote: > From: Aneesh Kumar K.V >=20 > This patch helps in customizing search result display > similar to mutt's index_format. The customization is done > by defining an alist as below >=20 > (setq notmuch-search-result-format '(("date" . "%s ") > ("authors" . "%-40s ") > ("subject" . "%s ") > ("tags" . "(%s)"))) >=20 > The supported keywords are date, count, authors, subject and tags. >=20 > Signed-off-by: Aneesh Kumar K.V Hi Aneesh, I'm sorry this patch has lingered so long without comment. There's really only one problem I see with it: > +(defcustom notmuch-search-result-format nil > + "Search result formating. Supported fields are > + date, count, authors, subject, tags > +ex: (setq notmuch-search-result-format \(\(\"authors\" . \"%-40s\"\) > + \(\"subject\" . \"%s\"\)\)\)" > +:type '(alist :key-type (string) :value-type (string)) > +:group 'notmuch) ... > - (insert (format "%s %-7s %-40s %s (%s)\n" date count authors subject = tags)) > + (if (not notmuch-search-result-format) > + (progn (insert (format "%s %-7s %-40s %s" date count authors subj= ect)) > + ;; insert the fontified tag > + (insert-tags (format "%s" tags)) > + (insert "\n")) > + (notmuch-search-show-result date count authors subject tags)) I don't like that the new format variable is nil by default and then there's an open-coded implementation of the default formatting. This has a couple of problems: 1. The new code is not being exercised by default, so it would be easy to break it without realizing. 2. The system is not very self-documenting. If a new user wants to tweak the default format, that will be a lot easier if they find a customizable variable that describes the current format. *That* will be a lot easier to modify rather than trying to learn what should be used instead of "nil". =2DCarl --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iD8DBQFLbHeu6JDdNq8qSWgRAk8xAJ9IyK6g1eLB9W2ZOsbgZ5eEJxLw6gCfc5DD znAAjdaoCHx3dG1pXUEYsrY= =r1Bd -----END PGP SIGNATURE----- --=-=-=--