unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Carl Worth <cworth@cworth.org>
To: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>,
	aneesh.kumar@linux.vnet.ibm.com
Cc: "Aneesh Kumar K.V" <aneesh.kumar@gmail.com>, notmuch@notmuchmail.org
Subject: Re: [PATCH -v2] notmuch.el: Support for customizing search result display
Date: Fri, 05 Feb 2010 11:55:26 -0800	[thread overview]
Message-ID: <87bpg3e9u9.fsf@yoom.home.cworth.org> (raw)
In-Reply-To: <1259758178-26584-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com>

[-- Attachment #1: Type: text/plain, Size: 2064 bytes --]

On Wed,  2 Dec 2009 18:19:38 +0530, "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com> wrote:
> From: Aneesh Kumar K.V <aneesh.kumar@gmail.com>
> 
> This patch helps in customizing search result display
> similar to mutt's index_format. The customization is done
> by defining an alist as below
> 
> (setq notmuch-search-result-format '(("date" . "%s ")
> 				     ("authors" . "%-40s ")
> 				     ("subject" . "%s ")
> 				     ("tags" . "(%s)")))
> 
> The supported keywords are date, count, authors, subject and tags.
> 
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@gmail.com>

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 subject))
> +				   ;; 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".

-Carl

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

  parent reply	other threads:[~2010-02-05 19:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-01 16:15 [PATCH 1/3] Use default face for the button types so that the underlines go away aneesh.kumar
2009-12-01 16:15 ` [PATCH 2/3] notmuch.el: Fix the message summary button to be active even on first column aneesh.kumar
2009-12-01 16:15   ` [PATCH 3/3] notmuch.el: Support for customizing search result display aneesh.kumar
2009-12-02 12:49     ` [PATCH -v2] " Aneesh Kumar K.V
2009-12-11  5:34       ` Aneesh Kumar K. V
2010-02-05 19:55       ` Carl Worth [this message]
2010-02-11 16:41         ` [PATCH -V3] " Aneesh Kumar K.V
2010-02-11 17:17           ` Aneesh Kumar K. V
2009-12-03 21:04 ` [PATCH 1/3] Use default face for the button types so that the underlines go away Carl Worth
  -- strict thread matches above, loose matches on Subject: below --
2010-01-23 10:09 [PATCH -V2] notmuch.el: Support for customizing search result display Aneesh Kumar K.V

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bpg3e9u9.fsf@yoom.home.cworth.org \
    --to=cworth@cworth.org \
    --cc=aneesh.kumar@gmail.com \
    --cc=aneesh.kumar@linux.vnet.ibm.com \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).