unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* fix problem with notmuch-hello-nice-number
@ 2010-06-09 14:49 Dirk Hohndel
  2010-06-10  7:05 ` David Edmondson
  0 siblings, 1 reply; 4+ messages in thread
From: Dirk Hohndel @ 2010-06-09 14:49 UTC (permalink / raw)
  To: notmuch


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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: fix problem with notmuch-hello-nice-number
  2010-06-09 14:49 fix problem with notmuch-hello-nice-number Dirk Hohndel
@ 2010-06-10  7:05 ` David Edmondson
  2010-06-10 14:00   ` Dirk Hohndel
  2010-10-29 22:56   ` Carl Worth
  0 siblings, 2 replies; 4+ messages in thread
From: David Edmondson @ 2010-06-10  7:05 UTC (permalink / raw)
  To: Dirk Hohndel, notmuch

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

On Wed, 09 Jun 2010 07:49:01 -0700, Dirk Hohndel <hohndel@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

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: fix problem with notmuch-hello-nice-number
  2010-06-10  7:05 ` David Edmondson
@ 2010-06-10 14:00   ` Dirk Hohndel
  2010-10-29 22:56   ` Carl Worth
  1 sibling, 0 replies; 4+ messages in thread
From: Dirk Hohndel @ 2010-06-10 14:00 UTC (permalink / raw)
  To: David Edmondson, notmuch

On Thu, 10 Jun 2010 08:05:13 +0100, David Edmondson <dme@dme.org> wrote:
> On Wed, 09 Jun 2010 07:49:01 -0700, Dirk Hohndel <hohndel@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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: fix problem with notmuch-hello-nice-number
  2010-06-10  7:05 ` David Edmondson
  2010-06-10 14:00   ` Dirk Hohndel
@ 2010-10-29 22:56   ` Carl Worth
  1 sibling, 0 replies; 4+ messages in thread
From: Carl Worth @ 2010-10-29 22:56 UTC (permalink / raw)
  To: David Edmondson, Dirk Hohndel, notmuch

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

On Thu, 10 Jun 2010 08:05:13 +0100, David Edmondson <dme@dme.org> wrote:
> On Wed, 09 Jun 2010 07:49:01 -0700, Dirk Hohndel <hohndel@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.worth@intel.com

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-10-29 22:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-09 14:49 fix problem with notmuch-hello-nice-number Dirk Hohndel
2010-06-10  7:05 ` David Edmondson
2010-06-10 14:00   ` Dirk Hohndel
2010-10-29 22:56   ` Carl Worth

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).