[PATCH] emacs: More functionality for `notmuch-wash-tidy-citations'.

2010-05-04 Thread David Edmondson
Add:
- Insert a blank line before a citation if there isn't one,
- Insert a blank line after a citation if there isn't one.
---

Better than the last version.

 emacs/notmuch-wash.el |   12 +++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/emacs/notmuch-wash.el b/emacs/notmuch-wash.el
index 46e1824..26a3f88 100644
--- a/emacs/notmuch-wash.el
+++ b/emacs/notmuch-wash.el
@@ -214,7 +214,17 @@ Perform four transformations on the message body:
   ;; text.
   (goto-char (point-min))
   (while (re-search-forward "\\(^>[> ]*\n\\)\\(^$\\|^[^>].*\\)" nil t)
-(replace-match "\\2")))
+(replace-match "\\2"))
+
+  ;; Insert a blank line before a citation if there isn't one.
+  (goto-char (point-min))
+  (while (re-search-forward "\\(^[^>]+\\)\n>" nil t)
+(replace-match "\\1\n\n>"))
+
+  ;; Insert a blank line after a citation if there isn't one.
+  (goto-char (point-min))
+  (while (re-search-forward "\\(^>.+\\)\n\\([^>]\\)" nil t)
+(replace-match "\\1\n\n\\2")))

 ;;

-- 
1.7.0



[PATCH] emacs: More functionality for `notmuch-wash-tidy-citations'.

2010-05-04 Thread David Edmondson
On Tue,  4 May 2010 14:45:14 +0100, David Edmondson  wrote:
> Add:
> - Insert a blank line before a citation if there isn't one,
> - Insert a blank line after a citation if there isn't one.

Don't use this, it matches too often.

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: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20100504/b30232bc/attachment.pgp>


[PATCH] emacs: More functionality for `notmuch-wash-tidy-citations'.

2010-05-04 Thread David Edmondson
Add:
- Insert a blank line before a citation if there isn't one,
- Insert a blank line after a citation if there isn't one.
---
 emacs/notmuch-wash.el |   12 +++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/emacs/notmuch-wash.el b/emacs/notmuch-wash.el
index 46e1824..5347ddc 100644
--- a/emacs/notmuch-wash.el
+++ b/emacs/notmuch-wash.el
@@ -214,7 +214,17 @@ Perform four transformations on the message body:
   ;; text.
   (goto-char (point-min))
   (while (re-search-forward "\\(^>[> ]*\n\\)\\(^$\\|^[^>].*\\)" nil t)
-(replace-match "\\2")))
+(replace-match "\\2"))
+
+  ;; Insert a blank line before a citation if there isn't one.
+  (goto-char (point-min))
+  (while (re-search-forward "\\(^[^>].+\\)\n>" nil t)
+(replace-match "\\1\n\n>"))
+
+  ;; Insert a blank line after a citation if there isn't one.
+  (goto-char (point-min))
+  (while (re-search-forward "\\(^>.+\\)\n\\([^>]\\)" nil t)
+(replace-match "\\1\n\n\\2")))

 ;;

-- 
1.7.0



[PATCH] emacs: Pretty print the numbers of matching messages.

2010-05-04 Thread David Edmondson
Insert a separator every three digits when outputting numbers. Allow
the user to choose the separator by customizing
`notmuch-decimal-separator'. Widen the space allocated for message
counts accordingly.
---
 emacs/notmuch-hello.el |   38 +++---
 1 files changed, 31 insertions(+), 7 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index bf49bb1..a6e8a47 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -91,6 +91,13 @@ So:
  (integer :tag "Number of characters")
  (float :tag "Fraction of window")))

