fix problem with notmuch-hello-nice-number

2010-10-29 Thread Carl Worth
On Thu, 10 Jun 2010 08:05:13 +0100, David Edmondson  wrote:
> On Wed, 09 Jun 2010 07:49:01 -0700, Dirk Hohndel  
> wrote:
> > Without this little patch notmuch fails with current git if there's a
> > saved search that has zero results
> 
> How about:
...
>(setq n (/ n 1000)))
> +(setq result (or result '(0)))
>  (apply #'concat

Thanks Dirk and David,

I've just pushed this version (finally!) of this nearly-trivial patch


Re: fix problem with notmuch-hello-nice-number

2010-10-29 Thread Carl Worth
On Thu, 10 Jun 2010 08:05:13 +0100, David Edmondson d...@dme.org wrote:
 On Wed, 09 Jun 2010 07:49:01 -0700, Dirk Hohndel hohn...@infradead.org 
 wrote:
  Without this little patch notmuch fails with current git if there's a
  saved search that has zero results
 
 How about:
...
(setq n (/ n 1000)))
 +(setq result (or result '(0)))
  (apply #'concat

Thanks Dirk and David,

I've just pushed this version (finally!) of this nearly-trivial patch
From so long ago. The bug hasn't been as important lately since by
default notmuch doesn't even display saved searches with 0 results. But
the bug was still present for anyone that set
notmuch-show-empty-saved-searches to a non-nil value.

I've also added a test to the test suite to ensure this case gets
exercised there.

Thanks again,

-Carl

-- 
carl.d.wo...@intel.com


pgp5ElP4mZvze.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


fix problem with notmuch-hello-nice-number

2010-06-10 Thread David Edmondson
On Wed, 09 Jun 2010 07:49:01 -0700, Dirk Hohndel  
wrote:
> Without this little patch notmuch fails with current git if there's a
> saved search that has zero results

How about:

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index a6e8a47..48bb6e3 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -115,6 +115,7 @@ Typically \",\" in the US and UK and \".\" in Europe."
 (while (> n 0)
   (push (% n 1000) result)
   (setq n (/ n 1000)))
+(setq result (or result '(0)))
 (apply #'concat
  (number-to-string (car result))
  (mapcar (lambda (elem)

dme.
-- 
David Edmondson, http://dme.org
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: 



fix problem with notmuch-hello-nice-number

2010-06-10 Thread Dirk Hohndel
On Thu, 10 Jun 2010 08:05:13 +0100, David Edmondson  wrote:
> On Wed, 09 Jun 2010 07:49:01 -0700, Dirk Hohndel  
> wrote:
> > Without this little patch notmuch fails with current git if there's a
> > saved search that has zero results
> 
> How about:
> 
> diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
> index a6e8a47..48bb6e3 100644
> --- a/emacs/notmuch-hello.el
> +++ b/emacs/notmuch-hello.el
> @@ -115,6 +115,7 @@ Typically \",\" in the US and UK and \".\" in Europe."
>  (while (> n 0)
>(push (% n 1000) result)
>(setq n (/ n 1000)))
> +(setq result (or result '(0)))
>  (apply #'concat
>   (number-to-string (car result))
>   (mapcar (lambda (elem)
> 

Much better. Mine made sense when you looked at it - this one has a much
more emacs-y feel to it in that I need to stare at it for 30 seconds
before I can grasp what it does :-)

/D

-- 
Dirk Hohndel
Intel Open Source Technology Center


Re: fix problem with notmuch-hello-nice-number

2010-06-10 Thread David Edmondson
On Wed, 09 Jun 2010 07:49:01 -0700, Dirk Hohndel hohn...@infradead.org wrote:
 Without this little patch notmuch fails with current git if there's a
 saved search that has zero results

How about:

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index a6e8a47..48bb6e3 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -115,6 +115,7 @@ Typically \,\ in the US and UK and \.\ in Europe.
 (while ( n 0)
   (push (% n 1000) result)
   (setq n (/ n 1000)))
+(setq result (or result '(0)))
 (apply #'concat
  (number-to-string (car result))
  (mapcar (lambda (elem)

dme.
-- 
David Edmondson, http://dme.org


pgpwjrhLBXUpM.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: fix problem with notmuch-hello-nice-number

2010-06-10 Thread Dirk Hohndel
On Thu, 10 Jun 2010 08:05:13 +0100, David Edmondson d...@dme.org wrote:
 On Wed, 09 Jun 2010 07:49:01 -0700, Dirk Hohndel hohn...@infradead.org 
 wrote:
  Without this little patch notmuch fails with current git if there's a
  saved search that has zero results
 
 How about:
 
 diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
 index a6e8a47..48bb6e3 100644
 --- a/emacs/notmuch-hello.el
 +++ b/emacs/notmuch-hello.el
 @@ -115,6 +115,7 @@ Typically \,\ in the US and UK and \.\ in Europe.
  (while ( n 0)
(push (% n 1000) result)
(setq n (/ n 1000)))
 +(setq result (or result '(0)))
  (apply #'concat
   (number-to-string (car result))
   (mapcar (lambda (elem)
 

Much better. Mine made sense when you looked at it - this one has a much
more emacs-y feel to it in that I need to stare at it for 30 seconds
before I can grasp what it does :-)

/D

-- 
Dirk Hohndel
Intel Open Source Technology Center
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


fix problem with notmuch-hello-nice-number

2010-06-09 Thread Dirk Hohndel

Without this little patch notmuch fails with current git if there's a
saved search that has zero results

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index f5d061b..7c32f7c 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -112,6 +112,8 @@ Typically \",\" in the US and UK and \".\" in Europe."

 (defun notmuch-hello-nice-number (n)
   (let (result)
+(if (= n 0)
+   (push 0 result))
 (while (> n 0)
   (push (% n 1000) result)
   (setq n (/ n 1000)))

-- 
Dirk Hohndel
Intel Open Source Technology Center