--- /dev/null
+Return-Path: <dme@dme.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id EA42C4196F0\r
+ for <notmuch@notmuchmail.org>; Tue, 4 May 2010 06:44:06 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -1.9\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5\r
+ tests=[BAYES_00=-1.9] autolearn=ham\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id utXv58AdXvD8 for <notmuch@notmuchmail.org>;\r
+ Tue, 4 May 2010 06:44:03 -0700 (PDT)\r
+Received: from mail-ww0-f53.google.com (mail-ww0-f53.google.com\r
+ [74.125.82.53]) by olra.theworths.org (Postfix) with ESMTP id B3594431FC1 for\r
+ <notmuch@notmuchmail.org>; Tue, 4 May 2010 06:44:03 -0700 (PDT)\r
+Received: by wwd20 with SMTP id 20so1161745wwd.26\r
+ for <notmuch@notmuchmail.org>; Tue, 04 May 2010 06:44:02 -0700 (PDT)\r
+Received: by 10.227.138.11 with SMTP id y11mr1314782wbt.87.1272980642657;\r
+ Tue, 04 May 2010 06:44:02 -0700 (PDT)\r
+Received: from ut.hh.sledj.net (gmp-ea-fw-1.sun.com [192.18.1.36])\r
+ by mx.google.com with ESMTPS id z33sm28775993wbd.13.2010.05.04.06.44.00\r
+ (version=TLSv1/SSLv3 cipher=RC4-MD5);\r
+ Tue, 04 May 2010 06:44:01 -0700 (PDT)\r
+Received: by ut.hh.sledj.net (Postfix, from userid 1000)\r
+ id D741D594121; Tue, 4 May 2010 14:44:40 +0100 (BST)\r
+From: David Edmondson <dme@dme.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] emacs: Pretty print the numbers of matching messages.\r
+Date: Tue, 4 May 2010 14:44:39 +0100\r
+Message-Id: <1272980679-11193-1-git-send-email-dme@dme.org>\r
+X-Mailer: git-send-email 1.7.0\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Tue, 04 May 2010 13:44:07 -0000\r
+\r
+Insert a separator every three digits when outputting numbers. Allow\r
+the user to choose the separator by customizing\r
+`notmuch-decimal-separator'. Widen the space allocated for message\r
+counts accordingly.\r
+---\r
+ emacs/notmuch-hello.el | 38 +++++++++++++++++++++++++++++++-------\r
+ 1 files changed, 31 insertions(+), 7 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el\r
+index bf49bb1..a6e8a47 100644\r
+--- a/emacs/notmuch-hello.el\r
++++ b/emacs/notmuch-hello.el\r
+@@ -91,6 +91,13 @@ So:\r
+ (integer :tag "Number of characters")\r
+ (float :tag "Fraction of window")))\r
+ \r
++(defcustom notmuch-decimal-separator ","\r
++ "The string used as a decimal separator.\r
++\r
++Typically \",\" in the US and UK and \".\" in Europe."\r
++ :group 'notmuch\r
++ :type 'string)\r
++\r
+ (defvar notmuch-hello-url "http://notmuchmail.org"\r
+ "The `notmuch' web site.")\r
+ \r
+@@ -103,6 +110,17 @@ So:\r
+ notmuch-recent-searches-max)\r
+ (setq notmuch-hello-recent-searches (butlast notmuch-hello-recent-searches))))\r
+ \r
++(defun notmuch-hello-nice-number (n)\r
++ (let (result)\r
++ (while (> n 0)\r
++ (push (% n 1000) result)\r
++ (setq n (/ n 1000)))\r
++ (apply #'concat\r
++ (number-to-string (car result))\r
++ (mapcar (lambda (elem)\r
++ (format "%s%03d" notmuch-decimal-separator elem))\r
++ (cdr result)))))\r
++\r
+ (defun notmuch-hello-trim (search)\r
+ "Trim whitespace."\r
+ (if (string-match "^[[:space:]]*\\(.*[^[:space:]]\\)[[:space:]]*$" search)\r
+@@ -180,9 +198,9 @@ should be. Returns a cons cell `(tags-per-line width)'."\r
+ ((integerp notmuch-column-control)\r
+ (max 1\r
+ (/ (- (window-width) notmuch-hello-indent)\r
+- ;; Count is 7 wide (6 digits plus space), 1 for the space\r
++ ;; Count is 9 wide (8 digits plus space), 1 for the space\r
+ ;; after the name.\r
+- (+ 7 1 (max notmuch-column-control widest)))))\r
++ (+ 9 1 (max notmuch-column-control widest)))))\r
+ \r
+ ((floatp notmuch-column-control)\r
+ (let* ((available-width (- (window-width) notmuch-hello-indent))\r
+@@ -192,12 +210,15 @@ should be. Returns a cons cell `(tags-per-line width)'."\r
+ (t\r
+ (max 1\r
+ (/ (- (window-width) notmuch-hello-indent)\r
+- ;; Count is 7 wide (6 digits plus space), 1 for the space\r
++ ;; Count is 9 wide (8 digits plus space), 1 for the space\r
+ ;; after the name.\r
+- (+ 7 1 widest)))))))\r
++ (+ 9 1 widest)))))))\r
+ \r
+ (cons tags-per-line (/ (- (window-width) notmuch-hello-indent\r
+- (* tags-per-line (+ 7 1)))\r
++ ;; Count is 9 wide (8 digits plus\r
++ ;; space), 1 for the space after the\r
++ ;; name.\r
++ (* tags-per-line (+ 9 1)))\r
+ tags-per-line))))\r
+ \r
+ (defun notmuch-hello-insert-tags (tag-alist widest target)\r
+@@ -218,7 +239,9 @@ should be. Returns a cons cell `(tags-per-line width)'."\r
+ (let* ((name (car elem))\r
+ (query (cdr elem))\r
+ (formatted-name (format "%s " name)))\r
+- (widget-insert (format "%6s " (notmuch-saved-search-count query)))\r
++ (widget-insert (format "%8s "\r
++ (notmuch-hello-nice-number\r
++ (string-to-number (notmuch-saved-search-count query)))))\r
+ (if (string= formatted-name target)\r
+ (setq found-target-pos (point-marker)))\r
+ (widget-create 'push-button\r
+@@ -323,7 +346,8 @@ should be. Returns a cons cell `(tags-per-line width)'."\r
+ :notify (lambda (&rest ignore)\r
+ (notmuch-hello-update))\r
+ :help-echo "Refresh"\r
+- (car (process-lines notmuch-command "count")))\r
++ (notmuch-hello-nice-number\r
++ (string-to-number (car (process-lines notmuch-command "count")))))\r
+ (widget-insert " messages (that's not much mail).\n"))\r
+ \r
+ (let ((found-target-pos nil)\r
+-- \r
+1.7.0\r
+\r