+(defcustom notmuch-decimal-separator ","
+  "The string used as a decimal separator.
+
+Typically \",\" in the US and UK and \".\" in Europe."
+  :group 'notmuch
+  :type 'string)
+
 (defvar notmuch-hello-url "http://notmuchmail.org;
   "The `notmuch' web site.")

@@ -103,6 +110,17 @@ So:
 notmuch-recent-searches-max)
   (setq notmuch-hello-recent-searches (butlast 
notmuch-hello-recent-searches

+(defun notmuch-hello-nice-number (n)
+  (let (result)
+(while (> n 0)
+  (push (% n 1000) result)
+  (setq n (/ n 1000)))
+(apply #'concat
+ (number-to-string (car result))
+ (mapcar (lambda (elem)
+ (format "%s%03d" notmuch-decimal-separator elem))
+(cdr result)
+
 (defun notmuch-hello-trim (search)
   "Trim whitespace."
   (if (string-match "^[[:space:]]*\\(.*[^[:space:]]\\)[[:space:]]*$" search)
@@ -180,9 +198,9 @@ should be. Returns a cons cell `(tags-per-line width)'."
  ((integerp notmuch-column-control)
   (max 1
(/ (- (window-width) notmuch-hello-indent)
-  ;; Count is 7 wide (6 digits plus space), 1 for the space
+  ;; Count is 9 wide (8 digits plus space), 1 for the space
   ;; after the name.
-  (+ 7 1 (max notmuch-column-control widest)
+  (+ 9 1 (max notmuch-column-control widest)

  ((floatp notmuch-column-control)
   (let* ((available-width (- (window-width) notmuch-hello-indent))
@@ -192,12 +210,15 @@ should be. Returns a cons cell `(tags-per-line width)'."
  (t
   (max 1
(/ (- (window-width) notmuch-hello-indent)
-  ;; Count is 7 wide (6 digits plus space), 1 for the space
+  ;; Count is 9 wide (8 digits plus space), 1 for the space
   ;; after the name.
-  (+ 7 1 widest)))
+  (+ 9 1 widest)))

 (cons tags-per-line (/ (- (window-width) notmuch-hello-indent
- (* tags-per-line (+ 7 1)))
+ ;; Count is 9 wide (8 digits plus
+ ;; space), 1 for the space after the
+ ;; name.
+ (* tags-per-line (+ 9 1)))
   tags-per-line

 (defun notmuch-hello-insert-tags (tag-alist widest target)
@@ -218,7 +239,9 @@ should be. Returns a cons cell `(tags-per-line width)'."
  (let* ((name (car elem))
 (query (cdr elem))
 (formatted-name (format "%s " name)))
-   (widget-insert (format "%6s " (notmuch-saved-search-count 
query)))
+   (widget-insert (format "%8s "
+  (notmuch-hello-nice-number
+   (string-to-number 
(notmuch-saved-search-count query)
(if (string= formatted-name target)
(setq found-target-pos (point-marker)))
(widget-create 'push-button
@@ -323,7 +346,8 @@ should be. Returns a cons cell `(tags-per-line width)'."
 :notify (lambda ( ignore)
   (notmuch-hello-update))
 :help-echo "Refresh"
-(car (process-lines notmuch-command "count")))
+(notmuch-hello-nice-number
+ (string-to-number (car (process-lines notmuch-command 
"count")
   (widget-insert " messages (that's not much mail).\n"))

 (let ((found-target-pos nil)
-- 
1.7.0



Failing test cases

2010-05-04 Thread Carl Worth
On Tue, 04 May 2010 11:21:27 -0700, Carl Worth  wrote:
> I installed Xapian 1.0.20 (from the libxapian-dev package in sid) and am
> now getting this failure.
> 
> I'm investigating more closely now, but I thought I'd at least share
> that much information.

Here are my conclusions based on some additional investigation:

What's happening here is that notmuch is creating a Xapian TermIterator,
iterating over some of the results, and then modifying the database such
that the terms being iterated over are affected. Specifically, in this
test case, notmuch is inserting a new term before the term being pointed
at by the iterator.

With Xapian 1.0.18 incrementing the iterator from this state causes it
to point to the next term. However, with Xapian 1.0.20 this same
increment causes the iterator to point at the same term again.

I was able to put a little workaround into notmuch-new.c that avoids the
bug (see below). But this isn't entirely satisfactory for several
reasons:

1. We need to know what the intended semantics of the Xapian iterators
   really are. If this behavior is just a bug in Xapian, then that
   should be fixed.

   But if the iterators are to have explicitly undefined behavior in
   cases like this, then notmuch is going to need to carefully copy
   contents out of Xapian iterators when creating notmuch iterators (at
   some performance cost).

2. Working around the bug in notmuch-new.c doesn't fix the notmuch
   library itself, (so that python bindings, etc. will remain
   broken). So we really do need a lower-level fix for this.

To properly do the lower-level fix for (2), we'll need to know the
answer to (1). Olly, do you have an answer on the intended semantics of
Xapian iterators?

-Carl

diff --git a/notmuch-new.c b/notmuch-new.c
index 8818728..928bb94 100644
--- a/notmuch-new.c
+++ b/notmuch-new.c
@@ -380,7 +380,11 @@ add_files_recursive (notmuch_database_t *notmuch,
if (notmuch_filenames_valid (db_files) &&
strcmp (notmuch_filenames_get (db_files), entry->d_name) == 0)
{
-   notmuch_filenames_move_to_next (db_files);
+   while (notmuch_filenames_valid (db_files) &&
+  strcmp (notmuch_filenames_get (db_files), entry->d_name) <= 
0)
+   {
+   notmuch_filenames_move_to_next (db_files);
+   }
continue;
}



-- 
carl.d.worth at intel.com
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20100504/ec0fba7b/attachment.pgp>


[PATCH] Customize saved search order separately from regular search order

2010-05-04 Thread David Edmondson
On Mon,  3 May 2010 13:58:27 -0700, Keith Packard  wrote:
> I use 'saved searches' as a folder mechanism and want them to be shown
> oldest first. Otherwise, while searching for messages normally, I want
> to see the most recent messages first. This patch makes these two
> default search orders separate.

This is a nice patch.

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: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20100504/b80125f3/attachment.pgp>


all authors and subjects in the search buffer [was: Re: [PATCH] emacs: Fix i-search to open up invisible citations as necessary]

2010-05-04 Thread David Edmondson
On Mon, 03 May 2010 13:27:35 -0700, Carl Worth  wrote:
> On Fri, 30 Apr 2010 17:00:08 +0100, David Edmondson  wrote:
> > All of the authors appear in the output already, but that doesn't seem
> > to be the case of the subjects. Would you envisage doing something
> > similar to the changes Dirk made for authors?
> 
> Right. We do have a similar approach already for picking out the "first"
> matching subject. So it would be an easy extension to have it print a
> sorted list of all the subjects.
> 
> But let's start by making the emacs interface allow for searching of the
> authors. Then we can think about whether it makes sense to list all the
> subjects as well.

Patch sent to allow searching of the hidden authors.

Given that the tags are displayed after the subject, I suspect that we
would choose to hide _all_ of the 'non-matching' subject(s), displaying
it only as necessary during isearch.

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: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20100504/00f62352/attachment-0001.pgp>


[PATCH] emacs: In search mode, truncate authors using invisible text.

2010-05-04 Thread David Edmondson
Rather than discarding authors when truncated to fit the defined
column width, mark the text beyond the end of the column as invisible
and allow `isearch' to be used over the text so hidden.

This allows us to retain the compact display whilst enabling a user to
find the elided text.
---
 emacs/notmuch.el |   61 +++--
 1 files changed, 45 insertions(+), 16 deletions(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index c2fefe5..10babe4 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -608,23 +608,52 @@ matching will be applied."
  (t
   (setq tags-faces (cdr tags-faces)

+(defun notmuch-search-isearch-authors-show (overlay)
+  (remove-from-invisibility-spec (cons (overlay-get overlay 'invisible) t)))
+
 (defun notmuch-search-insert-authors (format-string authors)
-  (insert (let* ((formatted-sample (format format-string ""))
-(formatted-authors (format format-string authors))
-(truncated-string
- (if (> (length formatted-authors)
-(length formatted-sample))
- (concat (substring authors 0 (- (length formatted-sample) 
4)) "... ")
-   formatted-authors)))
-   ;; Need to save the match data to avoid interfering with
-   ;; `notmuch-search-process-filter'.
-   (save-match-data
- (if (string-match "\\(.*\\)|\\(..*\\)" truncated-string)
- (concat (propertize (concat (match-string 1 truncated-string) 
",")
- 'face 'notmuch-search-matching-authors)
- (propertize (match-string 2 truncated-string)
- 'face 
'notmuch-search-non-matching-authors))
-   (propertize truncated-string 'face 
'notmuch-search-matching-authors))
+  (let* ((propertized-authors
+ ;; Need to save the match data to avoid interfering with
+ ;; `notmuch-search-process-filter'.
+ (save-match-data
+   ;; Authors that don't match the search query are shown in a
+   ;; different font.
+   (if (string-match "\\(.*\\)|\\(..*\\)" authors)
+   (concat (propertize (concat (match-string 1 authors) ",")
+   'face 'notmuch-search-matching-authors)
+   (propertize (match-string 2 authors)
+   'face 'notmuch-search-non-matching-authors))
+ (propertize authors 'face 'notmuch-search-matching-authors
+
+(formatted-sample (format format-string ""))
+(formatted-authors (format format-string propertized-authors))
+visible-string invisible-string)
+
+;; Determine the part of the authors that will be visible by
+;; default.
+(if (> (length formatted-authors)
+  (length formatted-sample))
+   ;; 4 is `(length "... ")'.
+   (let ((visible-length (- (length formatted-sample) 4)))
+ (setq visible-string (substring propertized-authors 0 visible-length)
+   invisible-string (substring propertized-authors 
visible-length)))
+  (setq visible-string formatted-authors
+   invisible-string nil))
+
+;; Insert both the visible and invisible author strings.
+(insert visible-string)
+(when invisible-string
+  (let ((start (point))
+   (invis-spec (make-symbol "notmuch-search-authors"))
+   overlay)
+   (insert invisible-string)
+   ;; Using a cons-cell here causes an ellipsis to be inserted
+   ;; instead of the invisible text.
+   (add-to-invisibility-spec (cons invis-spec t))
+   (setq overlay (make-overlay start (point)))
+   (overlay-put overlay 'invisible invis-spec)
+   (overlay-put overlay 'isearch-open-invisible 
#'notmuch-search-isearch-authors-show)
+   (insert " ")

 (defun notmuch-search-insert-field (field date count authors subject tags)
   (cond
-- 
1.7.0



Failing test cases

2010-05-04 Thread Carl Worth
On Fri, 30 Apr 2010 01:23:16 + (UTC), Olly Betts  wrote:
> On 2010-04-28, Jason White wrote:
> > It seems to be repeatable here, even after running git clean -d -f -x,
> > followed by make && make test
> >
> > Is anyone else seeing this?
> 
> Yes, I got the same failure trying to rebuild the notmuch 0.3.1 Debian package
> with Xapian 1.2.0 (building in a clean Debian sid chroot on x86-64).
> 
> I'm hoping to get 1.2.x in for Debian's next stable release, so it would be
> good to work out what's going on.

Here's a little update.

I wasn't getting this failure because I was building against Xapian
1.0.18, (while using a clean Debian sid chroot now installs Xapian
1.0.20).

I installed Xapian 1.0.20 (from the libxapian-dev package in sid) and am
now getting this failure.

I'm investigating more closely now, but I thought I'd at least share
that much information.

-Carl

-- 
carl.d.worth at intel.com
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20100504/40dcc360/attachment.pgp>


Re: all authors and subjects in the search buffer [was: Re: [PATCH] emacs: Fix i-search to open up invisible citations as necessary]

2010-05-04 Thread David Edmondson
On Mon, 03 May 2010 13:27:35 -0700, Carl Worth cwo...@cworth.org wrote:
 On Fri, 30 Apr 2010 17:00:08 +0100, David Edmondson d...@dme.org wrote:
  All of the authors appear in the output already, but that doesn't seem
  to be the case of the subjects. Would you envisage doing something
  similar to the changes Dirk made for authors?
 
 Right. We do have a similar approach already for picking out the first
 matching subject. So it would be an easy extension to have it print a
 sorted list of all the subjects.
 
 But let's start by making the emacs interface allow for searching of the
 authors. Then we can think about whether it makes sense to list all the
 subjects as well.

Patch sent to allow searching of the hidden authors.

Given that the tags are displayed after the subject, I suspect that we
would choose to hide _all_ of the 'non-matching' subject(s), displaying
it only as necessary during isearch.

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


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


[PATCH] emacs: Pretty print the numbers of matching messages.

2010-05-04 Thread David Edmondson
Insert a separator every three digits when outputting numbers. Allow
the user to choose the separator by customizing
`notmuch-decimal-separator'. Widen the space allocated for message
counts accordingly.
---
 emacs/notmuch-hello.el |   38 +++---
 1 files changed, 31 insertions(+), 7 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index bf49bb1..a6e8a47 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -91,6 +91,13 @@ So:
  (integer :tag Number of characters)
  (float :tag Fraction of window)))
 
+(defcustom notmuch-decimal-separator ,
+  The string used as a decimal separator.
+
+Typically \,\ in the US and UK and \.\ in Europe.
+  :group 'notmuch
+  :type 'string)
+
 (defvar notmuch-hello-url http://notmuchmail.org;
   The `notmuch' web site.)
 
@@ -103,6 +110,17 @@ So:
 notmuch-recent-searches-max)
   (setq notmuch-hello-recent-searches (butlast 
notmuch-hello-recent-searches
 
+(defun notmuch-hello-nice-number (n)
+  (let (result)
+(while ( n 0)
+  (push (% n 1000) result)
+  (setq n (/ n 1000)))
+(apply #'concat
+ (number-to-string (car result))
+ (mapcar (lambda (elem)
+ (format %s%03d notmuch-decimal-separator elem))
+(cdr result)
+
 (defun notmuch-hello-trim (search)
   Trim whitespace.
   (if (string-match ^[[:space:]]*\\(.*[^[:space:]]\\)[[:space:]]*$ search)
@@ -180,9 +198,9 @@ should be. Returns a cons cell `(tags-per-line width)'.
  ((integerp notmuch-column-control)
   (max 1
(/ (- (window-width) notmuch-hello-indent)
-  ;; Count is 7 wide (6 digits plus space), 1 for the space
+  ;; Count is 9 wide (8 digits plus space), 1 for the space
   ;; after the name.
-  (+ 7 1 (max notmuch-column-control widest)
+  (+ 9 1 (max notmuch-column-control widest)
 
  ((floatp notmuch-column-control)
   (let* ((available-width (- (window-width) notmuch-hello-indent))
@@ -192,12 +210,15 @@ should be. Returns a cons cell `(tags-per-line width)'.
  (t
   (max 1
(/ (- (window-width) notmuch-hello-indent)
-  ;; Count is 7 wide (6 digits plus space), 1 for the space
+  ;; Count is 9 wide (8 digits plus space), 1 for the space
   ;; after the name.
-  (+ 7 1 widest)))
+  (+ 9 1 widest)))
 
 (cons tags-per-line (/ (- (window-width) notmuch-hello-indent
- (* tags-per-line (+ 7 1)))
+ ;; Count is 9 wide (8 digits plus
+ ;; space), 1 for the space after the
+ ;; name.
+ (* tags-per-line (+ 9 1)))
   tags-per-line
 
 (defun notmuch-hello-insert-tags (tag-alist widest target)
@@ -218,7 +239,9 @@ should be. Returns a cons cell `(tags-per-line width)'.
  (let* ((name (car elem))
 (query (cdr elem))
 (formatted-name (format %s  name)))
-   (widget-insert (format %6s  (notmuch-saved-search-count 
query)))
+   (widget-insert (format %8s 
+  (notmuch-hello-nice-number
+   (string-to-number 
(notmuch-saved-search-count query)
(if (string= formatted-name target)
(setq found-target-pos (point-marker)))
(widget-create 'push-button
@@ -323,7 +346,8 @@ should be. Returns a cons cell `(tags-per-line width)'.
 :notify (lambda (rest ignore)
   (notmuch-hello-update))
 :help-echo Refresh
-(car (process-lines notmuch-command count)))
+(notmuch-hello-nice-number
+ (string-to-number (car (process-lines notmuch-command 
count)
   (widget-insert  messages (that's not much mail).\n))
 
 (let ((found-target-pos nil)
-- 
1.7.0

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] emacs: More functionality for `notmuch-wash-tidy-citations'.

2010-05-04 Thread David Edmondson
On Tue,  4 May 2010 14:45:14 +0100, David Edmondson d...@dme.org wrote:
 Add:
 - Insert a blank line before a citation if there isn't one,
 - Insert a blank line after a citation if there isn't one.

Don't use this, it matches too often.

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


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


[PATCH] emacs: More functionality for `notmuch-wash-tidy-citations'.

2010-05-04 Thread David Edmondson
Add:
- Insert a blank line before a citation if there isn't one,
- Insert a blank line after a citation if there isn't one.
---

Better than the last version.

 emacs/notmuch-wash.el |   12 +++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/emacs/notmuch-wash.el b/emacs/notmuch-wash.el
index 46e1824..26a3f88 100644
--- a/emacs/notmuch-wash.el
+++ b/emacs/notmuch-wash.el
@@ -214,7 +214,17 @@ Perform four transformations on the message body:
   ;; text.
   (goto-char (point-min))
   (while (re-search-forward \\(^[ ]*\n\\)\\(^$\\|^[^].*\\) nil t)
-(replace-match \\2)))
+(replace-match \\2))
+
+  ;; Insert a blank line before a citation if there isn't one.
+  (goto-char (point-min))
+  (while (re-search-forward \\(^[^]+\\)\n nil t)
+(replace-match \\1\n\n))
+
+  ;; Insert a blank line after a citation if there isn't one.
+  (goto-char (point-min))
+  (while (re-search-forward \\(^.+\\)\n\\([^]\\) nil t)
+(replace-match \\1\n\n\\2)))
 
 ;;
 
-- 
1.7.0

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: Failing test cases

2010-05-04 Thread Carl Worth
On Fri, 30 Apr 2010 01:23:16 + (UTC), Olly Betts o...@survex.com wrote:
 On 2010-04-28, Jason White wrote:
  It seems to be repeatable here, even after running git clean -d -f -x,
  followed by make  make test
 
  Is anyone else seeing this?
 
 Yes, I got the same failure trying to rebuild the notmuch 0.3.1 Debian package
 with Xapian 1.2.0 (building in a clean Debian sid chroot on x86-64).
 
 I'm hoping to get 1.2.x in for Debian's next stable release, so it would be
 good to work out what's going on.

Here's a little update.

I wasn't getting this failure because I was building against Xapian
1.0.18, (while using a clean Debian sid chroot now installs Xapian
1.0.20).

I installed Xapian 1.0.20 (from the libxapian-dev package in sid) and am
now getting this failure.

I'm investigating more closely now, but I thought I'd at least share
that much information.

-Carl

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


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


Re: Failing test cases

2010-05-04 Thread Carl Worth
On Tue, 04 May 2010 11:21:27 -0700, Carl Worth cwo...@cworth.org wrote:
 I installed Xapian 1.0.20 (from the libxapian-dev package in sid) and am
 now getting this failure.
 
 I'm investigating more closely now, but I thought I'd at least share
 that much information.

Here are my conclusions based on some additional investigation:

What's happening here is that notmuch is creating a Xapian TermIterator,
iterating over some of the results, and then modifying the database such
that the terms being iterated over are affected. Specifically, in this
test case, notmuch is inserting a new term before the term being pointed
at by the iterator.

With Xapian 1.0.18 incrementing the iterator from this state causes it
to point to the next term. However, with Xapian 1.0.20 this same
increment causes the iterator to point at the same term again.

I was able to put a little workaround into notmuch-new.c that avoids the
bug (see below). But this isn't entirely satisfactory for several
reasons:

1. We need to know what the intended semantics of the Xapian iterators
   really are. If this behavior is just a bug in Xapian, then that
   should be fixed.

   But if the iterators are to have explicitly undefined behavior in
   cases like this, then notmuch is going to need to carefully copy
   contents out of Xapian iterators when creating notmuch iterators (at
   some performance cost).

2. Working around the bug in notmuch-new.c doesn't fix the notmuch
   library itself, (so that python bindings, etc. will remain
   broken). So we really do need a lower-level fix for this.

To properly do the lower-level fix for (2), we'll need to know the
answer to (1). Olly, do you have an answer on the intended semantics of
Xapian iterators?

-Carl

diff --git a/notmuch-new.c b/notmuch-new.c
index 8818728..928bb94 100644
--- a/notmuch-new.c
+++ b/notmuch-new.c
@@ -380,7 +380,11 @@ add_files_recursive (notmuch_database_t *notmuch,
if (notmuch_filenames_valid (db_files) 
strcmp (notmuch_filenames_get (db_files), entry-d_name) == 0)
{
-   notmuch_filenames_move_to_next (db_files);
+   while (notmuch_filenames_valid (db_files) 
+  strcmp (notmuch_filenames_get (db_files), entry-d_name) = 
0)
+   {
+   notmuch_filenames_move_to_next (db_files);
+   }
continue;
}
 


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


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


Re: notmuch emacs interface

2010-05-04 Thread Paul R

Carl I didn't have any specific plans. I think things like this are
Carl generally great if done by people already reading those lists.
Carl Would you like to send a note including something very much like
Carl the paragraph above along with Hey, I thought some poeple here
Carl might be interested in the recent development of notmuch. ... See
Carl the notmuch-gxuj+tv9eo5zyzon3hd...@public.gmane.org list for
Carl more.?

Sure I can do so. Let's wait for the event of a release. Given your
roadmap, are you ok with an announce for NotMuch 0.4 ?

-- 
  Paul
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 2/2] test: Have notmuch-test use the modular test collections

2010-05-04 Thread Jesse Rosenthal
These two patches, it turns out, do not quite go all the way -- they do
not set up the environment to be exactly as it was in the full test
suite. (I discovered this because my modular test suite did not fail on
the recent xapian error -- failure being success in this case.)

Further patches, which will be sent tomorrow, will take care of this in
a very naive way: essentially repeating all the steps from the original
suite up to each set of tests -- this means, of course, that the full
test suite will take longer to run, since it will have to recreate the
nm database for each collection. It's still quick enough though, and
this can be improved if we change the expected results for each tests to
conform to more uniquely tailored setups, instead of the leftovers from
previous tests.

Best,
Jesse


___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch