[PATCH 00/10] Fix 'notmuch new' atomicity issues

2011-05-28 Thread Austin Clements
Rebased to current master (cb8418) as atomic-new-v4 (aka
for-review/atomic-new-v4).

On Wed, May 4, 2011 at 4:30 PM, Austin Clements  wrote:
> jrollins found a timing bug in the atomicity test. ?A fix, plus beefed
> up test comments are on a new atomic-new-v3 (and
> for-review/atomic-new-v3) branch at
> ?http://awakening.csail.mit.edu/git/notmuch.git/
> Since this is more than a rebase, I'll email an update to the one
> changed patch in the series.
>
> On Tue, Apr 26, 2011 at 12:13 AM, Austin Clements  wrote:
>> Bump. ?Now rebased against current head (with no conflicts) on
>> atomic-new-v2 (and for-review/atomic-new-v2) at
>> ?http://awakening.csail.mit.edu/git/notmuch.git/
>>
>> On Fri, Feb 18, 2011 at 2:58 AM, Austin Clements  wrote:
>>> This patch series modifies notmuch new to perform all operations
>>> atomically and to perform maildir flag synchronization eagerly. ?As a
>>> result, notmuch new can be interrupted without risking database
>>> consistency or losing track of messages, but still without losing
>>> progress in the middle of a big import. ?This also paves the way for
>>> fixing the antisocial locking behavior of notmuch new.
>>>
>>> While there are quite a few patches in the series, each one is
>>> bite-sized and you can see the number of atomicity violations dropping
>>> with nearly every patch using the test added by the first patch.
>>>
>>> On my test machine, these patches have no affect on performance.
>>>
>>> These patches are also available on the atomic-new-v1 branch at
>>> ?http://awakening.csail.mit.edu/git/notmuch.git/
>>>
>>> ___
>>> notmuch mailing list
>>> notmuch at notmuchmail.org
>>> http://notmuchmail.org/mailman/listinfo/notmuch
>>>
>>
>


release-candidate/0.6 redux

2011-05-28 Thread Austin Clements
On Sat, May 28, 2011 at 5:58 PM, Jameson Graef Rollins
 wrote:
> Austin: speaking of which, would you mind rebasing that patch series
> against notmuch/master at cb8418784c21155ffea79cce8409a7ea3c546937 and
> sending that to the list again? ?That might help push Carl to merge that
> stuff sooner. ?I think the conflicts are very minor.

Done.  The only conflicts were the usual suspects (lists in the test
suite).  I pulled in the GDB dependency in the test suite and the
corresponding tweaks to test-lib that were on the list previously
(id:"1305206080-17461-1-git-send-email-amdragon at mit.edu" and
id:"1305206110-17511-1-git-send-email-amdragon at mit.edu").  It's on
for-review/atomic-new-v4 at the usual,
  http://awakening.csail.mit.edu/git/notmuch.git


[PATCH 2/2] emacs: Unbind M-RET as display of thread with crypto switch.

2011-05-28 Thread Jameson Graef Rollins
Use prefix argument instead to set switch.
---
 emacs/notmuch.el |7 +--
 1 files changed, 1 insertions(+), 6 deletions(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 3311fe8..0978c66 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -218,7 +218,6 @@ For a mouse binding, return nil."
 (define-key map "-" 'notmuch-search-remove-tag)
 (define-key map "+" 'notmuch-search-add-tag)
 (define-key map (kbd "RET") 'notmuch-search-show-thread)
-(define-key map (kbd "M-RET") 'notmuch-search-show-thread-crypto-switch)
 map)
   "Keymap for \"notmuch search\" buffers.")
 (fset 'notmuch-search-mode-map notmuch-search-mode-map)
@@ -418,13 +417,9 @@ Complete list of currently available key bindings:
   "Return a list of authors for the current region"
   (notmuch-search-properties-in-region 'notmuch-search-subject beg end))

-(defun notmuch-search-show-thread-crypto-switch ()
-  (interactive)
-  (notmuch-search-show-thread t))
-
 (defun notmuch-search-show-thread ( crypto-switch)
   "Display the currently selected thread."
-  (interactive)
+  (interactive "P")
   (let ((thread-id (notmuch-search-find-thread-id))
(subject (notmuch-search-find-subject)))
 (if (> (length thread-id) 0)
-- 
1.7.4.4



[PATCH 1/2] emacs: add notmuch-show-refresh-view function

2011-05-28 Thread Jameson Graef Rollins
This function, like the equivalent for notmuch-search, just refreshes
the current show view.  Like in notmuch-search, this new function is
bound to "=".  If a prefix is given then the rediplay happens with the
crypto-switch set, which displays the thread with the opposite logic
of whatever is set in the notmuch-crypto-process-mime customization
variable.
---
 emacs/notmuch-show.el |   42 +++---
 1 files changed, 35 insertions(+), 7 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index a25ad99..3b35b81 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -780,8 +780,14 @@ current buffer, if possible."
   "Insert the forest of threads FOREST."
   (mapc '(lambda (thread) (notmuch-show-insert-thread thread 0)) forest))

+(defvar notmuch-show-thread-id nil)
+(make-variable-buffer-local 'notmuch-show-thread-id)
 (defvar notmuch-show-parent-buffer nil)
 (make-variable-buffer-local 'notmuch-show-parent-buffer)
+(defvar notmuch-show-query-context nil)
+(make-variable-buffer-local 'notmuch-show-query-context)
+(defvar notmuch-show-buffer-name nil)
+(make-variable-buffer-local 'notmuch-show-buffer-name)

 ;;;###autoload
 (defun notmuch-show (thread-id  parent-buffer query-context 
buffer-name crypto-switch)
@@ -801,17 +807,23 @@ which the message thread is shown. If it is nil (which 
occurs
 when the command is called interactively) the argument to the
 function is used. "
   (interactive "sNotmuch show: ")
-  (let ((buffer (get-buffer-create (generate-new-buffer-name
-   (or buffer-name
-   (concat "*notmuch-" thread-id "*")
-   (process-crypto (if crypto-switch
-   (not notmuch-crypto-process-mime)
- notmuch-crypto-process-mime))
-   (inhibit-read-only t))
+  (let* ((buffer-name (generate-new-buffer-name
+  (or buffer-name
+  (concat "*notmuch-" thread-id "*"
+(buffer (get-buffer-create buffer-name))
+(process-crypto (if crypto-switch
+(not notmuch-crypto-process-mime)
+  notmuch-crypto-process-mime))
+(inhibit-read-only t))
 (switch-to-buffer buffer)
 (notmuch-show-mode)
+
+(setq notmuch-show-thread-id thread-id)
 (setq notmuch-show-parent-buffer parent-buffer)
+(setq notmuch-show-query-context query-context)
+(setq notmuch-show-buffer-name buffer-name)
 (setq notmuch-show-process-crypto process-crypto)
+
 (erase-buffer)
 (goto-char (point-min))
 (save-excursion
@@ -844,6 +856,21 @@ function is used. "

 (notmuch-show-mark-read)))

+(defun notmuch-show-refresh-view ( crypto-switch)
+  "Refresh the current view (with crypto switch if prefix given).
+
+Kills the current buffer and reruns notmuch show with the same
+thread id.  If a prefix is given, the current thread is
+redisplayed with the crypto switch activated, which switch the
+logic of the notmuch-crypto-process-mime customization variable."
+  (interactive "P")
+  (let ((thread-id notmuch-show-thread-id)
+   (parent-buffer notmuch-show-parent-buffer)
+   (query-context notmuch-show-query-context)
+   (buffer-name notmuch-show-buffer-name))
+(notmuch-kill-this-buffer)
+(notmuch-show thread-id parent-buffer query-context buffer-name 
crypto-switch)))
+
 (defvar notmuch-show-stash-map
   (let ((map (make-sparse-keymap)))
 (define-key map "c" 'notmuch-show-stash-cc)
@@ -875,6 +902,7 @@ function is used. "
(define-key map "V" 'notmuch-show-view-raw-message)
(define-key map "v" 'notmuch-show-view-all-mime-parts)
(define-key map "c" 'notmuch-show-stash-map)
+   (define-key map "=" 'notmuch-show-refresh-view)
(define-key map "h" 'notmuch-show-toggle-headers)
(define-key map "-" 'notmuch-show-remove-tag)
(define-key map "+" 'notmuch-show-add-tag)
-- 
1.7.4.4



proposed debian upload 0.5.5

2011-05-28 Thread David Bremner
On Sat, 28 May 2011 09:37:59 -0300, David Bremner  wrote:
> 
> I'd like to upload current master to debian experimental.  I think this
> might help with a few integration issues (libgmime in particular, and
> maybe gpg-agent).
> 
> My branch is at 
> 
>
> http://pivot.cs.unb.ca/git/?p=notmuch.git;a=shortlog;h=refs/heads/proposed-0.5.5

For the archives, after some heroic bikeshedding about the version
number, I uploaded 0.6~171 to experimental. This is based on
cb8418784c2, with the changes at 

git://pivot.cs.unb.ca/notmuch.git
branch: debian-0.6-171

   8844eb1 update debian/libnotmuch1.symbols
   1c3f767 Override RPATH_LDFLAGS for Debian build.
   b61aa86 Add changelog stanza for new upstream version.
   88340a8 bump notmuch version to 0.6~171
   0fa1281 Add myself as an uploader for the Debian package.
   b44ed1b Incorporate changelog entries from post 0.5 Debian uploads.
   a3e98d2 tests: Add optional use of timeout utility, if present.

I lowered the timeout to 2 minutes, because there now several tests
using smtp_dummy, and these hang when building in a chroot (at least
with debian sbuild).

d
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 315 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20110528/5d7878a4/attachment.pgp>


release-candidate/0.6 redux

2011-05-28 Thread Jameson Graef Rollins
On Sat, 28 May 2011 14:51:35 -0700, Jameson Graef Rollins  wrote:
> So what follows is a patch series for a bunch of miscellaneous patches
> that should be included in 0.6.  Most of them were originally part of
> the release-candiate/0.6 branch, and they are here rebased on top of
> notmuch/master at cb8418784c21155ffea79cce8409a7ea3c546937, which
> includes all the multipart and crypto rework.

I forgot to mention that the other two things that were in the original
release-candidate/0.6 that really need to be included before 0.6 is
released are

* Austin Clements's atomicity patches
* Felipe Contreras's vim patches

both of which have been sent to the list previously, although I believe
that Austin might have a couple extra patches in his atomic-new-v3
branch.

Austin: speaking of which, would you mind rebasing that patch series
against notmuch/master at cb8418784c21155ffea79cce8409a7ea3c546937 and
sending that to the list again?  That might help push Carl to merge that
stuff sooner.  I think the conflicts are very minor.

jamie.
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20110528/5b65612c/attachment-0001.pgp>


[PATCH 25/25] Fix stdout stream grabbing in format_part_content_text

2011-05-28 Thread Jameson Graef Rollins
The declaration of the GMimeStream pointer to stdout in
format_part_content_text was somehow preventing subsequent printf
calls from outputting to stdout if the output was redirected to a
file.  Scoping the declaration to the actual use of the stream pointer
works around this problem.
---
 notmuch-show.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/notmuch-show.c b/notmuch-show.c
index e90f07e..61c6f49 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -447,7 +447,6 @@ format_part_content_text (GMimeObject *part)
 {
 GMimeContentDisposition *disposition = 
g_mime_object_get_content_disposition (part);
 GMimeContentType *content_type = g_mime_object_get_content_type 
(GMIME_OBJECT (part));
-GMimeStream *stream_stdout = g_mime_stream_file_new (stdout);

 printf (", Content-type: %s\n", g_mime_content_type_to_string 
(content_type));

@@ -462,6 +461,7 @@ format_part_content_text (GMimeObject *part)
 if (g_mime_content_type_is_type (content_type, "text", "*") &&
!g_mime_content_type_is_type (content_type, "text", "html"))
 {
+   GMimeStream *stream_stdout = g_mime_stream_file_new (stdout);
g_mime_stream_file_set_owner (GMIME_STREAM_FILE (stream_stdout), FALSE);
show_part_content (part, stream_stdout);
g_object_unref(stream_stdout);
-- 
1.7.4.4



[PATCH 24/25] test: modify multipart test to use test_expect_equal_file

2011-05-28 Thread Jameson Graef Rollins
Again, this is a much cleaner and more thorough test, and in fact
exposes a bug in the format=text output, that will be fixed the next
commit.  Because of this, some of the multipart tests currently fail.
---
 test/multipart |  189 
 1 files changed, 121 insertions(+), 68 deletions(-)

diff --git a/test/multipart b/test/multipart
index 62efd84..6d194a5 100755
--- a/test/multipart
+++ b/test/multipart
@@ -59,9 +59,9 @@ EOF
 notmuch new > /dev/null

 test_begin_subtest "--format=text --part=0, full message"
-output=$(notmuch show --format=text --part=0 'id:87liy5ap00.fsf at 
yoom.home.cworth.org')
-test_expect_equal "$output" \
-"message{ id:87liy5ap00.fsf at yoom.home.cworth.org depth:0 match:1 
filename:${MAIL_DIR}/multipart
+notmuch show --format=text --part=0 'id:87liy5ap00.fsf at 
yoom.home.cworth.org' >OUTPUT
+cat OUTPUT
+cat OUTPUT
+cat OUTPUT
+cat OUTPUT
+cat OUTPUT
+cat OUTPUT
+cat 

[PATCH 23/25] test: update emacs test to use test_expect_equal_file

2011-05-28 Thread Jameson Graef Rollins
This is a much cleaner way to do the emacs tests, since we're actually
comparing output against existing files with expected output.  We also
won't miss any trailing newlines this way.

And speaking of which, one of the expected output files was actually
missing a trailing blank line that was actually in one of the original
messages, so this was fixed.
---
 test/emacs |   80 +--
 .../notmuch-show-thread-maildir-storage|1 +
 2 files changed, 39 insertions(+), 42 deletions(-)

diff --git a/test/emacs b/test/emacs
index 042f1cb..f14249e 100755
--- a/test/emacs
+++ b/test/emacs
@@ -7,39 +7,33 @@ EXPECTED=../emacs.expected-output
 add_email_corpus

 test_begin_subtest "Basic notmuch-hello view in emacs"
-output=$(test_emacs '(notmuch-hello) (princ (buffer-string))')
-expected=$(cat $EXPECTED/notmuch-hello)
-test_expect_equal "$output" "$expected"
+test_emacs '(notmuch-hello) (princ (buffer-string))' >OUTPUT
+test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello

 test_begin_subtest "Saved search with 0 results"
-output=$(test_emacs '(setq notmuch-show-empty-saved-searches t) (setq 
notmuch-saved-searches '\''(("inbox" . "tag:inbox") ("unread" . "tag:unread") 
("empty" . "tag:doesnotexist"))) (notmuch-hello) (princ (buffer-string))')
-expected=$(cat $EXPECTED/notmuch-hello-with-empty)
-test_expect_equal "$output" "$expected"
+test_emacs '(setq notmuch-show-empty-saved-searches t) (setq 
notmuch-saved-searches '\''(("inbox" . "tag:inbox") ("unread" . "tag:unread") 
("empty" . "tag:doesnotexist"))) (notmuch-hello) (princ (buffer-string))' 
>OUTPUT
+test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello-with-empty

 test_begin_subtest "No saved searches displayed (all with 0 results)"
-output=$(test_emacs '(setq notmuch-saved-searches '\''(("empty" . 
"tag:doesnotexist"))) (notmuch-hello) (princ (buffer-string))')
-expected=$(cat $EXPECTED/notmuch-hello-no-saved-searches)
-test_expect_equal "$output" "$expected"
+test_emacs '(setq notmuch-saved-searches '\''(("empty" . "tag:doesnotexist"))) 
(notmuch-hello) (princ (buffer-string))' >OUTPUT
+test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello-no-saved-searches

 test_begin_subtest "Basic notmuch-search view in emacs"
-output=$(test_emacs '(notmuch-search "tag:inbox") (notmuch-test-wait) (princ 
(buffer-string))')
-expected=$(cat $EXPECTED/notmuch-search-tag-inbox)
-test_expect_equal "$output" "$expected"
+test_emacs '(notmuch-search "tag:inbox") (notmuch-test-wait) (princ 
(buffer-string))' >OUTPUT
+test_expect_equal_file OUTPUT $EXPECTED/notmuch-search-tag-inbox

 test_begin_subtest "Navigation of notmuch-hello to search results"
-output=$(test_emacs '(notmuch-hello) (goto-char (point-min)) 
(re-search-forward "inbox") (widget-button-press (point)) (notmuch-test-wait) 
(princ (buffer-string))')
-expected=$(cat $EXPECTED/notmuch-hello-view-inbox)
-test_expect_equal "$output" "$expected"
+test_emacs '(notmuch-hello) (goto-char (point-min)) (re-search-forward 
"inbox") (widget-button-press (point)) (notmuch-test-wait) (princ 
(buffer-string))' >OUTPUT
+test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello-view-inbox

 test_begin_subtest "Basic notmuch-show view in emacs"
 maildir_storage_thread=$(notmuch search --output=threads 
id:20091117190054.GU3165 at dottiness.seas.harvard.edu)
-output=$(test_emacs "(notmuch-show \"$maildir_storage_thread\") (princ 
(buffer-string))")
-expected=$(cat $EXPECTED/notmuch-show-thread-maildir-storage)
-test_expect_equal "$output" "$expected"
+test_emacs "(notmuch-show \"$maildir_storage_thread\") (princ 
(buffer-string))" >OUTPUT
+test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-maildir-storage

 test_begin_subtest "Navigation of notmuch-search to thread view"
-output=$(test_emacs '(notmuch-search "tag:inbox") (notmuch-test-wait) 
(goto-char (point-min)) (re-search-forward "Working with Maildir") 
(notmuch-search-show-thread) (notmuch-test-wait) (princ (buffer-string))')
-test_expect_equal "$output" "$expected"
+test_emacs '(notmuch-search "tag:inbox") (notmuch-test-wait) (goto-char 
(point-min)) (re-search-forward "Working with Maildir") 
(notmuch-search-show-thread) (notmuch-test-wait) (princ (buffer-string))' 
>OUTPUT
+test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-maildir-storage

 test_begin_subtest "Add tag from search view"
 os_x_darwin_thread=$(notmuch search --output=threads 
id:ddd65cda0911171950o4eea4389v86de9525e46052d3 at mail.gmail.com)
@@ -80,10 +74,11 @@ smtp_dummy_pid=$!
 test_emacs "(setq message-send-mail-function 'message-smtpmail-send-it) (setq 
smtpmail-smtp-server \"localhost\") (setq smtpmail-smtp-service \"25025\") 
(notmuch-hello) (notmuch-mua-mail) (message-goto-to) (insert \"user at 
example.com\nDate: Fri, 29 Mar 1974 10:00:00 -\") (message-goto-subject) 
(insert \"Testing message sent via SMTP\") (message-goto-body) (insert \"This 
is a test that messages are sent via SMTP\") (message-send-and-exit)" 

[PATCH 22/25] test: fix test_expect_equal_file test to copy instead of mv test files

2011-05-28 Thread Jameson Graef Rollins
This is a pretty important fix to this test, so that it can be used to
test against existing files, without deleting them in the case of test
failure.
---
 test/test-lib.sh |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/test/test-lib.sh b/test/test-lib.sh
index 6a8cb98..a59d1c1 100755
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -477,8 +477,8 @@ test_expect_equal_file ()
test_ok_ "$test_subtest_name"
else
testname=$this_test.$test_count
-   mv "$output" $testname.output
-   mv "$expected" $testname.expected
+   cp "$output" $testname.output
+   cp "$expected" $testname.expected
test_failure_ "$test_subtest_name" "$(diff -u 
$testname.expected $testname.output)"
fi
 fi
-- 
1.7.4.4



[PATCH 21/25] emacs: Cleaner interface when prompting for sender address

2011-05-28 Thread Jameson Graef Rollins
From: Thomas Jost 

Most of the time, every entry in the list of identities has the same user name
part. It can then be filled in automatically, and the user can only be prompted
for the email address, which makes the interface much cleaner.
---
 emacs/notmuch-mua.el |   33 +++--
 1 files changed, 23 insertions(+), 10 deletions(-)

diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
index 556d2bf..274c5da 100644
--- a/emacs/notmuch-mua.el
+++ b/emacs/notmuch-mua.el
@@ -162,20 +162,33 @@ the From: header is already filled in by notmuch."
   :group 'notmuch
   :type 'boolean)

-(defun notmuch-mua-sender-collection ()
-  (if notmuch-identities
-  notmuch-identities
-(mapcar (lambda (address)
- (concat (notmuch-user-name) " <" address ">"))
-   (cons (notmuch-user-primary-email) (notmuch-user-other-email)
-
 (defvar notmuch-mua-sender-history nil)

 (defun notmuch-mua-prompt-for-sender ()
   (interactive)
-  (let ((collection (notmuch-mua-sender-collection)))
-(ido-completing-read "Send mail From: " collection
-nil 'confirm nil 'notmuch-mua-sender-history (car 
collection
+  (let (name addresses one-name-only)
+;; If notmuch-identities is non-nil, check if there is a fixed user name.
+(if notmuch-identities
+   (let ((components (mapcar 'mail-extract-address-components 
notmuch-identities)))
+ (setq name  (caar components)
+   addresses (mapcar 'cadr components)
+   one-name-only (eval
+  (cons 'and
+(mapcar (lambda (identity)
+  (string-equal name (car 
identity)))
+components)
+  ;; If notmuch-identities is nil, use values from the notmuch 
configuration file.
+  (setq name  (notmuch-user-name)
+   addresses (cons (notmuch-user-primary-email) 
(notmuch-user-other-email))
+   one-name-only t))
+;; Now prompt the user, either for an email address only or for a full 
identity.
+(if one-name-only
+   (let ((address
+  (ido-completing-read (concat "Sender address for " name ": ") 
addresses
+   nil nil nil 'notmuch-mua-sender-history 
(car addresses
+ (concat name " <" address ">"))
+  (ido-completing-read "Send mail From: " notmuch-identities
+  nil nil nil 'notmuch-mua-sender-history (car 
notmuch-identities)

 (defun notmuch-mua-new-mail ( prompt-for-sender)
   "Invoke the notmuch mail composition window.
-- 
1.7.4.4



[PATCH 20/25] emacs: Don't always prompt for the "From" address when replying

2011-05-28 Thread Jameson Graef Rollins
From: Thomas Jost 

When replying, the From: address is already filled in by notmuch reply, so most
of the time there is no need to prompt the user for it.
---
 emacs/notmuch-mua.el |7 +--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
index 7c05a81..556d2bf 100644
--- a/emacs/notmuch-mua.el
+++ b/emacs/notmuch-mua.el
@@ -155,7 +155,10 @@ name and addresses configured in the notmuch configuration 
file."
   :type '(repeat string))

 (defcustom notmuch-always-prompt-for-sender nil
-  "Always prompt for the From: address when composing a new message."
+  "Always prompt for the From: address when composing or forwarding a message.
+
+This is not taken into account when replying to a message, because in that case
+the From: header is already filled in by notmuch."
   :group 'notmuch
   :type 'boolean)

@@ -203,7 +206,7 @@ the From: address first."
   "Invoke the notmuch reply window."
   (interactive "P")
   (let ((sender
-(when (or prompt-for-sender notmuch-always-prompt-for-sender)
+(when prompt-for-sender
   (notmuch-mua-prompt-for-sender
 (notmuch-mua-reply query-string sender)))

-- 
1.7.4.4



[PATCH 19/25] emacs: fix notmuch-show-part-button to not include newline

2011-05-28 Thread Jameson Graef Rollins
This makes the button cleaner, so that it doesn't include the entire
rest of the line that the button is on.
---
 emacs/notmuch-show.el |   29 +
 1 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 6c498ab..a25ad99 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -280,18 +280,23 @@ message at DEPTH in the current thread."
   'face 'message-mml)

 (defun notmuch-show-insert-part-header (nth content-type declared-type 
 name comment)
-  (insert-button
-   (concat "[ "
-  (if name (concat name ": ") "")
-  declared-type
-  (if (not (string-equal declared-type content-type))
-  (concat " (as " content-type ")")
-"")
-  (or comment "")
-  " ]\n")
-   :type 'notmuch-show-part-button-type
-   :notmuch-part nth
-   :notmuch-filename name))
+  (let ((button))
+(setq button
+ (insert-button
+  (concat "[ "
+  (if name (concat name ": ") "")
+  declared-type
+  (if (not (string-equal declared-type content-type))
+  (concat " (as " content-type ")")
+"")
+  (or comment "")
+  " ]")
+  :type 'notmuch-show-part-button-type
+  :notmuch-part nth
+  :notmuch-filename name))
+(insert "\n")
+;; return button
+button))

 ;; Functions handling particular MIME parts.

-- 
1.7.4.4



[PATCH 17/25] avoid segfault when calling sanitize_string() on NULL

2011-05-28 Thread Jameson Graef Rollins
From: Daniel Kahn Gillmor 

Signed-off-by: Jameson Graef Rollins 
---
 notmuch-search.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/notmuch-search.c b/notmuch-search.c
index 530cecc..616fe68 100644
--- a/notmuch-search.c
+++ b/notmuch-search.c
@@ -116,6 +116,9 @@ sanitize_string (const void *ctx, const char *str)
 {
 char *out, *loop;

+if (NULL == str)
+   return NULL;
+
 loop = out = talloc_strdup (ctx, str);

 for (; *loop; loop++) {
-- 
1.7.4.4



[PATCH 16/25] lib/message-file: plug three memleaks.

2011-05-28 Thread Jameson Graef Rollins
From: Anton Khirnov 

Signed-off-by: Jameson Graef Rollins 
---
 lib/message-file.c |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/lib/message-file.c b/lib/message-file.c
index 7722832..99505c1 100644
--- a/lib/message-file.c
+++ b/lib/message-file.c
@@ -341,12 +341,17 @@ notmuch_message_file_get_header (notmuch_message_file_t 
*message,
strncpy(combined_header,header_sofar,hdrsofar);
*(combined_header+hdrsofar) = ' ';
strncpy(combined_header+hdrsofar+1,decoded_value,newhdr+1);
+   free (decoded_value);
g_hash_table_insert (message->headers, header, combined_header);
}
} else {
if (header_sofar == NULL) {
/* Only insert if we don't have a value for this header, yet. */
g_hash_table_insert (message->headers, header, decoded_value);
+   } else {
+   free (header);
+   free (decoded_value);
+   decoded_value = header_sofar;
}
}
/* if we found a match we can bail - unless of course we are
-- 
1.7.4.4



[PATCH 15/25] Use message-field-value instead of message-fetch-field in FCC header setup.

2011-05-28 Thread Jameson Graef Rollins
From: Dmitry Kurochkin 

For message-fetch-field the buffer is expected to be narrowed to
just the header of the message.  That is not the case when
notmuch-fcc-header-setup is run, hence a wrong header value may be
returned.  E.g. when forwarding an
email, (message-fetch-field "From") returns the From header value
of the forwarded email.

Message-field-value is the same as message-fetch-field, only
narrows the buffer to the headers first.

Signed-off-by: Jameson Graef Rollins 
---
 emacs/notmuch-maildir-fcc.el |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/emacs/notmuch-maildir-fcc.el b/emacs/notmuch-maildir-fcc.el
index b79f6a3..b6c6e2a 100644
--- a/emacs/notmuch-maildir-fcc.el
+++ b/emacs/notmuch-maildir-fcc.el
@@ -80,7 +80,7 @@ will NOT be removed or replaced."
   (let ((subdir
 (cond
  ((or (not notmuch-fcc-dirs)
-  (message-fetch-field "Fcc"))
+  (message-field-value "Fcc"))
   ;; Nothing set or an existing header.
   nil)

@@ -93,7 +93,7 @@ will NOT be removed or replaced."
   (error "Invalid `notmuch-fcc-dirs' setting (old style)"))

  ((listp notmuch-fcc-dirs)
-  (let* ((from (message-fetch-field "From"))
+  (let* ((from (message-field-value "From"))
  (match
   (catch 'first-match
 (dolist (re-folder notmuch-fcc-dirs)
@@ -118,7 +118,7 @@ will NOT be removed or replaced."
  (concat (notmuch-database-path) "/" subdir)

   ;; finally test if fcc points to a valid maildir
-  (let ((fcc-header (message-fetch-field "Fcc")))
+  (let ((fcc-header (message-field-value "Fcc")))
(unless (notmuch-maildir-fcc-dir-is-maildir-p fcc-header)
  (cond ((not (file-writable-p fcc-header))
 (error (format "No permission to create %s, which does not 
exist"
-- 
1.7.4.4



[PATCH 14/25] Fix old style notmuch-fcc-dirs configuration check.

2011-05-28 Thread Jameson Graef Rollins
From: Dmitry Kurochkin 

In notmuch 0.5 notmuch-fcc-dirs style changed.  The previous code
did not correctly identify an old configuration and, as a
consequence, broke new configurations.

The fix was extracted from a bigger patch series by David
Edmondson id:"1290682750-30283-2-git-send-email-dme at dme.org".

Signed-off-by: Jameson Graef Rollins 
---
 emacs/notmuch-maildir-fcc.el |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/emacs/notmuch-maildir-fcc.el b/emacs/notmuch-maildir-fcc.el
index 3f1c124..b79f6a3 100644
--- a/emacs/notmuch-maildir-fcc.el
+++ b/emacs/notmuch-maildir-fcc.el
@@ -88,7 +88,7 @@ will NOT be removed or replaced."
   notmuch-fcc-dirs)

  ((and (listp notmuch-fcc-dirs)
-   (= 1 (length (car notmuch-fcc-dirs
+   (stringp (car notmuch-fcc-dirs)))
   ;; Old style - no longer works.
   (error "Invalid `notmuch-fcc-dirs' setting (old style)"))

-- 
1.7.4.4



[PATCH 13/25] emacs: Use "message-cited-text" instead of "message-cited-text-face"

2011-05-28 Thread Jameson Graef Rollins
From: Pieter Praet 

(describe-face 'message-cited-text-face)
> message-cited-text-face is an alias for the face `message-cited-text'.
> This face is obsolete since 22.1; use `message-cited-text' instead.

Signed-off-by: Pieter Praet 
Signed-off-by: Jameson Graef Rollins 
---
 emacs/notmuch-wash.el |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/emacs/notmuch-wash.el b/emacs/notmuch-wash.el
index e8134bf..115c3bb 100644
--- a/emacs/notmuch-wash.el
+++ b/emacs/notmuch-wash.el
@@ -156,7 +156,7 @@ insert before the button, probably for indentation."
 (let* ((cite-start (match-beginning 0))
   (cite-end (match-end 0))
   (cite-lines (count-lines cite-start cite-end)))
-  (overlay-put (make-overlay cite-start cite-end) 'face 
'message-cited-text-face)
+  (overlay-put (make-overlay cite-start cite-end) 'face 
'message-cited-text)
   (when (> cite-lines (+ notmuch-wash-citation-lines-prefix
 notmuch-wash-citation-lines-suffix
 1))
@@ -178,7 +178,7 @@ insert before the button, probably for indentation."
  (sig-end-marker (make-marker)))
  (set-marker sig-start-marker sig-start)
  (set-marker sig-end-marker (point-max))
- (overlay-put (make-overlay sig-start-marker sig-end-marker) 'face 
'message-cited-text-face)
+ (overlay-put (make-overlay sig-start-marker sig-end-marker) 'face 
'message-cited-text)
  (notmuch-wash-region-to-button
   sig-start-marker sig-end-marker
   "signature" "\n"))
-- 
1.7.4.4



[PATCH 12/25] test: cleanup search-output test names (no functional change)

2011-05-28 Thread Jameson Graef Rollins
Signed-off-by: Jameson Graef Rollins 
---
 test/search-output |   20 ++--
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/test/search-output b/test/search-output
index 8edc26a..02cf602 100755
--- a/test/search-output
+++ b/test/search-output
@@ -4,7 +4,7 @@ test_description='various settings for "notmuch search 
--output="'

 add_email_corpus

-test_begin_subtest "notmuch search --output=threads"
+test_begin_subtest "--output=threads"
 notmuch search --output=threads '*' | sed -e s/thread:.*/thread:THREADID/ 
>OUTPUT
 cat OUTPUT
 cat OUTPUT
 cat OUTPUT
 cat OUTPUT
 cat OUTPUT
 cat OUTPUT
 cat OUTPUT
 cat  OUTPUT
 echo -n >EXPECTED
 test_expect_equal_file OUTPUT EXPECTED

-test_begin_subtest "notmuch search --format=json for non-existent message 
prints proper empty json"
+test_begin_subtest "search --format=json for non-existent message prints 
proper empty json"
 notmuch search --format=json "no-message-matches-this" > OUTPUT
 echo "[]" >EXPECTED
 test_expect_equal_file OUTPUT EXPECTED
-- 
1.7.4.4



[PATCH 11/25] test: add test for sanitized notmuch-search output

2011-05-28 Thread Jameson Graef Rollins
From: Florian Friesdorf 

Signed-off-by: Jameson Graef Rollins 
---
 test/search-output |9 +
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/test/search-output b/test/search-output
index 13f9613..8edc26a 100755
--- a/test/search-output
+++ b/test/search-output
@@ -304,6 +304,15 @@ cat OUTPUT
+cat  OUTPUT
 echo -n >EXPECTED
-- 
1.7.4.4



[PATCH 10/25] Sanitize "Subject:" and "Author:" fields to not contain control characters in notmuch-search

2011-05-28 Thread Jameson Graef Rollins
From: Andreas Amann 

When a Subject field contained encoded CRLF sequences, these sequences
would appear unfiltered in the output of notmuch search. This confused
the notmuch emacs interface leading to "Unexpected Output"
messages. This is now fixed by replacing all characters with ASCII
code less than 32 with a question mark.

Signed-off-by: Jameson Graef Rollins 
---
 notmuch-search.c |   22 --
 1 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/notmuch-search.c b/notmuch-search.c
index 69af617..530cecc 100644
--- a/notmuch-search.c
+++ b/notmuch-search.c
@@ -111,6 +111,20 @@ format_item_id_text (unused (const void *ctx),
 printf ("%s%s", item_type, item_id);
 }

+static char *
+sanitize_string (const void *ctx, const char *str)
+{
+char *out, *loop;
+
+loop = out = talloc_strdup (ctx, str);
+
+for (; *loop; loop++) {
+   if ((unsigned char)(*loop) < 32)
+   *loop = '?';
+}
+return out;
+}
+
 static void
 format_thread_text (const void *ctx,
const char *thread_id,
@@ -120,13 +134,17 @@ format_thread_text (const void *ctx,
const char *authors,
const char *subject)
 {
+void *ctx_quote = talloc_new (ctx);
+
 printf ("thread:%s %12s [%d/%d] %s; %s",
thread_id,
notmuch_time_relative_date (ctx, date),
matched,
total,
-   authors,
-   subject);
+   sanitize_string (ctx_quote, authors),
+   sanitize_string (ctx_quote, subject));
+
+talloc_free (ctx_quote);
 }

 static void
-- 
1.7.4.4



[PATCH 09/25] emacs: Define several faces for the crypto-status button

2011-05-28 Thread Jameson Graef Rollins
From: Thomas Jost 

Signed-off-by: Jameson Graef Rollins 

jrollins modified this patch to conform to recent changes in the
crypto processing since this patch was originally sent in.
---
 emacs/notmuch-crypto.el |   42 --
 1 files changed, 32 insertions(+), 10 deletions(-)

diff --git a/emacs/notmuch-crypto.el b/emacs/notmuch-crypto.el
index cb02840..f03266f 100644
--- a/emacs/notmuch-crypto.el
+++ b/emacs/notmuch-crypto.el
@@ -36,36 +36,58 @@ search."
   :group 'notmuch
   :type 'boolean)

+(defface notmuch-crypto-signature-good
+  '((t (:background "green" :foreground "black")))
+  "Face used for good signatures."
+  :group 'notmuch)
+
+(defface notmuch-crypto-signature-good-key
+  '((t (:background "orange" :foreground "black")))
+  "Face used for good signatures."
+  :group 'notmuch)
+
+(defface notmuch-crypto-signature-bad
+  '((t (:background "red" :foreground "black")))
+  "Face used for bad signatures."
+  :group 'notmuch)
+
+(defface notmuch-crypto-signature-unknown
+  '((t (:background "red" :foreground "black")))
+  "Face used for signatures of unknown status."
+  :group 'notmuch)
+
+(defface notmuch-crypto-decryption
+  '((t (:background "purple" :foreground "black")))
+  "Face used for encryption/decryption status messages."
+  :group 'notmuch)
+
 (define-button-type 'notmuch-crypto-status-button-type
   'action '(lambda (button) (message (button-get button 'help-echo)))
   'follow-link t
-  'help-echo "Set notmuch-crypto-process-mime to process cryptographic mime 
parts."
-  'face '(:foreground "blue")
-  'mouse-face '(:foreground "blue"))
+  'help-echo "Set notmuch-crypto-process-mime to process cryptographic mime 
parts.")

 (defun notmuch-crypto-insert-sigstatus-button (sigstatus from)
   (let* ((status (plist-get sigstatus :status))
 (help-msg nil)
 (label "Signature not processed")
-(face '(:background "red" :foreground "black")))
+(face 'notmuch-crypto-signature-unknown))
 (cond
  ((string= status "good")
   ; if userid present, userid has full or greater validity
   (if (plist-member sigstatus :userid)
  (let ((userid (plist-get sigstatus :userid)))
(setq label (concat "Good signature by: " userid))
-   (setq face '(:background "green" :foreground "black")))
+   (setq face 'notmuch-crypto-signature-good))
(let ((fingerprint (concat "0x" (plist-get sigstatus :fingerprint
  (setq label (concat "Good signature by key: " fingerprint))
- (setq face '(:background "orange" :foreground "black")
+ (setq face 'notmuch-crypto-signature-good-key
  ((string= status "error")
   (let ((keyid (concat "0x" (plist-get sigstatus :keyid
-   (setq label (concat "Unknown key ID " keyid " or unsupported 
algorithm"))
-   (setq face '(:background "red" :foreground "black"
+   (setq label (concat "Unknown key ID " keyid " or unsupported 
algorithm"
  ((string= status "bad")
   (let ((keyid (concat "0x" (plist-get sigstatus :keyid
(setq label (concat "Bad signature (claimed key ID " keyid ")"))
-   (setq face '(:background "red" :foreground "black"
+   (setq face 'notmuch-crypto-signature-bad)))
  (t
   (setq label "Unknown signature status")
   (if status (setq label (concat label " \"" status "\"")
@@ -83,7 +105,7 @@ search."
   (let* ((status (plist-get encstatus :status))
 (help-msg nil)
 (label "Decryption not attempted")
-(face '(:background "purple" :foreground "black")))
+(face 'notmuch-crypto-decryption))
 (cond
  ((string= status "good")
   (setq label "Decryption successful"))
-- 
1.7.4.4



[PATCH 08/25] create and set temporary home directory

2011-05-28 Thread Jameson Graef Rollins
From: Florian Friesdorf 

My first patch send to the list, not sure whether done properly.

In the master branch in test/emacs two tests access the build users home
directory, so does emacs_deliver_message in the crypto branch.

I think the tests should not touch the build user's home directory. The
patch creates a directory in the temporary test directory and sets home
accordingly.

In case of a non-existent home directory, the tests are failing without
this patch.

Signed-off-by: Jameson Graef Rollins 
---
 test/test-lib.sh |7 +++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/test/test-lib.sh b/test/test-lib.sh
index 922b1ef..6a8cb98 100755
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -973,6 +973,13 @@ rm -fr "$test" || {
exit 1
 }

+# A temporary home directory is needed by at least:
+# - emacs/"Sending a message via (fake) SMTP"
+# - emacs/"Reply within emacs"
+# - crypto/emacs_deliver_message
+export HOME="${TMP_DIRECTORY}/home"
+mkdir -p "${HOME}"
+
 MAIL_DIR="${TMP_DIRECTORY}/mail"
 export GNUPGHOME="${TMP_DIRECTORY}/gnupg"
 export NOTMUCH_CONFIG="${TMP_DIRECTORY}/notmuch-config"
-- 
1.7.4.4



[PATCH 07/25] test: remove json test for search null result, since it's being more properly tested in search-output

2011-05-28 Thread Jameson Graef Rollins
The test in json was inferior to the one in search-output, since it
wasn't properly testing for the presence of a trailing newline.
---
 test/json  |4 
 test/search-output |4 +---
 2 files changed, 1 insertions(+), 7 deletions(-)

diff --git a/test/json b/test/json
index 0badb1d..5a2544c 100755
--- a/test/json
+++ b/test/json
@@ -34,8 +34,4 @@ test_expect_equal "$output" "[{\"thread\": \"XXX\",
 \"subject\": \"json-search-utf8-body-s?bj?ct\",
 \"tags\": [\"inbox\", \"unread\"]}]"

-test_begin_subtest "Search returning no messages"
-output=$(notmuch search --format=json "this string had better not match any 
messages" | notmuch_search_sanitize)
-test_expect_equal "$output" "[]"
-
 test_done
diff --git a/test/search-output b/test/search-output
index 8ba8acf..13f9613 100755
--- a/test/search-output
+++ b/test/search-output
@@ -311,9 +311,7 @@ test_expect_equal_file OUTPUT EXPECTED

 test_begin_subtest "notmuch search --format=json for non-existent message 
prints proper empty json"
 notmuch search --format=json "no-message-matches-this" > OUTPUT
-cat EXPECTED
 test_expect_equal_file OUTPUT EXPECTED

 test_done
-- 
1.7.4.4



[PATCH 06/25] test: move utf-8 subject search test from json to search test script

2011-05-28 Thread Jameson Graef Rollins
This test doesn't have anything to do with json, and has everything to
do with testing search capability, so I'm not sure why it was in the
wrong place.
---
 test/json   |5 -
 test/search |6 ++
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/test/json b/test/json
index 7c81856..0badb1d 100755
--- a/test/json
+++ b/test/json
@@ -18,11 +18,6 @@ test_expect_equal "$output" "[{\"thread\": \"XXX\",
 \"subject\": \"json-search-subject\",
 \"tags\": [\"inbox\", \"unread\"]}]"

-test_begin_subtest "Search by subject (utf-8):"
-add_message [subject]=utf8-s?bj?ct "[date]=\"Sat, 01 Jan 2000 12:00:00 -\""
-output=$(notmuch search subject:utf8-s?bj?ct | notmuch_search_sanitize)
-test_expect_equal "$output" "thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; 
utf8-s?bj?ct (inbox unread)"
-
 test_begin_subtest "Show message: json, utf-8"
 add_message "[subject]=\"json-show-utf8-body-s?bj?ct\"" "[date]=\"Sat, 01 Jan 
2000 12:00:00 -\"" "[body]=\"js?n-show-m?ssage\""
 output=$(notmuch show --format=json "js?n-show-m?ssage")
diff --git a/test/search b/test/search
index 4835872..e7c8c54 100755
--- a/test/search
+++ b/test/search
@@ -24,6 +24,11 @@ add_message [subject]=subjectsearchtest '[date]="Sat, 01 Jan 
2000 12:00:00 -
 output=$(notmuch search subject:subjectsearchtest | notmuch_search_sanitize)
 test_expect_equal "$output" "thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; 
subjectsearchtest (inbox unread)"

+test_begin_subtest "Search by subject (utf-8):"
+add_message [subject]=utf8-s?bj?ct '[date]="Sat, 01 Jan 2000 12:00:00 -"'
+output=$(notmuch search subject:utf8-s?bj?ct | notmuch_search_sanitize)
+test_expect_equal "$output" "thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; 
utf8-s?bj?ct (inbox unread)"
+
 test_begin_subtest "Search by id:"
 add_message '[subject]="search by id"' '[date]="Sat, 01 Jan 2000 12:00:00 
-"'
 output=$(notmuch search id:${gen_msg_id} | notmuch_search_sanitize)
@@ -101,6 +106,7 @@ thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; body 
search (inbox unread)
 thread:XXX   2000-01-01 [1/1] searchbyfrom; search by from (inbox unread)
 thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; search by to (inbox unread)
 thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; subjectsearchtest (inbox 
unread)
+thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; utf8-s?bj?ct (inbox unread)
 thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; search by id (inbox unread)
 thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; search by tag (inbox 
searchbytag unread)
 thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; search by thread (inbox 
unread)
-- 
1.7.4.4



[PATCH 05/25] fix trailing newlines in notmuch search

2011-05-28 Thread Jameson Graef Rollins
A previous commit to fix json formatting for null results
(0b1ddc5f6652bde99d63d9d553777b3d926694cf) accidentally introduced a
regression that removed trailing newlines for non-json output.  (There
wasn't a good test for this previously, but there is now).  The
problem is due to the fundamental differences in formatting between
the json and non-json outputs.  The only way to fix this was to add a
new formatting field that represents the string to output at the end
of a null result.

All output formatting tests should pass now.
---
 notmuch-search.c |   18 +++---
 1 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/notmuch-search.c b/notmuch-search.c
index 8b90121..69af617 100644
--- a/notmuch-search.c
+++ b/notmuch-search.c
@@ -48,6 +48,7 @@ typedef struct search_format {
 const char *item_sep;
 const char *item_end;
 const char *results_end;
+const char *results_null;
 } search_format_t;

 static void
@@ -72,6 +73,7 @@ static const search_format_t format_text = {
"%s", " ",
")", "\n",
"",
+"\n",
 "",
 };

@@ -98,6 +100,7 @@ static const search_format_t format_json = {
"]", ",\n",
"}",
 "]\n",
+"]\n",
 };

 static void
@@ -236,7 +239,10 @@ do_search_threads (const search_format_t *format,
notmuch_thread_destroy (thread);
 }

-fputs (format->results_end, stdout);
+if (first_thread)
+   fputs (format->results_null, stdout);
+else
+   fputs (format->results_end, stdout);

 return 0;
 }
@@ -280,7 +286,10 @@ do_search_messages (const search_format_t *format,

 notmuch_messages_destroy (messages);

-fputs (format->results_end, stdout);
+if (first_message)
+   fputs (format->results_null, stdout);
+else
+   fputs (format->results_end, stdout);

 return 0;
 }
@@ -329,7 +338,10 @@ do_search_tags (notmuch_database_t *notmuch,
 if (messages)
notmuch_messages_destroy (messages);

-fputs (format->results_end, stdout);
+if (first_tag)
+   fputs (format->results_null, stdout);
+else
+   fputs (format->results_end, stdout);

 return 0;
 }
-- 
1.7.4.4



[PATCH 04/25] test: move "Search for non-existent message prints nothing" to search-output, and add similar test for format=json

2011-05-28 Thread Jameson Graef Rollins
These tests also use the new test_expect_equal_file test.
---
 test/search|5 -
 test/search-output |   12 
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/test/search b/test/search
index 0981f66..4835872 100755
--- a/test/search
+++ b/test/search
@@ -118,9 +118,4 @@ add_message '[subject]="utf8-message-body-subject"' 
'[date]="Sat, 01 Jan 2000 12
 output=$(notmuch search "b?d?" | notmuch_search_sanitize)
 test_expect_equal "$output" "thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; 
utf8-message-body-subject (inbox unread)"

-test_expect_success "Search for non-existent message prints nothing" '
-echo -n > expected &&
-notmuch search "no-message-matches-this" > actual &&
-test_cmp expected actual'
-
 test_done
diff --git a/test/search-output b/test/search-output
index 1554eb1..8ba8acf 100755
--- a/test/search-output
+++ b/test/search-output
@@ -304,4 +304,16 @@ cat  OUTPUT
+echo -n >EXPECTED
+test_expect_equal_file OUTPUT EXPECTED
+
+test_begin_subtest "notmuch search --format=json for non-existent message 
prints proper empty json"
+notmuch search --format=json "no-message-matches-this" > OUTPUT
+cat 

[PATCH 03/25] test: modify search-output test to use the new test_expect_equal_file function

2011-05-28 Thread Jameson Graef Rollins
These test now properly test for the presence of a newline at the end
of all output.  Right now some of these test will fail because the
search output is currently broken to *not* produce proper newlines in
some cases.
---
 test/search-output |   72 ++-
 1 files changed, 48 insertions(+), 24 deletions(-)

diff --git a/test/search-output b/test/search-output
index 20341d6..1554eb1 100755
--- a/test/search-output
+++ b/test/search-output
@@ -5,8 +5,8 @@ test_description='various settings for "notmuch search 
--output="'
 add_email_corpus

 test_begin_subtest "notmuch search --output=threads"
-output=$(notmuch search --output=threads '*' | sed -e 
s/thread:.*/thread:THREADID/)
-test_expect_equal "$output" "thread:THREADID
+notmuch search --output=threads '*' | sed -e s/thread:.*/thread:THREADID/ 
>OUTPUT
+cat OUTPUT
+cat OUTPUT
+cat OUTPUT
+cat OUTPUT
+cat OUTPUT
+cat OUTPUT
+cat 

[PATCH 02/25] add note about updating the debian symbols file to the RELEASE file

2011-05-28 Thread Jameson Graef Rollins
---
 RELEASING |   22 ++
 1 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/RELEASING b/RELEASING
index a392d81..475100a 100644
--- a/RELEASING
+++ b/RELEASING
@@ -35,7 +35,21 @@ repository. From here, there are just a few steps to release:

Commit this change, if any.

-3) Upgrade the version in the file "version"
+3) Update the debian/libnotmuch1.symbols file
+
+   If the library version changed at all (step 2) it probably
+   means that symbols have changed/been added, in which case the
+   debian symbols file also needs to be updated:
+
+  dpkg-buildpackage -uc -us
+  dpkg-gensymbols -plibnotmuch1 | patch -p0
+
+   Carefully review the changes to debian/libnotmuch1.symbols to
+   make sure there are no unexpected changes.
+
+   Commit this change, if any.
+
+4) Upgrade the version in the file "version"

The scheme for the release number is as follows:

@@ -55,7 +69,7 @@ repository. From here, there are just a few steps to release:

Commit this change.

-4) Create an entry for the new release in debian/changelog
+5) Create an entry for the new release in debian/changelog

The syntax of this file is tightly restricted, but the
available emacs mode (see the dpkg-dev-el package) helps.
@@ -69,7 +83,7 @@ repository. From here, there are just a few steps to release:
release, (taking entries from NEWS and the version from the
version file, and creating a new commit, etc.)

-5) Run "make release" which will perform the following steps.
+6) Run "make release" which will perform the following steps.

Note: If any problem occurs during the process, (such as a lintian
warning that you decide should be fixed), you can abort at the
@@ -98,7 +112,7 @@ repository. From here, there are just a few steps to release:
* Push that tag
* Provide some text for the release announcement (see below).

-6) Send a message to notmuch at notmuchmail.org to announce the release.
+7) Send a message to notmuch at notmuchmail.org to announce the release.

Use the text provided from "make release" above, (if for some
reason you lose this message, "make release-message" prints
-- 
1.7.4.4



[PATCH 01/25] fix check for libdir in ldconfig paths

2011-05-28 Thread Jameson Graef Rollins
The configure script tries to check that the libdir is included in the
ldconfig paths, and then sets the RPATH compiler flag if it's not.
This check was broken, and was always setting RPATH.  This fixes the
path check.
---
 configure |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/configure b/configure
index bbf30cd..f735c1d 100755
--- a/configure
+++ b/configure
@@ -358,14 +358,14 @@ elif [ $uname = "Linux" ] ; then
 ldconfig_paths=$(/sbin/ldconfig -N -X -v 2>/dev/null | sed -n -e 
's,^\(/.*\):\( (.*)\)\?$,\1,p')
 # Separate ldconfig_paths only on newline (not on any potential
 # embedded space characters in any filenames).
-OLD_IFS=$IFS
-IFS="$(printf '\n')"
 for path in $ldconfig_paths; do
if [ "$path" = "$libdir_expanded" ]; then
libdir_in_ldconfig=1
fi
 done
-IFS=$OLD_IFS
+if [ "$libdir_in_ldconfig" = '0' ]; then
+   printf "\tlibdir not found in ldconfig paths.  RPATH variable will be 
set.\n"
+fi
 else
 printf "Unknown.\n"
 cat <

release-candidate/0.6 redux

2011-05-28 Thread Jameson Graef Rollins
So what follows is a patch series for a bunch of miscellaneous patches
that should be included in 0.6.  Most of them were originally part of
the release-candiate/0.6 branch, and they are here rebased on top of
notmuch/master at cb8418784c21155ffea79cce8409a7ea3c546937, which
includes all the multipart and crypto rework.

Some of these patches are cleanup, but some are important bug fixes,
some previously sent to the list by others that I have signed off on,
and some by me that were not previously sent to the list.  I highly
recommend that this entire series be incorporated before 0.6 is
released.

jamie.



normalizing part numbering across PGP/MIME processing

2011-05-28 Thread Jameson Graef Rollins
On Fri, 27 May 2011 17:53:44 -0700, Carl Worth  wrote:
> So, well done, Jameson! You've been extremely patient as I sat on this
> patch series for *so* long, and then made you rebuild it so many
> times. I hope you think the rebuilds were at least worth it for the much
> cleaner final state, (I know that the useless waiting wasn't worth it).

w00t!  Thanks so much, Carl!  I definitely think the whole branch turned
out to be a lot cleaner in the end.

> That said, here are the (minor) issues I have with the series:
> 
>   * More tests should be switched to the new text_expect_equal_file
> 
>   This isn't a problem with the series---but will be a nice
>   fix. I think the current "notmuch search --output=tags *" is
>   broken due to a missing final newline---or at least has been
>   broken that way recently. So it will be nice to have this
>   support for testing a final newline.

Yes, I agree.  I'm about to send a patch series to the list that
includes a bunch of random stuff that should be include in 0.6, and it
includes some of these fixes.

>   * Should we set the crypto option to verify/decrypt by default?
> 
>   That would certainly be convenient for me at least.
> 
>   For people who don't want this, they can set the variable to
>   nil. But then they'll still have the following issue:

I don't really have an opinion on this.  I have it set now, so whether
or not it's set by default doesn't make much difference to me.

>   * I'm not a fan of the M-RET option for decrypting a message
> 
>   If someone is going to have encrypted messages not decrypted by
>   default, then they can currently decrypt by opening the message
>   with M-RET. But I think in common use, the user is likely to
>   only realize too late that they want to decrypt the message.
> 
>   So what I'd love to see is a keybinding for decrypting a message
>   from the view of the message itself. (One natural place would be
>   by activating the button of the encrypted part---but a
>   keybinding to review with decryption would be fine too---likely
>   easier to code and easier to use.)

I agree it would definitely be better to have the redisplay happen from
inside the message show.  That would be much cleaner and more intuitive.
It will require a bit of work to add something like a "redisplay" in
notmuch-show, but I see no reason it can't be done.

>   * I can't actually get decryption to work for me. :-(
> 
>   When I run "notmuch show --decrypt" on a message encrypted with
>   my public key I get a segfault within libgmime, specifically in
>   the g_mime_session_request_passwd function.

Yikes!

>   My first guess is that this is due to the fact that gpg-agent
>   can't be run on my system (Debian unstable):
> 
>   $ gpg-agent
>   gpg-agent: symbol lookup error: /usr/lib/libassuan.so.0: undefined 
> symbol: gpg_err_set_errno
> 
>   I've got a Debian bug report queued up for this.

hrm, that's very strange, unfortunately I'm not sure what's happening
there.  Bug in gpg-agent, I assume?

>   I also tried running the same "notmuch show" command without
>   gpg-agent installed. How is libgmime supposed to actually
>   request a password in a case like this?

That's a good question, actually, and I don't actually know the answer.

Ok, so more release-candidate/0.6 patches to follow.

Thanks again for pushing all this stuff through, Carl.

jamie.
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20110528/406b2cc9/attachment.pgp>


[python] get all messages of a thread

2011-05-28 Thread Patrick Totzke
Hi!
I wonder how I would get all messages of a thread with the python
bindings. The doc says one can only use Thread.get_toplevel_messages()
and then must recursively call Message.get_replies().
But look:

 snip -
#/usr/bin/python
from notmuch import Database

def get_thread():
query = Database().create_query('thread:0c48')
return query.search_threads().next()

def replies(msg):
acc = []
r = msg.get_replies()
if r: #because we cant iterate on NoneType
for m in r:
acc.append(m)
acc += replies(m)
return acc

t=get_thread()

msgs = []
for m in t.get_toplevel_messages():
msgs.append(m)
msgs += replies(m)

print msgs
--- snap 
gives:

Traceback (most recent call last):
  File "replies.py", line 22, in 
msgs +=replies(m)
  File "replies.py", line 12, in replies
for m in r:
  File "/usr/local/lib/python2.7/dist-packages/notmuch/message.py", line 140, 
in next
raise NotmuchError(STATUS.NOT_INITIALIZED)
notmuch.globals.NotmuchError: Operation on uninitialized object impossible.
-
It seems that nobody needed this before. Even in bindings/python/notmuch.py
only Threads.get_toplevel_messages() gets called, and then a (undocumented)
Messages.print_messages is used (cf line 639, in show)

any suggestions?
I would rather not call the notmuch binary and parse its output..
Thanks!
/p
-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20110528/58b4c142/attachment.pgp>


one-time-iterators

2011-05-28 Thread Patrick Totzke
anks for the clarification. I did that, and also commented out the
lower parts of _notmuch_thread_create and this did indeed improve
the performance, but not so much as I had hoped:

In [10]: q=Database().create_query('*')
In [11]: time T=[t for t in q.search_threads()]
CPU times: user 2.43 s, sys: 0.22 s, total: 2.65 s
Wall time: 2.66 s

And I have only about 8000 mails in my index.
Making thread lookups lazy would help, but here one would still
create a lot of unused (empty) thread objects.
The easiest solution to my problem would in my opinion be
a function that queries only for thread ids without instanciating them.
But I can't think of any other use case than mine for this
so I guess many of you would be against adding this to the API?
/p
-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20110528/e2e2791d/attachment.pgp>


proposed debian upload 0.5.5

2011-05-28 Thread David Bremner

I'd like to upload current master to debian experimental.  I think this
might help with a few integration issues (libgmime in particular, and
maybe gpg-agent).

My branch is at 

   
http://pivot.cs.unb.ca/git/?p=notmuch.git;a=shortlog;h=refs/heads/proposed-0.5.5

On top of current master, this includes some packaging changes, and the
previously posted patch that adds a timout to the tests.

Any comments are welcome.

David
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 315 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20110528/5f565950/attachment.pgp>


[PATCH 2/2] Workaround for Emacs bug #8721.

2011-05-28 Thread Dmitry Kurochkin
This is an amended patch which uses `isearch-range-invisible' from Emacs
trunk r104393 (includes the second patch from #8721).

Regards,
  Dmitry
-- next part --
A non-text attachment was scrubbed...
Name: 0001-Workaround-for-Emacs-bug-8721.patch
Type: text/x-diff
Size: 3431 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20110528/43978cfb/attachment-0001.patch>


[PATCH] emacs: User-defined sections in notmuch-hello

2011-05-28 Thread Daniel Schoepe
Accidentally attached the old file again, sorry for the noise.
-- next part --
A non-text attachment was scrubbed...
Name: 0001-emacs-User-defined-sections-in-notmuch-hello.patch
Type: text/x-diff
Size: 20105 bytes
Desc: not available
URL: 

-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: 



[PATCH] emacs: User-defined sections in notmuch-hello

2011-05-28 Thread Daniel Schoepe
I forgot to run the test suite with the previous patch, which
revealed some minor formatting problems, updated patch in the
attachment.
-- next part --
A non-text attachment was scrubbed...
Name: 0001-emacs-User-defined-sections-in-notmuch-hello.patch
Type: text/x-diff
Size: 17893 bytes
Desc: not available
URL: 

-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: 



Re: one-time-iterators

2011-05-28 Thread Patrick Totzke
Excerpts from Austin Clements's message of Fri May 27 20:29:24 +0100 2011:
 On Fri, May 27, 2011 at 2:04 PM, Patrick Totzke
 patricktot...@googlemail.com wrote:
  Excerpts from Austin Clements's message of Fri May 27 03:41:44 +0100 2011:
 Have you tried simply calling list() on your thread
 iterator to see how expensive it is?  My bet is that it's quite 
 cheap,
 both memory-wise and CPU-wise.
Funny thing:
 q=Database().create_query('*')
 time tlist = list(q.search_threads())
raises a NotmuchError(STATUS.NOT_INITIALIZED) exception. For some 
reason
the list constructor must read mere than once from the iterator.
So this is not an option, but even if it worked, it would show
the same behaviour as my above test..
  
   Interesting.  Looks like the Threads class implements __len__ and that
   its implementation exhausts the iterator.  Which isn't a great idea in
   itself, but it turns out that Python's implementation of list() calls
   __len__ if it's available (presumably to pre-size the list) before
   iterating over the object, so it exhausts the iterator before even
   using it.
  
   That said, if list(q.search_threads()) did work, it wouldn't give you
   better performance than your experiment above.
  true. Nevertheless I think that list(q.search_threads())
  should be equivalent to [t for t in q.search_threads()], which is
  something to be fixed in the bindings. Should I file an issue somehow?
  Or is enough to state this as a TODO here on the list?
 
 Yes, they should be equivalent.
 
 Sebastian was thinking about fixing the larger issue of generator
 exhaustion, which would address this, though the performance would
 depend on the cost of iterating twice.  This is why generators
 shouldn't support __len__.  Unfortunately, it's probably hard to get
 rid of at this point and I doubt there's a way to tell list() to
 overlook the presence of a __len__ method.
Why not simply removing support for __len__ in the Threads and Messages classes?

would it be very hard to implement a Query.search_thread_ids() ?
This name is a bit off because it had to be done on a lower level.
  
   Lazily fetching the thread metadata on the C side would probably
   address your problem automatically.  But what are you doing that
   doesn't require any information about the threads you're manipulating?
   Agreed. Unfortunately, there seems to be no way to get a list of thread
   ids or a reliable iterator thereof by using the current python bindings.
   It would be enough for me to have the ids because then I could
   search for the few threads I actually need individually on demand.
 
  There's no way to do that from the C API either, so don't feel left
  out.  ]:--8)  It seems to me that the right solution to your problem
  is to make thread information lazy (effectively, everything gathered
  in lib/thread.cc:_thread_add_message).  Then you could probably
  materialize that iterator cheaply.
  Alright. I'll put this on my mental notmuch wish list and
  hope that someone will have addressed this before I run out of
  ideas how to improve my UI and have time to look at this myself.
  For now, I go with the [t.get_thread_id for t in q.search_threads()]
  approach to cache the thread ids myself and live with the fact that
  this takes time for large result sets.
 
  In fact, it's probably worth
  trying a hack where you put dummy information in the thread object
  from _thread_add_message and see how long it takes just to walk the
  iterator (unfortunately I don't think profiling will help much here
  because much of your time is probably spent waiting for I/O).
  I don't think I understand what you mean by dummy info in a thread
  object.
 
 In _thread_add_message, rather than looking up the message's author,
 subject, etc, just hard-code some dummy values.  Performance-wise,
 this would simulate making the thread metadata lookup lazy, so you
 could see if making this lazy would address your problem.
Thanks for the clarification. I did that, and also commented out the
lower parts of _notmuch_thread_create and this did indeed improve
the performance, but not so much as I had hoped:

In [10]: q=Database().create_query('*')
In [11]: time T=[t for t in q.search_threads()]
CPU times: user 2.43 s, sys: 0.22 s, total: 2.65 s
Wall time: 2.66 s

And I have only about 8000 mails in my index.
Making thread lookups lazy would help, but here one would still
create a lot of unused (empty) thread objects.
The easiest solution to my problem would in my opinion be
a function that queries only for thread ids without instanciating them.
But I can't think of any other use case than mine for this
so I guess many of you would be against adding this to the API?
/p


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


proposed debian upload 0.5.5

2011-05-28 Thread David Bremner

I'd like to upload current master to debian experimental.  I think this
might help with a few integration issues (libgmime in particular, and
maybe gpg-agent).

My branch is at 

   
http://pivot.cs.unb.ca/git/?p=notmuch.git;a=shortlog;h=refs/heads/proposed-0.5.5

On top of current master, this includes some packaging changes, and the
previously posted patch that adds a timout to the tests.

Any comments are welcome.

David


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


[python] get all messages of a thread

2011-05-28 Thread Patrick Totzke
Hi!
I wonder how I would get all messages of a thread with the python
bindings. The doc says one can only use Thread.get_toplevel_messages()
and then must recursively call Message.get_replies().
But look:

 snip -
#/usr/bin/python
from notmuch import Database

def get_thread():
query = Database().create_query('thread:0c48')
return query.search_threads().next()

def replies(msg):
acc = []
r = msg.get_replies()
if r: #because we cant iterate on NoneType
for m in r:
acc.append(m)
acc += replies(m)
return acc

t=get_thread()

msgs = []
for m in t.get_toplevel_messages():
msgs.append(m)
msgs += replies(m)

print msgs
--- snap 
gives:

Traceback (most recent call last):
  File replies.py, line 22, in module
msgs +=replies(m)
  File replies.py, line 12, in replies
for m in r:
  File /usr/local/lib/python2.7/dist-packages/notmuch/message.py, line 140, 
in next
raise NotmuchError(STATUS.NOT_INITIALIZED)
notmuch.globals.NotmuchError: Operation on uninitialized object impossible.
-
It seems that nobody needed this before. Even in bindings/python/notmuch.py
only Threads.get_toplevel_messages() gets called, and then a (undocumented)
Messages.print_messages is used (cf line 639, in show)

any suggestions?
I would rather not call the notmuch binary and parse its output..
Thanks!
/p


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


Re: proposed debian upload 0.5.5

2011-05-28 Thread David Bremner
On Sat, 28 May 2011 09:37:59 -0300, David Bremner da...@tethera.net wrote:
 
 I'd like to upload current master to debian experimental.  I think this
 might help with a few integration issues (libgmime in particular, and
 maybe gpg-agent).
 
 My branch is at 
 

 http://pivot.cs.unb.ca/git/?p=notmuch.git;a=shortlog;h=refs/heads/proposed-0.5.5

For the archives, after some heroic bikeshedding about the version
number, I uploaded 0.6~171 to experimental. This is based on
cb8418784c2, with the changes at 

git://pivot.cs.unb.ca/notmuch.git
branch: debian-0.6-171

   8844eb1 update debian/libnotmuch1.symbols
   1c3f767 Override RPATH_LDFLAGS for Debian build.
   b61aa86 Add changelog stanza for new upstream version.
   88340a8 bump notmuch version to 0.6~171
   0fa1281 Add myself as an uploader for the Debian package.
   b44ed1b Incorporate changelog entries from post 0.5 Debian uploads.
   a3e98d2 tests: Add optional use of timeout utility, if present.

I lowered the timeout to 2 minutes, because there now several tests
using smtp_dummy, and these hang when building in a chroot (at least
with debian sbuild).

d


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


Re: normalizing part numbering across PGP/MIME processing

2011-05-28 Thread Jameson Graef Rollins
On Fri, 27 May 2011 17:53:44 -0700, Carl Worth cwo...@cworth.org wrote:
 So, well done, Jameson! You've been extremely patient as I sat on this
 patch series for *so* long, and then made you rebuild it so many
 times. I hope you think the rebuilds were at least worth it for the much
 cleaner final state, (I know that the useless waiting wasn't worth it).

w00t!  Thanks so much, Carl!  I definitely think the whole branch turned
out to be a lot cleaner in the end.

 That said, here are the (minor) issues I have with the series:
 
   * More tests should be switched to the new text_expect_equal_file
 
   This isn't a problem with the series---but will be a nice
   fix. I think the current notmuch search --output=tags * is
   broken due to a missing final newline---or at least has been
   broken that way recently. So it will be nice to have this
   support for testing a final newline.

Yes, I agree.  I'm about to send a patch series to the list that
includes a bunch of random stuff that should be include in 0.6, and it
includes some of these fixes.

   * Should we set the crypto option to verify/decrypt by default?
 
   That would certainly be convenient for me at least.
 
   For people who don't want this, they can set the variable to
   nil. But then they'll still have the following issue:

I don't really have an opinion on this.  I have it set now, so whether
or not it's set by default doesn't make much difference to me.

   * I'm not a fan of the M-RET option for decrypting a message
 
   If someone is going to have encrypted messages not decrypted by
   default, then they can currently decrypt by opening the message
   with M-RET. But I think in common use, the user is likely to
   only realize too late that they want to decrypt the message.
 
   So what I'd love to see is a keybinding for decrypting a message
   from the view of the message itself. (One natural place would be
   by activating the button of the encrypted part---but a
   keybinding to review with decryption would be fine too---likely
   easier to code and easier to use.)

I agree it would definitely be better to have the redisplay happen from
inside the message show.  That would be much cleaner and more intuitive.
It will require a bit of work to add something like a redisplay in
notmuch-show, but I see no reason it can't be done.

   * I can't actually get decryption to work for me. :-(
 
   When I run notmuch show --decrypt on a message encrypted with
   my public key I get a segfault within libgmime, specifically in
   the g_mime_session_request_passwd function.

Yikes!

   My first guess is that this is due to the fact that gpg-agent
   can't be run on my system (Debian unstable):
 
   $ gpg-agent
   gpg-agent: symbol lookup error: /usr/lib/libassuan.so.0: undefined 
 symbol: gpg_err_set_errno
 
   I've got a Debian bug report queued up for this.

hrm, that's very strange, unfortunately I'm not sure what's happening
there.  Bug in gpg-agent, I assume?

   I also tried running the same notmuch show command without
   gpg-agent installed. How is libgmime supposed to actually
   request a password in a case like this?

That's a good question, actually, and I don't actually know the answer.

Ok, so more release-candidate/0.6 patches to follow.

Thanks again for pushing all this stuff through, Carl.

jamie.


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


[PATCH 02/25] add note about updating the debian symbols file to the RELEASE file

2011-05-28 Thread Jameson Graef Rollins
---
 RELEASING |   22 ++
 1 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/RELEASING b/RELEASING
index a392d81..475100a 100644
--- a/RELEASING
+++ b/RELEASING
@@ -35,7 +35,21 @@ repository. From here, there are just a few steps to release:
 
Commit this change, if any.
 
-3) Upgrade the version in the file version
+3) Update the debian/libnotmuch1.symbols file
+
+   If the library version changed at all (step 2) it probably
+   means that symbols have changed/been added, in which case the
+   debian symbols file also needs to be updated:
+
+  dpkg-buildpackage -uc -us
+  dpkg-gensymbols -plibnotmuch1 | patch -p0
+
+   Carefully review the changes to debian/libnotmuch1.symbols to
+   make sure there are no unexpected changes.
+
+   Commit this change, if any.
+
+4) Upgrade the version in the file version
 
The scheme for the release number is as follows:
 
@@ -55,7 +69,7 @@ repository. From here, there are just a few steps to release:
 
Commit this change.
 
-4) Create an entry for the new release in debian/changelog
+5) Create an entry for the new release in debian/changelog
 
The syntax of this file is tightly restricted, but the
available emacs mode (see the dpkg-dev-el package) helps.
@@ -69,7 +83,7 @@ repository. From here, there are just a few steps to release:
release, (taking entries from NEWS and the version from the
version file, and creating a new commit, etc.)
 
-5) Run make release which will perform the following steps.
+6) Run make release which will perform the following steps.
 
Note: If any problem occurs during the process, (such as a lintian
warning that you decide should be fixed), you can abort at the
@@ -98,7 +112,7 @@ repository. From here, there are just a few steps to release:
* Push that tag
* Provide some text for the release announcement (see below).
 
-6) Send a message to notmuch@notmuchmail.org to announce the release.
+7) Send a message to notmuch@notmuchmail.org to announce the release.
 
Use the text provided from make release above, (if for some
reason you lose this message, make release-message prints
-- 
1.7.4.4

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


[PATCH 04/25] test: move Search for non-existent message prints nothing to search-output, and add similar test for format=json

2011-05-28 Thread Jameson Graef Rollins
These tests also use the new test_expect_equal_file test.
---
 test/search|5 -
 test/search-output |   12 
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/test/search b/test/search
index 0981f66..4835872 100755
--- a/test/search
+++ b/test/search
@@ -118,9 +118,4 @@ add_message '[subject]=utf8-message-body-subject' 
'[date]=Sat, 01 Jan 2000 12
 output=$(notmuch search bödý | notmuch_search_sanitize)
 test_expect_equal $output thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; 
utf8-message-body-subject (inbox unread)
 
-test_expect_success Search for non-existent message prints nothing '
-echo -n  expected 
-notmuch search no-message-matches-this  actual 
-test_cmp expected actual'
-
 test_done
diff --git a/test/search-output b/test/search-output
index 1554eb1..8ba8acf 100755
--- a/test/search-output
+++ b/test/search-output
@@ -304,4 +304,16 @@ cat EOF EXPECTED
 EOF
 test_expect_equal_file OUTPUT EXPECTED
 
+test_begin_subtest notmuch search for non-existent message prints nothing
+notmuch search no-message-matches-this  OUTPUT
+echo -n EXPECTED
+test_expect_equal_file OUTPUT EXPECTED
+
+test_begin_subtest notmuch search --format=json for non-existent message 
prints proper empty json
+notmuch search --format=json no-message-matches-this  OUTPUT
+cat EOF EXPECTED
+[]
+EOF
+test_expect_equal_file OUTPUT EXPECTED
+
 test_done
-- 
1.7.4.4

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


[PATCH 06/25] test: move utf-8 subject search test from json to search test script

2011-05-28 Thread Jameson Graef Rollins
This test doesn't have anything to do with json, and has everything to
do with testing search capability, so I'm not sure why it was in the
wrong place.
---
 test/json   |5 -
 test/search |6 ++
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/test/json b/test/json
index 7c81856..0badb1d 100755
--- a/test/json
+++ b/test/json
@@ -18,11 +18,6 @@ test_expect_equal $output [{\thread\: \XXX\,
 \subject\: \json-search-subject\,
 \tags\: [\inbox\, \unread\]}]
 
-test_begin_subtest Search by subject (utf-8):
-add_message [subject]=utf8-sübjéct [date]=\Sat, 01 Jan 2000 12:00:00 -\
-output=$(notmuch search subject:utf8-sübjéct | notmuch_search_sanitize)
-test_expect_equal $output thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; 
utf8-sübjéct (inbox unread)
-
 test_begin_subtest Show message: json, utf-8
 add_message [subject]=\json-show-utf8-body-sübjéct\ [date]=\Sat, 01 Jan 
2000 12:00:00 -\ [body]=\jsön-show-méssage\
 output=$(notmuch show --format=json jsön-show-méssage)
diff --git a/test/search b/test/search
index 4835872..e7c8c54 100755
--- a/test/search
+++ b/test/search
@@ -24,6 +24,11 @@ add_message [subject]=subjectsearchtest '[date]=Sat, 01 Jan 
2000 12:00:00 -
 output=$(notmuch search subject:subjectsearchtest | notmuch_search_sanitize)
 test_expect_equal $output thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; 
subjectsearchtest (inbox unread)
 
+test_begin_subtest Search by subject (utf-8):
+add_message [subject]=utf8-sübjéct '[date]=Sat, 01 Jan 2000 12:00:00 -'
+output=$(notmuch search subject:utf8-sübjéct | notmuch_search_sanitize)
+test_expect_equal $output thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; 
utf8-sübjéct (inbox unread)
+
 test_begin_subtest Search by id:
 add_message '[subject]=search by id' '[date]=Sat, 01 Jan 2000 12:00:00 
-'
 output=$(notmuch search id:${gen_msg_id} | notmuch_search_sanitize)
@@ -101,6 +106,7 @@ thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; body 
search (inbox unread)
 thread:XXX   2000-01-01 [1/1] searchbyfrom; search by from (inbox unread)
 thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; search by to (inbox unread)
 thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; subjectsearchtest (inbox 
unread)
+thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; utf8-sübjéct (inbox unread)
 thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; search by id (inbox unread)
 thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; search by tag (inbox 
searchbytag unread)
 thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; search by thread (inbox 
unread)
-- 
1.7.4.4

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


[PATCH 12/25] test: cleanup search-output test names (no functional change)

2011-05-28 Thread Jameson Graef Rollins
Signed-off-by: Jameson Graef Rollins jroll...@finestructure.net
---
 test/search-output |   20 ++--
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/test/search-output b/test/search-output
index 8edc26a..02cf602 100755
--- a/test/search-output
+++ b/test/search-output
@@ -4,7 +4,7 @@ test_description='various settings for notmuch search 
--output='
 
 add_email_corpus
 
-test_begin_subtest notmuch search --output=threads
+test_begin_subtest --output=threads
 notmuch search --output=threads '*' | sed -e s/thread:.*/thread:THREADID/ 
OUTPUT
 cat EOF EXPECTED
 thread:THREADID
@@ -32,7 +32,7 @@ thread:THREADID
 EOF
 test_expect_equal_file OUTPUT EXPECTED
 
-test_begin_subtest notmuch search --format=json --output=threads
+test_begin_subtest --output=threads --format=json
 notmuch search --format=json --output=threads '*' | sed -e 
s/\.*\/\THREADID\/ OUTPUT
 cat EOF EXPECTED
 [THREADID,
@@ -60,7 +60,7 @@ cat EOF EXPECTED
 EOF
 test_expect_equal_file OUTPUT EXPECTED
 
-test_begin_subtest notmuch search --output=messages
+test_begin_subtest --output=messages
 notmuch search --output=messages '*' OUTPUT
 cat EOF EXPECTED
 id:1258544095-16616-1-git-send-email-ch...@chris-wilson.co.uk
@@ -116,7 +116,7 @@ id:1258471718-6781-1-git-send-email-dotted...@dottedmag.net
 EOF
 test_expect_equal_file OUTPUT EXPECTED
 
-test_begin_subtest notmuch search --format=json --output=messages
+test_begin_subtest --output=messages --format=json
 notmuch search --format=json --output=messages '*' OUTPUT
 cat EOF EXPECTED
 [1258544095-16616-1-git-send-email-ch...@chris-wilson.co.uk,
@@ -172,7 +172,7 @@ cat EOF EXPECTED
 EOF
 test_expect_equal_file OUTPUT EXPECTED
 
-test_begin_subtest notmuch search --output=files
+test_begin_subtest --output=files
 notmuch search --output=files '*' | sed -e s,$MAIL_DIR,MAIL_DIR, OUTPUT
 cat EOF EXPECTED
 MAIL_DIR/cur/50:2,
@@ -228,7 +228,7 @@ MAIL_DIR/cur/01:2,
 EOF
 test_expect_equal_file OUTPUT EXPECTED
 
-test_begin_subtest notmuch search --format=json --output=files
+test_begin_subtest --output=files --format=json
 notmuch search --format=json --output=files '*' | sed -e 
s,$MAIL_DIR,MAIL_DIR, OUTPUT
 cat EOF EXPECTED
 [MAIL_DIR/cur/50:2,,
@@ -284,7 +284,7 @@ cat EOF EXPECTED
 EOF
 test_expect_equal_file OUTPUT EXPECTED
 
-test_begin_subtest notmuch search --output=tags
+test_begin_subtest --output=tags
 notmuch search --output=tags '*' OUTPUT
 cat EOF EXPECTED
 attachment
@@ -294,7 +294,7 @@ unread
 EOF
 test_expect_equal_file OUTPUT EXPECTED
 
-test_begin_subtest notmuch search --format=json --output=tags
+test_begin_subtest --output=tags --format=json
 notmuch search --format=json --output=tags '*' OUTPUT
 cat EOF EXPECTED
 [attachment,
@@ -313,12 +313,12 @@ thread:001b   2001-01-05 [1/1] Notmuch Test 
Suite; two line? subject
 EOF
 test_expect_equal_file OUTPUT EXPECTED
 
-test_begin_subtest notmuch search for non-existent message prints nothing
+test_begin_subtest search for non-existent message prints nothing
 notmuch search no-message-matches-this  OUTPUT
 echo -n EXPECTED
 test_expect_equal_file OUTPUT EXPECTED
 
-test_begin_subtest notmuch search --format=json for non-existent message 
prints proper empty json
+test_begin_subtest search --format=json for non-existent message prints 
proper empty json
 notmuch search --format=json no-message-matches-this  OUTPUT
 echo [] EXPECTED
 test_expect_equal_file OUTPUT EXPECTED
-- 
1.7.4.4

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


release-candidate/0.6 redux

2011-05-28 Thread Jameson Graef Rollins
So what follows is a patch series for a bunch of miscellaneous patches
that should be included in 0.6.  Most of them were originally part of
the release-candiate/0.6 branch, and they are here rebased on top of
notmuch/master at cb8418784c21155ffea79cce8409a7ea3c546937, which
includes all the multipart and crypto rework.

Some of these patches are cleanup, but some are important bug fixes,
some previously sent to the list by others that I have signed off on,
and some by me that were not previously sent to the list.  I highly
recommend that this entire series be incorporated before 0.6 is
released.

jamie.

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


[PATCH 08/25] create and set temporary home directory

2011-05-28 Thread Jameson Graef Rollins
From: Florian Friesdorf f...@chaoflow.net

My first patch send to the list, not sure whether done properly.

In the master branch in test/emacs two tests access the build users home
directory, so does emacs_deliver_message in the crypto branch.

I think the tests should not touch the build user's home directory. The
patch creates a directory in the temporary test directory and sets home
accordingly.

In case of a non-existent home directory, the tests are failing without
this patch.

Signed-off-by: Jameson Graef Rollins jroll...@finestructure.net
---
 test/test-lib.sh |7 +++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/test/test-lib.sh b/test/test-lib.sh
index 922b1ef..6a8cb98 100755
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -973,6 +973,13 @@ rm -fr $test || {
exit 1
 }
 
+# A temporary home directory is needed by at least:
+# - emacs/Sending a message via (fake) SMTP
+# - emacs/Reply within emacs
+# - crypto/emacs_deliver_message
+export HOME=${TMP_DIRECTORY}/home
+mkdir -p ${HOME}
+
 MAIL_DIR=${TMP_DIRECTORY}/mail
 export GNUPGHOME=${TMP_DIRECTORY}/gnupg
 export NOTMUCH_CONFIG=${TMP_DIRECTORY}/notmuch-config
-- 
1.7.4.4

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


[PATCH 09/25] emacs: Define several faces for the crypto-status button

2011-05-28 Thread Jameson Graef Rollins
From: Thomas Jost schno...@schnouki.net

Signed-off-by: Jameson Graef Rollins jroll...@finestructure.net

jrollins modified this patch to conform to recent changes in the
crypto processing since this patch was originally sent in.
---
 emacs/notmuch-crypto.el |   42 --
 1 files changed, 32 insertions(+), 10 deletions(-)

diff --git a/emacs/notmuch-crypto.el b/emacs/notmuch-crypto.el
index cb02840..f03266f 100644
--- a/emacs/notmuch-crypto.el
+++ b/emacs/notmuch-crypto.el
@@ -36,36 +36,58 @@ search.
   :group 'notmuch
   :type 'boolean)
 
+(defface notmuch-crypto-signature-good
+  '((t (:background green :foreground black)))
+  Face used for good signatures.
+  :group 'notmuch)
+
+(defface notmuch-crypto-signature-good-key
+  '((t (:background orange :foreground black)))
+  Face used for good signatures.
+  :group 'notmuch)
+
+(defface notmuch-crypto-signature-bad
+  '((t (:background red :foreground black)))
+  Face used for bad signatures.
+  :group 'notmuch)
+
+(defface notmuch-crypto-signature-unknown
+  '((t (:background red :foreground black)))
+  Face used for signatures of unknown status.
+  :group 'notmuch)
+
+(defface notmuch-crypto-decryption
+  '((t (:background purple :foreground black)))
+  Face used for encryption/decryption status messages.
+  :group 'notmuch)
+
 (define-button-type 'notmuch-crypto-status-button-type
   'action '(lambda (button) (message (button-get button 'help-echo)))
   'follow-link t
-  'help-echo Set notmuch-crypto-process-mime to process cryptographic mime 
parts.
-  'face '(:foreground blue)
-  'mouse-face '(:foreground blue))
+  'help-echo Set notmuch-crypto-process-mime to process cryptographic mime 
parts.)
 
 (defun notmuch-crypto-insert-sigstatus-button (sigstatus from)
   (let* ((status (plist-get sigstatus :status))
 (help-msg nil)
 (label Signature not processed)
-(face '(:background red :foreground black)))
+(face 'notmuch-crypto-signature-unknown))
 (cond
  ((string= status good)
   ; if userid present, userid has full or greater validity
   (if (plist-member sigstatus :userid)
  (let ((userid (plist-get sigstatus :userid)))
(setq label (concat Good signature by:  userid))
-   (setq face '(:background green :foreground black)))
+   (setq face 'notmuch-crypto-signature-good))
(let ((fingerprint (concat 0x (plist-get sigstatus :fingerprint
  (setq label (concat Good signature by key:  fingerprint))
- (setq face '(:background orange :foreground black)
+ (setq face 'notmuch-crypto-signature-good-key
  ((string= status error)
   (let ((keyid (concat 0x (plist-get sigstatus :keyid
-   (setq label (concat Unknown key ID  keyid  or unsupported 
algorithm))
-   (setq face '(:background red :foreground black
+   (setq label (concat Unknown key ID  keyid  or unsupported 
algorithm
  ((string= status bad)
   (let ((keyid (concat 0x (plist-get sigstatus :keyid
(setq label (concat Bad signature (claimed key ID  keyid )))
-   (setq face '(:background red :foreground black
+   (setq face 'notmuch-crypto-signature-bad)))
  (t
   (setq label Unknown signature status)
   (if status (setq label (concat label  \ status \)
@@ -83,7 +105,7 @@ search.
   (let* ((status (plist-get encstatus :status))
 (help-msg nil)
 (label Decryption not attempted)
-(face '(:background purple :foreground black)))
+(face 'notmuch-crypto-decryption))
 (cond
  ((string= status good)
   (setq label Decryption successful))
-- 
1.7.4.4

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


[PATCH 14/25] Fix old style notmuch-fcc-dirs configuration check.

2011-05-28 Thread Jameson Graef Rollins
From: Dmitry Kurochkin dmitry.kuroch...@gmail.com

In notmuch 0.5 notmuch-fcc-dirs style changed.  The previous code
did not correctly identify an old configuration and, as a
consequence, broke new configurations.

The fix was extracted from a bigger patch series by David
Edmondson id:1290682750-30283-2-git-send-email-...@dme.org.

Signed-off-by: Jameson Graef Rollins jroll...@finestructure.net
---
 emacs/notmuch-maildir-fcc.el |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/emacs/notmuch-maildir-fcc.el b/emacs/notmuch-maildir-fcc.el
index 3f1c124..b79f6a3 100644
--- a/emacs/notmuch-maildir-fcc.el
+++ b/emacs/notmuch-maildir-fcc.el
@@ -88,7 +88,7 @@ will NOT be removed or replaced.
   notmuch-fcc-dirs)
 
  ((and (listp notmuch-fcc-dirs)
-   (= 1 (length (car notmuch-fcc-dirs
+   (stringp (car notmuch-fcc-dirs)))
   ;; Old style - no longer works.
   (error Invalid `notmuch-fcc-dirs' setting (old style)))
 
-- 
1.7.4.4

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


[PATCH 01/25] fix check for libdir in ldconfig paths

2011-05-28 Thread Jameson Graef Rollins
The configure script tries to check that the libdir is included in the
ldconfig paths, and then sets the RPATH compiler flag if it's not.
This check was broken, and was always setting RPATH.  This fixes the
path check.
---
 configure |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/configure b/configure
index bbf30cd..f735c1d 100755
--- a/configure
+++ b/configure
@@ -358,14 +358,14 @@ elif [ $uname = Linux ] ; then
 ldconfig_paths=$(/sbin/ldconfig -N -X -v 2/dev/null | sed -n -e 
's,^\(/.*\):\( (.*)\)\?$,\1,p')
 # Separate ldconfig_paths only on newline (not on any potential
 # embedded space characters in any filenames).
-OLD_IFS=$IFS
-IFS=$(printf '\n')
 for path in $ldconfig_paths; do
if [ $path = $libdir_expanded ]; then
libdir_in_ldconfig=1
fi
 done
-IFS=$OLD_IFS
+if [ $libdir_in_ldconfig = '0' ]; then
+   printf \tlibdir not found in ldconfig paths.  RPATH variable will be 
set.\n
+fi
 else
 printf Unknown.\n
 cat EOF
-- 
1.7.4.4

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


[PATCH 11/25] test: add test for sanitized notmuch-search output

2011-05-28 Thread Jameson Graef Rollins
From: Florian Friesdorf f...@chaoflow.net

Signed-off-by: Jameson Graef Rollins jroll...@finestructure.net
---
 test/search-output |9 +
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/test/search-output b/test/search-output
index 13f9613..8edc26a 100755
--- a/test/search-output
+++ b/test/search-output
@@ -304,6 +304,15 @@ cat EOF EXPECTED
 EOF
 test_expect_equal_file OUTPUT EXPECTED
 
+test_begin_subtest santize output for quoted-printable line-breaks in author 
and subject
+add_message [subject]='two =?ISO-8859-1?Q?line=0A_subject?=
+   headers'
+notmuch search id:$gen_msg_id OUTPUT
+cat EOF EXPECTED
+thread:001b   2001-01-05 [1/1] Notmuch Test Suite; two line? 
subject headers (inbox unread)
+EOF
+test_expect_equal_file OUTPUT EXPECTED
+
 test_begin_subtest notmuch search for non-existent message prints nothing
 notmuch search no-message-matches-this  OUTPUT
 echo -n EXPECTED
-- 
1.7.4.4

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


[PATCH 07/25] test: remove json test for search null result, since it's being more properly tested in search-output

2011-05-28 Thread Jameson Graef Rollins
The test in json was inferior to the one in search-output, since it
wasn't properly testing for the presence of a trailing newline.
---
 test/json  |4 
 test/search-output |4 +---
 2 files changed, 1 insertions(+), 7 deletions(-)

diff --git a/test/json b/test/json
index 0badb1d..5a2544c 100755
--- a/test/json
+++ b/test/json
@@ -34,8 +34,4 @@ test_expect_equal $output [{\thread\: \XXX\,
 \subject\: \json-search-utf8-body-sübjéct\,
 \tags\: [\inbox\, \unread\]}]
 
-test_begin_subtest Search returning no messages
-output=$(notmuch search --format=json this string had better not match any 
messages | notmuch_search_sanitize)
-test_expect_equal $output []
-
 test_done
diff --git a/test/search-output b/test/search-output
index 8ba8acf..13f9613 100755
--- a/test/search-output
+++ b/test/search-output
@@ -311,9 +311,7 @@ test_expect_equal_file OUTPUT EXPECTED
 
 test_begin_subtest notmuch search --format=json for non-existent message 
prints proper empty json
 notmuch search --format=json no-message-matches-this  OUTPUT
-cat EOF EXPECTED
-[]
-EOF
+echo [] EXPECTED
 test_expect_equal_file OUTPUT EXPECTED
 
 test_done
-- 
1.7.4.4

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


[PATCH 05/25] fix trailing newlines in notmuch search

2011-05-28 Thread Jameson Graef Rollins
A previous commit to fix json formatting for null results
(0b1ddc5f6652bde99d63d9d553777b3d926694cf) accidentally introduced a
regression that removed trailing newlines for non-json output.  (There
wasn't a good test for this previously, but there is now).  The
problem is due to the fundamental differences in formatting between
the json and non-json outputs.  The only way to fix this was to add a
new formatting field that represents the string to output at the end
of a null result.

All output formatting tests should pass now.
---
 notmuch-search.c |   18 +++---
 1 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/notmuch-search.c b/notmuch-search.c
index 8b90121..69af617 100644
--- a/notmuch-search.c
+++ b/notmuch-search.c
@@ -48,6 +48,7 @@ typedef struct search_format {
 const char *item_sep;
 const char *item_end;
 const char *results_end;
+const char *results_null;
 } search_format_t;
 
 static void
@@ -72,6 +73,7 @@ static const search_format_t format_text = {
%s,  ,
), \n,
,
+\n,
 ,
 };
 
@@ -98,6 +100,7 @@ static const search_format_t format_json = {
], ,\n,
},
 ]\n,
+]\n,
 };
 
 static void
@@ -236,7 +239,10 @@ do_search_threads (const search_format_t *format,
notmuch_thread_destroy (thread);
 }
 
-fputs (format-results_end, stdout);
+if (first_thread)
+   fputs (format-results_null, stdout);
+else
+   fputs (format-results_end, stdout);
 
 return 0;
 }
@@ -280,7 +286,10 @@ do_search_messages (const search_format_t *format,
 
 notmuch_messages_destroy (messages);
 
-fputs (format-results_end, stdout);
+if (first_message)
+   fputs (format-results_null, stdout);
+else
+   fputs (format-results_end, stdout);
 
 return 0;
 }
@@ -329,7 +338,10 @@ do_search_tags (notmuch_database_t *notmuch,
 if (messages)
notmuch_messages_destroy (messages);
 
-fputs (format-results_end, stdout);
+if (first_tag)
+   fputs (format-results_null, stdout);
+else
+   fputs (format-results_end, stdout);
 
 return 0;
 }
-- 
1.7.4.4

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


[PATCH 03/25] test: modify search-output test to use the new test_expect_equal_file function

2011-05-28 Thread Jameson Graef Rollins
These test now properly test for the presence of a newline at the end
of all output.  Right now some of these test will fail because the
search output is currently broken to *not* produce proper newlines in
some cases.
---
 test/search-output |   72 ++-
 1 files changed, 48 insertions(+), 24 deletions(-)

diff --git a/test/search-output b/test/search-output
index 20341d6..1554eb1 100755
--- a/test/search-output
+++ b/test/search-output
@@ -5,8 +5,8 @@ test_description='various settings for notmuch search 
--output='
 add_email_corpus
 
 test_begin_subtest notmuch search --output=threads
-output=$(notmuch search --output=threads '*' | sed -e 
s/thread:.*/thread:THREADID/)
-test_expect_equal $output thread:THREADID
+notmuch search --output=threads '*' | sed -e s/thread:.*/thread:THREADID/ 
OUTPUT
+cat EOF EXPECTED
 thread:THREADID
 thread:THREADID
 thread:THREADID
@@ -27,11 +27,15 @@ thread:THREADID
 thread:THREADID
 thread:THREADID
 thread:THREADID
-thread:THREADID
+thread:THREADID
+thread:THREADID
+EOF
+test_expect_equal_file OUTPUT EXPECTED
 
 test_begin_subtest notmuch search --format=json --output=threads
-output=$(notmuch search --format=json --output=threads '*' | sed -e 
s/\.*\/\THREADID\/)
-test_expect_equal $output '[THREADID,
+notmuch search --format=json --output=threads '*' | sed -e 
s/\.*\/\THREADID\/ OUTPUT
+cat EOF EXPECTED
+[THREADID,
 THREADID,
 THREADID,
 THREADID,
@@ -52,11 +56,14 @@ test_expect_equal $output '[THREADID,
 THREADID,
 THREADID,
 THREADID,
-THREADID]'
+THREADID]
+EOF
+test_expect_equal_file OUTPUT EXPECTED
 
 test_begin_subtest notmuch search --output=messages
-output=$(notmuch search --output=messages '*')
-test_expect_equal $output 
id:1258544095-16616-1-git-send-email-ch...@chris-wilson.co.uk
+notmuch search --output=messages '*' OUTPUT
+cat EOF EXPECTED
+id:1258544095-16616-1-git-send-email-ch...@chris-wilson.co.uk
 id:877htoqdbo@yoom.home.cworth.org
 id:878we4qdqf@yoom.home.cworth.org
 id:87aaykqe24@yoom.home.cworth.org
@@ -105,11 +112,14 @@ id:87iqd9rn3l.fsf@vertex.dottedmag
 id:20091117190054.gu3...@dottiness.seas.harvard.edu
 id:87lji5cbwo@yoom.home.cworth.org
 id:1258471718-6781-2-git-send-email-dotted...@dottedmag.net
-id:1258471718-6781-1-git-send-email-dotted...@dottedmag.net
+id:1258471718-6781-1-git-send-email-dotted...@dottedmag.net
+EOF
+test_expect_equal_file OUTPUT EXPECTED
 
 test_begin_subtest notmuch search --format=json --output=messages
-output=$(notmuch search --format=json --output=messages '*')
-test_expect_equal $output 
'[1258544095-16616-1-git-send-email-ch...@chris-wilson.co.uk,
+notmuch search --format=json --output=messages '*' OUTPUT
+cat EOF EXPECTED
+[1258544095-16616-1-git-send-email-ch...@chris-wilson.co.uk,
 877htoqdbo@yoom.home.cworth.org,
 878we4qdqf@yoom.home.cworth.org,
 87aaykqe24@yoom.home.cworth.org,
@@ -158,11 +168,14 @@ test_expect_equal $output 
'[1258544095-16616-1-git-send-email-chris@chris-wil
 20091117190054.gu3...@dottiness.seas.harvard.edu,
 87lji5cbwo@yoom.home.cworth.org,
 1258471718-6781-2-git-send-email-dotted...@dottedmag.net,
-1258471718-6781-1-git-send-email-dotted...@dottedmag.net]'
+1258471718-6781-1-git-send-email-dotted...@dottedmag.net]
+EOF
+test_expect_equal_file OUTPUT EXPECTED
 
 test_begin_subtest notmuch search --output=files
-output=$(notmuch search --output=files '*' | sed -e s,$MAIL_DIR,MAIL_DIR,)
-test_expect_equal $output MAIL_DIR/cur/50:2,
+notmuch search --output=files '*' | sed -e s,$MAIL_DIR,MAIL_DIR, OUTPUT
+cat EOF EXPECTED
+MAIL_DIR/cur/50:2,
 MAIL_DIR/cur/49:2,
 MAIL_DIR/cur/48:2,
 MAIL_DIR/cur/47:2,
@@ -211,11 +224,14 @@ MAIL_DIR/cur/04:2,
 MAIL_DIR/cur/03:2,
 MAIL_DIR/cur/07:2,
 MAIL_DIR/cur/02:2,
-MAIL_DIR/cur/01:2,
+MAIL_DIR/cur/01:2,
+EOF
+test_expect_equal_file OUTPUT EXPECTED
 
 test_begin_subtest notmuch search --format=json --output=files
-output=$(notmuch search --format=json --output=files '*' | sed -e 
s,$MAIL_DIR,MAIL_DIR,)
-test_expect_equal $output '[MAIL_DIR/cur/50:2,,
+notmuch search --format=json --output=files '*' | sed -e 
s,$MAIL_DIR,MAIL_DIR, OUTPUT
+cat EOF EXPECTED
+[MAIL_DIR/cur/50:2,,
 MAIL_DIR/cur/49:2,,
 MAIL_DIR/cur/48:2,,
 MAIL_DIR/cur/47:2,,
@@ -264,20 +280,28 @@ test_expect_equal $output '[MAIL_DIR/cur/50:2,,
 MAIL_DIR/cur/03:2,,
 MAIL_DIR/cur/07:2,,
 MAIL_DIR/cur/02:2,,
-MAIL_DIR/cur/01:2,]'
+MAIL_DIR/cur/01:2,]
+EOF
+test_expect_equal_file OUTPUT EXPECTED
 
 test_begin_subtest notmuch search --output=tags
-output=$(notmuch search --output=tags '*')
-test_expect_equal $output attachment
+notmuch search --output=tags '*' OUTPUT
+cat EOF EXPECTED
+attachment
 inbox
 signed
-unread
+unread
+EOF
+test_expect_equal_file OUTPUT EXPECTED
 
 test_begin_subtest notmuch search --format=json --output=tags
-output=$(notmuch search --format=json --output=tags '*')
-test_expect_equal $output '[attachment,
+notmuch search --format=json --output=tags '*' OUTPUT
+cat EOF EXPECTED
+[attachment,
 

[PATCH 13/25] emacs: Use message-cited-text instead of message-cited-text-face

2011-05-28 Thread Jameson Graef Rollins
From: Pieter Praet pie...@praet.org

(describe-face 'message-cited-text-face)
 message-cited-text-face is an alias for the face `message-cited-text'.
 This face is obsolete since 22.1; use `message-cited-text' instead.

Signed-off-by: Pieter Praet pie...@praet.org
Signed-off-by: Jameson Graef Rollins jroll...@finestructure.net
---
 emacs/notmuch-wash.el |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/emacs/notmuch-wash.el b/emacs/notmuch-wash.el
index e8134bf..115c3bb 100644
--- a/emacs/notmuch-wash.el
+++ b/emacs/notmuch-wash.el
@@ -156,7 +156,7 @@ insert before the button, probably for indentation.
 (let* ((cite-start (match-beginning 0))
   (cite-end (match-end 0))
   (cite-lines (count-lines cite-start cite-end)))
-  (overlay-put (make-overlay cite-start cite-end) 'face 
'message-cited-text-face)
+  (overlay-put (make-overlay cite-start cite-end) 'face 
'message-cited-text)
   (when ( cite-lines (+ notmuch-wash-citation-lines-prefix
 notmuch-wash-citation-lines-suffix
 1))
@@ -178,7 +178,7 @@ insert before the button, probably for indentation.
  (sig-end-marker (make-marker)))
  (set-marker sig-start-marker sig-start)
  (set-marker sig-end-marker (point-max))
- (overlay-put (make-overlay sig-start-marker sig-end-marker) 'face 
'message-cited-text-face)
+ (overlay-put (make-overlay sig-start-marker sig-end-marker) 'face 
'message-cited-text)
  (notmuch-wash-region-to-button
   sig-start-marker sig-end-marker
   signature \n))
-- 
1.7.4.4

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


[PATCH 10/25] Sanitize Subject: and Author: fields to not contain control characters in notmuch-search

2011-05-28 Thread Jameson Graef Rollins
From: Andreas Amann a.am...@ucc.ie

When a Subject field contained encoded CRLF sequences, these sequences
would appear unfiltered in the output of notmuch search. This confused
the notmuch emacs interface leading to Unexpected Output
messages. This is now fixed by replacing all characters with ASCII
code less than 32 with a question mark.

Signed-off-by: Jameson Graef Rollins jroll...@finestructure.net
---
 notmuch-search.c |   22 --
 1 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/notmuch-search.c b/notmuch-search.c
index 69af617..530cecc 100644
--- a/notmuch-search.c
+++ b/notmuch-search.c
@@ -111,6 +111,20 @@ format_item_id_text (unused (const void *ctx),
 printf (%s%s, item_type, item_id);
 }
 
+static char *
+sanitize_string (const void *ctx, const char *str)
+{
+char *out, *loop;
+
+loop = out = talloc_strdup (ctx, str);
+
+for (; *loop; loop++) {
+   if ((unsigned char)(*loop)  32)
+   *loop = '?';
+}
+return out;
+}
+
 static void
 format_thread_text (const void *ctx,
const char *thread_id,
@@ -120,13 +134,17 @@ format_thread_text (const void *ctx,
const char *authors,
const char *subject)
 {
+void *ctx_quote = talloc_new (ctx);
+
 printf (thread:%s %12s [%d/%d] %s; %s,
thread_id,
notmuch_time_relative_date (ctx, date),
matched,
total,
-   authors,
-   subject);
+   sanitize_string (ctx_quote, authors),
+   sanitize_string (ctx_quote, subject));
+
+talloc_free (ctx_quote);
 }
 
 static void
-- 
1.7.4.4

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


[PATCH 20/25] emacs: Don't always prompt for the From address when replying

2011-05-28 Thread Jameson Graef Rollins
From: Thomas Jost schno...@schnouki.net

When replying, the From: address is already filled in by notmuch reply, so most
of the time there is no need to prompt the user for it.
---
 emacs/notmuch-mua.el |7 +--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
index 7c05a81..556d2bf 100644
--- a/emacs/notmuch-mua.el
+++ b/emacs/notmuch-mua.el
@@ -155,7 +155,10 @@ name and addresses configured in the notmuch configuration 
file.
   :type '(repeat string))
 
 (defcustom notmuch-always-prompt-for-sender nil
-  Always prompt for the From: address when composing a new message.
+  Always prompt for the From: address when composing or forwarding a message.
+
+This is not taken into account when replying to a message, because in that case
+the From: header is already filled in by notmuch.
   :group 'notmuch
   :type 'boolean)
 
@@ -203,7 +206,7 @@ the From: address first.
   Invoke the notmuch reply window.
   (interactive P)
   (let ((sender
-(when (or prompt-for-sender notmuch-always-prompt-for-sender)
+(when prompt-for-sender
   (notmuch-mua-prompt-for-sender
 (notmuch-mua-reply query-string sender)))
 
-- 
1.7.4.4

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


[PATCH 22/25] test: fix test_expect_equal_file test to copy instead of mv test files

2011-05-28 Thread Jameson Graef Rollins
This is a pretty important fix to this test, so that it can be used to
test against existing files, without deleting them in the case of test
failure.
---
 test/test-lib.sh |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/test/test-lib.sh b/test/test-lib.sh
index 6a8cb98..a59d1c1 100755
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -477,8 +477,8 @@ test_expect_equal_file ()
test_ok_ $test_subtest_name
else
testname=$this_test.$test_count
-   mv $output $testname.output
-   mv $expected $testname.expected
+   cp $output $testname.output
+   cp $expected $testname.expected
test_failure_ $test_subtest_name $(diff -u 
$testname.expected $testname.output)
fi
 fi
-- 
1.7.4.4

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


[PATCH 21/25] emacs: Cleaner interface when prompting for sender address

2011-05-28 Thread Jameson Graef Rollins
From: Thomas Jost schno...@schnouki.net

Most of the time, every entry in the list of identities has the same user name
part. It can then be filled in automatically, and the user can only be prompted
for the email address, which makes the interface much cleaner.
---
 emacs/notmuch-mua.el |   33 +++--
 1 files changed, 23 insertions(+), 10 deletions(-)

diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
index 556d2bf..274c5da 100644
--- a/emacs/notmuch-mua.el
+++ b/emacs/notmuch-mua.el
@@ -162,20 +162,33 @@ the From: header is already filled in by notmuch.
   :group 'notmuch
   :type 'boolean)
 
-(defun notmuch-mua-sender-collection ()
-  (if notmuch-identities
-  notmuch-identities
-(mapcar (lambda (address)
- (concat (notmuch-user-name)   address ))
-   (cons (notmuch-user-primary-email) (notmuch-user-other-email)
-
 (defvar notmuch-mua-sender-history nil)
 
 (defun notmuch-mua-prompt-for-sender ()
   (interactive)
-  (let ((collection (notmuch-mua-sender-collection)))
-(ido-completing-read Send mail From:  collection
-nil 'confirm nil 'notmuch-mua-sender-history (car 
collection
+  (let (name addresses one-name-only)
+;; If notmuch-identities is non-nil, check if there is a fixed user name.
+(if notmuch-identities
+   (let ((components (mapcar 'mail-extract-address-components 
notmuch-identities)))
+ (setq name  (caar components)
+   addresses (mapcar 'cadr components)
+   one-name-only (eval
+  (cons 'and
+(mapcar (lambda (identity)
+  (string-equal name (car 
identity)))
+components)
+  ;; If notmuch-identities is nil, use values from the notmuch 
configuration file.
+  (setq name  (notmuch-user-name)
+   addresses (cons (notmuch-user-primary-email) 
(notmuch-user-other-email))
+   one-name-only t))
+;; Now prompt the user, either for an email address only or for a full 
identity.
+(if one-name-only
+   (let ((address
+  (ido-completing-read (concat Sender address for  name : ) 
addresses
+   nil nil nil 'notmuch-mua-sender-history 
(car addresses
+ (concat name   address ))
+  (ido-completing-read Send mail From:  notmuch-identities
+  nil nil nil 'notmuch-mua-sender-history (car 
notmuch-identities)
 
 (defun notmuch-mua-new-mail (optional prompt-for-sender)
   Invoke the notmuch mail composition window.
-- 
1.7.4.4

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


[PATCH 25/25] Fix stdout stream grabbing in format_part_content_text

2011-05-28 Thread Jameson Graef Rollins
The declaration of the GMimeStream pointer to stdout in
format_part_content_text was somehow preventing subsequent printf
calls from outputting to stdout if the output was redirected to a
file.  Scoping the declaration to the actual use of the stream pointer
works around this problem.
---
 notmuch-show.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/notmuch-show.c b/notmuch-show.c
index e90f07e..61c6f49 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -447,7 +447,6 @@ format_part_content_text (GMimeObject *part)
 {
 GMimeContentDisposition *disposition = 
g_mime_object_get_content_disposition (part);
 GMimeContentType *content_type = g_mime_object_get_content_type 
(GMIME_OBJECT (part));
-GMimeStream *stream_stdout = g_mime_stream_file_new (stdout);
 
 printf (, Content-type: %s\n, g_mime_content_type_to_string 
(content_type));
 
@@ -462,6 +461,7 @@ format_part_content_text (GMimeObject *part)
 if (g_mime_content_type_is_type (content_type, text, *) 
!g_mime_content_type_is_type (content_type, text, html))
 {
+   GMimeStream *stream_stdout = g_mime_stream_file_new (stdout);
g_mime_stream_file_set_owner (GMIME_STREAM_FILE (stream_stdout), FALSE);
show_part_content (part, stream_stdout);
g_object_unref(stream_stdout);
-- 
1.7.4.4

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


[PATCH 23/25] test: update emacs test to use test_expect_equal_file

2011-05-28 Thread Jameson Graef Rollins
This is a much cleaner way to do the emacs tests, since we're actually
comparing output against existing files with expected output.  We also
won't miss any trailing newlines this way.

And speaking of which, one of the expected output files was actually
missing a trailing blank line that was actually in one of the original
messages, so this was fixed.
---
 test/emacs |   80 +--
 .../notmuch-show-thread-maildir-storage|1 +
 2 files changed, 39 insertions(+), 42 deletions(-)

diff --git a/test/emacs b/test/emacs
index 042f1cb..f14249e 100755
--- a/test/emacs
+++ b/test/emacs
@@ -7,39 +7,33 @@ EXPECTED=../emacs.expected-output
 add_email_corpus
 
 test_begin_subtest Basic notmuch-hello view in emacs
-output=$(test_emacs '(notmuch-hello) (princ (buffer-string))')
-expected=$(cat $EXPECTED/notmuch-hello)
-test_expect_equal $output $expected
+test_emacs '(notmuch-hello) (princ (buffer-string))' OUTPUT
+test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello
 
 test_begin_subtest Saved search with 0 results
-output=$(test_emacs '(setq notmuch-show-empty-saved-searches t) (setq 
notmuch-saved-searches '\''((inbox . tag:inbox) (unread . tag:unread) 
(empty . tag:doesnotexist))) (notmuch-hello) (princ (buffer-string))')
-expected=$(cat $EXPECTED/notmuch-hello-with-empty)
-test_expect_equal $output $expected
+test_emacs '(setq notmuch-show-empty-saved-searches t) (setq 
notmuch-saved-searches '\''((inbox . tag:inbox) (unread . tag:unread) 
(empty . tag:doesnotexist))) (notmuch-hello) (princ (buffer-string))' 
OUTPUT
+test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello-with-empty
 
 test_begin_subtest No saved searches displayed (all with 0 results)
-output=$(test_emacs '(setq notmuch-saved-searches '\''((empty . 
tag:doesnotexist))) (notmuch-hello) (princ (buffer-string))')
-expected=$(cat $EXPECTED/notmuch-hello-no-saved-searches)
-test_expect_equal $output $expected
+test_emacs '(setq notmuch-saved-searches '\''((empty . tag:doesnotexist))) 
(notmuch-hello) (princ (buffer-string))' OUTPUT
+test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello-no-saved-searches
 
 test_begin_subtest Basic notmuch-search view in emacs
-output=$(test_emacs '(notmuch-search tag:inbox) (notmuch-test-wait) (princ 
(buffer-string))')
-expected=$(cat $EXPECTED/notmuch-search-tag-inbox)
-test_expect_equal $output $expected
+test_emacs '(notmuch-search tag:inbox) (notmuch-test-wait) (princ 
(buffer-string))' OUTPUT
+test_expect_equal_file OUTPUT $EXPECTED/notmuch-search-tag-inbox
 
 test_begin_subtest Navigation of notmuch-hello to search results
-output=$(test_emacs '(notmuch-hello) (goto-char (point-min)) 
(re-search-forward inbox) (widget-button-press (point)) (notmuch-test-wait) 
(princ (buffer-string))')
-expected=$(cat $EXPECTED/notmuch-hello-view-inbox)
-test_expect_equal $output $expected
+test_emacs '(notmuch-hello) (goto-char (point-min)) (re-search-forward 
inbox) (widget-button-press (point)) (notmuch-test-wait) (princ 
(buffer-string))' OUTPUT
+test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello-view-inbox
 
 test_begin_subtest Basic notmuch-show view in emacs
 maildir_storage_thread=$(notmuch search --output=threads 
id:20091117190054.gu3...@dottiness.seas.harvard.edu)
-output=$(test_emacs (notmuch-show \$maildir_storage_thread\) (princ 
(buffer-string)))
-expected=$(cat $EXPECTED/notmuch-show-thread-maildir-storage)
-test_expect_equal $output $expected
+test_emacs (notmuch-show \$maildir_storage_thread\) (princ 
(buffer-string)) OUTPUT
+test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-maildir-storage
 
 test_begin_subtest Navigation of notmuch-search to thread view
-output=$(test_emacs '(notmuch-search tag:inbox) (notmuch-test-wait) 
(goto-char (point-min)) (re-search-forward Working with Maildir) 
(notmuch-search-show-thread) (notmuch-test-wait) (princ (buffer-string))')
-test_expect_equal $output $expected
+test_emacs '(notmuch-search tag:inbox) (notmuch-test-wait) (goto-char 
(point-min)) (re-search-forward Working with Maildir) 
(notmuch-search-show-thread) (notmuch-test-wait) (princ (buffer-string))' 
OUTPUT
+test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-maildir-storage
 
 test_begin_subtest Add tag from search view
 os_x_darwin_thread=$(notmuch search --output=threads 
id:ddd65cda0911171950o4eea4389v86de9525e4605...@mail.gmail.com)
@@ -80,10 +74,11 @@ smtp_dummy_pid=$!
 test_emacs (setq message-send-mail-function 'message-smtpmail-send-it) (setq 
smtpmail-smtp-server \localhost\) (setq smtpmail-smtp-service \25025\) 
(notmuch-hello) (notmuch-mua-mail) (message-goto-to) (insert 
\u...@example.com\nDate: Fri, 29 Mar 1974 10:00:00 -\) 
(message-goto-subject) (insert \Testing message sent via SMTP\) 
(message-goto-body) (insert \This is a test that messages are sent via SMTP\) 
(message-send-and-exit) /dev/null 21
 wait ${smtp_dummy_pid}
 
-output=$(sed \
+sed \
 -e s',^User-Agent: Notmuch/.* Emacs/.*,User-Agent: 

[PATCH 24/25] test: modify multipart test to use test_expect_equal_file

2011-05-28 Thread Jameson Graef Rollins
Again, this is a much cleaner and more thorough test, and in fact
exposes a bug in the format=text output, that will be fixed the next
commit.  Because of this, some of the multipart tests currently fail.
---
 test/multipart |  189 
 1 files changed, 121 insertions(+), 68 deletions(-)

diff --git a/test/multipart b/test/multipart
index 62efd84..6d194a5 100755
--- a/test/multipart
+++ b/test/multipart
@@ -59,9 +59,9 @@ EOF
 notmuch new  /dev/null
 
 test_begin_subtest --format=text --part=0, full message
-output=$(notmuch show --format=text --part=0 
'id:87liy5ap00@yoom.home.cworth.org')
-test_expect_equal $output \
-message{ id:87liy5ap00@yoom.home.cworth.org depth:0 match:1 
filename:${MAIL_DIR}/multipart
+notmuch show --format=text --part=0 'id:87liy5ap00@yoom.home.cworth.org' 
OUTPUT
+cat EOF EXPECTED
+message{ id:87liy5ap00@yoom.home.cworth.org depth:0 match:1 
filename:${MAIL_DIR}/multipart
 header{
 Carl Worth cwo...@cworth.org (2001-01-05) (attachment inbox signed unread)
 Subject: Multipart message
@@ -92,12 +92,23 @@ Non-text part: application/pgp-signature
 part}
 part}
 body}
-message}
+message}
+EOF
+test_expect_equal_file OUTPUT EXPECTED
 
-test_begin_subtest --format=text --part=1, message body
-output=$(notmuch show --format=text --part=1 
'id:87liy5ap00@yoom.home.cworth.org')
-test_expect_equal $output \
-part{ ID: 1, Content-type: multipart/signed
+test_begin_subtest --format=text --part=0, full message
+notmuch show --format=text --part=0 'id:87liy5ap00@yoom.home.cworth.org' 
OUTPUT
+cat EOF EXPECTED
+message{ id:87liy5ap00@yoom.home.cworth.org depth:0 match:1 
filename:${MAIL_DIR}/multipart
+header{
+Carl Worth cwo...@cworth.org (2001-01-05) (attachment inbox signed unread)
+Subject: Multipart message
+From: Carl Worth cwo...@cworth.org
+To: cwo...@cworth.org
+Date: Tue, 05 Jan 2001 15:43:57 -
+header}
+body{
+part{ ID: 1, Content-type: multipart/signed
 part{ ID: 2, Content-type: multipart/mixed
 part{ ID: 3, Content-type: message/rfc822
 part{ ID: 4, Content-type: text/html
@@ -117,12 +128,16 @@ And this message is signed.
 part{ ID: 7, Content-type: application/pgp-signature
 Non-text part: application/pgp-signature
 part}
-part}
+part}
+body}
+message}
+EOF
+test_expect_equal_file OUTPUT EXPECTED
 
 test_begin_subtest --format=text --part=2, multipart/mixed
-output=$(notmuch show --format=text --part=2 
'id:87liy5ap00@yoom.home.cworth.org')
-test_expect_equal $output \
-part{ ID: 2, Content-type: multipart/mixed
+notmuch show --format=text --part=2 'id:87liy5ap00@yoom.home.cworth.org' 
OUTPUT
+cat EOF EXPECTED
+part{ ID: 2, Content-type: multipart/mixed
 part{ ID: 3, Content-type: message/rfc822
 part{ ID: 4, Content-type: text/html
 Non-text part: text/html
@@ -137,47 +152,59 @@ And this message is signed.
 
 -Carl
 part}
-part}
+part}
+EOF
+test_expect_equal_file OUTPUT EXPECTED
 
 test_begin_subtest --format=text --part=3, rfc822 multipart
-output=$(notmuch show --format=text --part=3 
'id:87liy5ap00@yoom.home.cworth.org')
-test_expect_equal $output \
-part{ ID: 3, Content-type: message/rfc822
+notmuch show --format=text --part=3 'id:87liy5ap00@yoom.home.cworth.org' 
OUTPUT
+cat EOF EXPECTED
+part{ ID: 3, Content-type: message/rfc822
 part{ ID: 4, Content-type: text/html
 Non-text part: text/html
 part}
-part}
+part}
+EOF
+test_expect_equal_file OUTPUT EXPECTED
 
 test_begin_subtest --format=text --part=4, html part
-output=$(notmuch show --format=text --part=4 
'id:87liy5ap00@yoom.home.cworth.org')
-test_expect_equal $output \
-part{ ID: 4, Content-type: text/html
+notmuch show --format=text --part=4 'id:87liy5ap00@yoom.home.cworth.org' 
OUTPUT
+cat EOF EXPECTED
+part{ ID: 4, Content-type: text/html
 Non-text part: text/html
-part}
+part}
+EOF
+test_expect_equal_file OUTPUT EXPECTED
 
 test_begin_subtest --format=text --part=5, inline attachement
-output=$(notmuch show --format=text --part=5 
'id:87liy5ap00@yoom.home.cworth.org')
-test_expect_equal $output \
-attachment{ ID: 5, Content-type: text/plain
+notmuch show --format=text --part=5 'id:87liy5ap00@yoom.home.cworth.org' 
OUTPUT
+cat EOF EXPECTED
+attachment{ ID: 5, Content-type: text/plain
 Attachment: attachment (text/plain)
 This is a text attachment.
-attachment}
+attachment}
+EOF
+test_expect_equal_file OUTPUT EXPECTED
 
 test_begin_subtest --format=text --part=6, plain text part
-output=$(notmuch show --format=text --part=6 
'id:87liy5ap00@yoom.home.cworth.org')
-test_expect_equal $output \
-part{ ID: 6, Content-type: text/plain
+notmuch show --format=text --part=6 'id:87liy5ap00@yoom.home.cworth.org' 
OUTPUT
+cat EOF EXPECTED
+part{ ID: 6, Content-type: text/plain
 And this message is signed.
 
 -Carl
-part}
+part}
+EOF
+test_expect_equal_file OUTPUT EXPECTED
 
 test_begin_subtest --format=text --part=7, pgp signature (unverified)

Re: release-candidate/0.6 redux

2011-05-28 Thread Jameson Graef Rollins
On Sat, 28 May 2011 14:51:35 -0700, Jameson Graef Rollins 
jroll...@finestructure.net wrote:
 So what follows is a patch series for a bunch of miscellaneous patches
 that should be included in 0.6.  Most of them were originally part of
 the release-candiate/0.6 branch, and they are here rebased on top of
 notmuch/master at cb8418784c21155ffea79cce8409a7ea3c546937, which
 includes all the multipart and crypto rework.

I forgot to mention that the other two things that were in the original
release-candidate/0.6 that really need to be included before 0.6 is
released are

* Austin Clements's atomicity patches
* Felipe Contreras's vim patches

both of which have been sent to the list previously, although I believe
that Austin might have a couple extra patches in his atomic-new-v3
branch.

Austin: speaking of which, would you mind rebasing that patch series
against notmuch/master at cb8418784c21155ffea79cce8409a7ea3c546937 and
sending that to the list again?  That might help push Carl to merge that
stuff sooner.  I think the conflicts are very minor.

jamie.


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


[PATCH 1/2] Add part filename and content-id in notmuch show output if available.

2011-05-28 Thread Dmitry Kurochkin
Before the change, notmuch show output had filename only for
parts with Content-Disposition: attachment.  But parts with
inline disposition may have filename as well.

The patch makes notmuch show always output filename if available,
independent of Content-Disposition.  Both JSON and text output
formats are changed.

Also, the patch adds Content-id to text output format of notmuch
show.

The main goal of these changes is to have filenames on Emacs
buttons for inline attachments.  In particular, this is very
helpful for inline patches.

Note: text format changes may require updates in clients that use
it.  The changes are:

* text part header format changed from:

^Lpart{ ID: 2, Content-type: text/x-diff

  to:

^Lpart{ ID: 2, Filename: cool-feature.patch, Content-type: text/x-diff

* attachment format changed from:

^Lattachment{ ID: 4, Content-type: application/octet-stream
Attachment: data.tar.bz2 (application/octet-stream)
Non-text part: application/octet-stream
^Lattachment}

  to:

^Lattachment{ ID: 4, Filename: data.tar.bz2, Content-type: 
application/octet-stream
Non-text part: application/octet-stream
^Lattachment}
---
 notmuch-show.c |   24 
 1 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/notmuch-show.c b/notmuch-show.c
index e90f07e..8f275d7 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -445,20 +445,22 @@ format_part_start_text (GMimeObject *part, int 
*part_count)
 static void
 format_part_content_text (GMimeObject *part)
 {
-GMimeContentDisposition *disposition = 
g_mime_object_get_content_disposition (part);
+const char *cid = g_mime_object_get_content_id (part);
 GMimeContentType *content_type = g_mime_object_get_content_type 
(GMIME_OBJECT (part));
 GMimeStream *stream_stdout = g_mime_stream_file_new (stdout);
 
-printf (, Content-type: %s\n, g_mime_content_type_to_string 
(content_type));
-
-if (disposition 
-   strcmp (disposition-disposition, GMIME_DISPOSITION_ATTACHMENT) == 0)
+if (GMIME_IS_PART (part))
 {
const char *filename = g_mime_part_get_filename (GMIME_PART (part));
-   printf (Attachment: %s (%s)\n, filename,
-   g_mime_content_type_to_string (content_type));
+   if (filename)
+   printf (, Filename: %s, filename);
 }
 
+if (cid)
+   printf (, Content-id: %s, cid);
+
+printf (, Content-type: %s\n, g_mime_content_type_to_string 
(content_type));
+
 if (g_mime_content_type_is_type (content_type, text, *) 
!g_mime_content_type_is_type (content_type, text, html))
 {
@@ -580,7 +582,6 @@ format_part_content_json (GMimeObject *part)
 GMimeStream *stream_memory = g_mime_stream_mem_new ();
 const char *cid = g_mime_object_get_content_id (part);
 void *ctx = talloc_new (NULL);
-GMimeContentDisposition *disposition = 
g_mime_object_get_content_disposition (part);
 GByteArray *part_content;
 
 printf (, \content-type\: %s,
@@ -589,12 +590,11 @@ format_part_content_json (GMimeObject *part)
 if (cid != NULL)
printf(, \content-id\: %s, json_quote_str (ctx, cid));
 
-if (disposition 
-   strcmp (disposition-disposition, GMIME_DISPOSITION_ATTACHMENT) == 0)
+if (GMIME_IS_PART (part))
 {
const char *filename = g_mime_part_get_filename (GMIME_PART (part));
-
-   printf (, \filename\: %s, json_quote_str (ctx, filename));
+   if (filename)
+   printf (, \filename\: %s, json_quote_str (ctx, filename));
 }
 
 if (g_mime_content_type_is_type (content_type, text, *) 
-- 
1.7.5.3

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


[PATCH 2/2] test: fix tests after notmuch show output changes related to filenames

2011-05-28 Thread Dmitry Kurochkin
---
 test/crypto|3 +--
 test/multipart |   12 
 2 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/test/crypto b/test/crypto
index 8e92016..796c4ca 100755
--- a/test/crypto
+++ b/test/crypto
@@ -168,8 +168,7 @@ Non-text part: application/pgp-encrypted
 part{ ID: 4, Content-type: text/plain
 This is a test encrypted message.
 part}
-attachment{ ID: 5, Content-type: application/octet-stream
-Attachment: TESTATTACHMENT (application/octet-stream)
+attachment{ ID: 5, Filename: TESTATTACHMENT, Content-type: 
application/octet-stream
 Non-text part: application/octet-stream
 attachment}
 part}
diff --git a/test/multipart b/test/multipart
index 62efd84..9348fb6 100755
--- a/test/multipart
+++ b/test/multipart
@@ -77,8 +77,7 @@ Date: Tue, 05 Jan 2001 15:43:57 -
 Non-text part: text/html
 part}
 part}
-attachment{ ID: 5, Content-type: text/plain
-Attachment: attachment (text/plain)
+attachment{ ID: 5, Filename: attachment, Content-type: text/plain
 This is a text attachment.
 attachment}
 part{ ID: 6, Content-type: text/plain
@@ -104,8 +103,7 @@ test_expect_equal $output \
 Non-text part: text/html
 part}
 part}
-attachment{ ID: 5, Content-type: text/plain
-Attachment: attachment (text/plain)
+attachment{ ID: 5, Filename: attachment, Content-type: text/plain
 This is a text attachment.
 attachment}
 part{ ID: 6, Content-type: text/plain
@@ -128,8 +126,7 @@ test_expect_equal $output \
 Non-text part: text/html
 part}
 part}
-attachment{ ID: 5, Content-type: text/plain
-Attachment: attachment (text/plain)
+attachment{ ID: 5, Filename: attachment, Content-type: text/plain
 This is a text attachment.
 attachment}
 part{ ID: 6, Content-type: text/plain
@@ -158,8 +155,7 @@ Non-text part: text/html
 test_begin_subtest --format=text --part=5, inline attachement
 output=$(notmuch show --format=text --part=5 
'id:87liy5ap00@yoom.home.cworth.org')
 test_expect_equal $output \
-attachment{ ID: 5, Content-type: text/plain
-Attachment: attachment (text/plain)
+attachment{ ID: 5, Filename: attachment, Content-type: text/plain
 This is a text attachment.
 attachment}
 
-- 
1.7.5.3

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


[PATCH 2/2] emacs: Unbind M-RET as display of thread with crypto switch.

2011-05-28 Thread Jameson Graef Rollins
Use prefix argument instead to set switch.
---
 emacs/notmuch.el |7 +--
 1 files changed, 1 insertions(+), 6 deletions(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 3311fe8..0978c66 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -218,7 +218,6 @@ For a mouse binding, return nil.
 (define-key map - 'notmuch-search-remove-tag)
 (define-key map + 'notmuch-search-add-tag)
 (define-key map (kbd RET) 'notmuch-search-show-thread)
-(define-key map (kbd M-RET) 'notmuch-search-show-thread-crypto-switch)
 map)
   Keymap for \notmuch search\ buffers.)
 (fset 'notmuch-search-mode-map notmuch-search-mode-map)
@@ -418,13 +417,9 @@ Complete list of currently available key bindings:
   Return a list of authors for the current region
   (notmuch-search-properties-in-region 'notmuch-search-subject beg end))
 
-(defun notmuch-search-show-thread-crypto-switch ()
-  (interactive)
-  (notmuch-search-show-thread t))
-
 (defun notmuch-search-show-thread (optional crypto-switch)
   Display the currently selected thread.
-  (interactive)
+  (interactive P)
   (let ((thread-id (notmuch-search-find-thread-id))
(subject (notmuch-search-find-subject)))
 (if ( (length thread-id) 0)
-- 
1.7.4.4

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


Re: release-candidate/0.6 redux

2011-05-28 Thread Austin Clements
On Sat, May 28, 2011 at 5:58 PM, Jameson Graef Rollins
jroll...@finestructure.net wrote:
 Austin: speaking of which, would you mind rebasing that patch series
 against notmuch/master at cb8418784c21155ffea79cce8409a7ea3c546937 and
 sending that to the list again?  That might help push Carl to merge that
 stuff sooner.  I think the conflicts are very minor.

Done.  The only conflicts were the usual suspects (lists in the test
suite).  I pulled in the GDB dependency in the test suite and the
corresponding tweaks to test-lib that were on the list previously
(id:1305206080-17461-1-git-send-email-amdra...@mit.edu and
id:1305206110-17511-1-git-send-email-amdra...@mit.edu).  It's on
for-review/atomic-new-v4 at the usual,
  http://awakening.csail.mit.edu/git/notmuch.git
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 00/10] Fix 'notmuch new' atomicity issues

2011-05-28 Thread Austin Clements
Rebased to current master (cb8418) as atomic-new-v4 (aka
for-review/atomic-new-v4).

On Wed, May 4, 2011 at 4:30 PM, Austin Clements amdra...@mit.edu wrote:
 jrollins found a timing bug in the atomicity test.  A fix, plus beefed
 up test comments are on a new atomic-new-v3 (and
 for-review/atomic-new-v3) branch at
  http://awakening.csail.mit.edu/git/notmuch.git/
 Since this is more than a rebase, I'll email an update to the one
 changed patch in the series.

 On Tue, Apr 26, 2011 at 12:13 AM, Austin Clements amdra...@mit.edu wrote:
 Bump.  Now rebased against current head (with no conflicts) on
 atomic-new-v2 (and for-review/atomic-new-v2) at
  http://awakening.csail.mit.edu/git/notmuch.git/

 On Fri, Feb 18, 2011 at 2:58 AM, Austin Clements amdra...@mit.edu wrote:
 This patch series modifies notmuch new to perform all operations
 atomically and to perform maildir flag synchronization eagerly.  As a
 result, notmuch new can be interrupted without risking database
 consistency or losing track of messages, but still without losing
 progress in the middle of a big import.  This also paves the way for
 fixing the antisocial locking behavior of notmuch new.

 While there are quite a few patches in the series, each one is
 bite-sized and you can see the number of atomicity violations dropping
 with nearly every patch using the test added by the first patch.

 On my test machine, these patches have no affect on performance.

 These patches are also available on the atomic-new-v1 branch at
  http://awakening.csail.mit.edu/git/notmuch.git/

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



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