[PATCH 2/2] Remove the pipe symbol in the author list when the last author matches

2010-04-22 Thread Dirk Hohndel
this fixes the bug exposed by the tests for this feature

Signed-off-by: Dirk Hohndel 
---
 lib/thread.cc |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/lib/thread.cc b/lib/thread.cc
index 4e389c5..1dda220 100644
--- a/lib/thread.cc
+++ b/lib/thread.cc
@@ -140,6 +140,10 @@ _thread_move_matched_author (notmuch_thread_t *thread,
}
 } else {
thread->nonmatched_authors += author_len;
+   /* so now all authors are matched - let's remove the '|' */
+   lastpipe = strchr(thread->authors,'|');
+   if (lastpipe)
+   *lastpipe = ','; 
 }
 return;
 }
-- 
1.6.6.1



[PATCH 1/2] Add tests for author reordering

2010-04-22 Thread Dirk Hohndel
Test the different permutation of which authors match the search;
This exposes a bug in the existing reordering code

Signed-off-by: Dirk Hohndel 
---
 test/notmuch-test |   27 +++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/test/notmuch-test b/test/notmuch-test
index 3c1cd9f..2b76f04 100755
--- a/test/notmuch-test
+++ b/test/notmuch-test
@@ -858,6 +858,33 @@ printf " Searching returns all three messages in one 
thread..."
 output=$($NOTMUCH search foo | notmuch_search_sanitize)
 pass_if_equal "$output" "thread:XXX   2000-01-01 [3/3] Notmuch Test Suite; 
brokenthreadtest (inbox unread)"

+printf "\nTesting author reordering;\n"
+printf " Adding parent message...\t\t\t"
+generate_message [body]=findme [id]=new-parent-id 
[subject]=author-reorder-threadtest '[from]="User "' 
'[date]="Sat, 01 Jan 2000 12:00:00 -"'
+output=$(NOTMUCH_NEW)
+pass_if_equal "$output" "Added 1 new message to the database."
+printf " Adding initial child message...\t\t"
+generate_message [body]=findme '[in-reply-to]=\' 
[subject]=author-reorder-threadtest '[from]="User1 "' 
'[date]="Sat, 01 Jan 2000 12:00:00 -"'
+output=$(NOTMUCH_NEW)
+pass_if_equal "$output" "Added 1 new message to the database."
+printf " Adding second child message...\t\t\t"
+generate_message [body]=findme '[in-reply-to]=\' 
[subject]=author-reorder-threadtest '[from]="User2 "' 
'[date]="Sat, 01 Jan 2000 12:00:00 -"'
+output=$(NOTMUCH_NEW)
+pass_if_equal "$output" "Added 1 new message to the database."
+printf " Searching when all three messages match...\t"
+output=$($NOTMUCH search findme | notmuch_search_sanitize)
+pass_if_equal "$output" "thread:XXX   2000-01-01 [3/3] User, User1, User2; 
author-reorder-threadtest (inbox unread)"
+printf " Searching when two messages match...\t\t"
+output=$($NOTMUCH search User1 or User2 | notmuch_search_sanitize)
+pass_if_equal "$output" "thread:XXX   2000-01-01 [2/3] User1, User2| User; 
author-reorder-threadtest (inbox unread)"
+printf " Searching when only one message matches...\t"
+output=$($NOTMUCH search User2 | notmuch_search_sanitize)
+pass_if_equal "$output" "thread:XXX   2000-01-01 [1/3] User2| User, User1; 
author-reorder-threadtest (inbox unread)"
+printf " Searching when only first message matches...\t"
+output=$($NOTMUCH search User | notmuch_search_sanitize)
+pass_if_equal "$output" "thread:XXX   2000-01-01 [1/3] User| User1, User2; 
author-reorder-threadtest (inbox unread)"
+
+
 echo ""
 echo "Notmuch test suite complete."

-- 
1.6.6.1



Add tests (and fix bug exposed by test) for author reordering

2010-04-22 Thread Dirk Hohndel

I want Carl to enforce the adding of tests. Once again writing the test exposed 
a bug 
that I hadn't noticed before. So here's the test plus the patch that fixes the 
bug.

/D



[PATCH] removed unused variables

2010-04-22 Thread Dirk Hohndel

trivial compiler warning fix

Signed-off-by: Dirk Hohndel 
---
 notmuch-search.c |2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/notmuch-search.c b/notmuch-search.c
index 25c9cfc..8a1cdca 100644
--- a/notmuch-search.c
+++ b/notmuch-search.c
@@ -104,8 +104,6 @@ format_thread_json (const void *ctx,
const char *authors,
const char *subject)
 {
-struct tm *tm;
-char timestamp[40];
 void *ctx_quote = talloc_new (ctx);

 printf ("\"thread\": %s,\n"
-- 
1.6.6.1


-- 
Dirk Hohndel
Intel Open Source Technology Center


[PATCH] Fix linker error from insufficient LDFLAGS

2010-04-22 Thread Ben Gamari
It seems that LDFLAGS have recently been reorganized, along with the
introduction of a notmuch-shared rule. Unfortunately, the LDFLAGS used
in notmuch-shared don't include CONFIGURE_LDFLAGS. This caused linking
to fail with the following,

$ make V=1
gcc debugger.o gmime-filter-reply.o gmime-filter-headers.o notmuch.o 
notmuch-config.o notmuch-count.o notmuch-dump.o notmuch-new.o notmuch-reply.o 
notmuch-restore.o notmuch-search.o notmuch-search-tags.o notmuch-setup.o 
notmuch-show.o notmuch-tag.o notmuch-time.o query-string.o show-message.o 
json.o  -Llib -lnotmuch -o notmuch-shared
/usr/bin/ld: gmime-filter-reply.o: undefined reference to symbol 
'g_mime_filter_set_size'
/usr/bin/ld: note: 'g_mime_filter_set_size' is defined in DSO 
//usr/lib64/libgmime-2.4.so.2 so try adding it to the linker command line
//usr/lib64/libgmime-2.4.so.2: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
make: *** [notmuch-shared] Error 1
---
 Makefile.local |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Makefile.local b/Makefile.local
index 5bb570b..33b8213 100644
--- a/Makefile.local
+++ b/Makefile.local
@@ -31,7 +31,7 @@ GPG_FILE=$(SHA1_FILE).asc
 # Smash together user's values with our extra values
 FINAL_CFLAGS = -DNOTMUCH_VERSION=$(VERSION) $(CFLAGS) $(WARN_CFLAGS) 
$(CONFIGURE_CFLAGS) $(extra_cflags)
 FINAL_CXXFLAGS = $(CXXFLAGS) $(WARN_CXXFLAGS) $(CONFIGURE_CXXFLAGS) 
$(extra_cflags) $(extra_cxxflags)
-FINAL_NOTMUCH_LDFLAGS = $(LDFLAGS) -Llib -lnotmuch
+FINAL_NOTMUCH_LDFLAGS = $(LDFLAGS) -Llib -lnotmuch $(CONFIGURE_LDFLAGS)
 FINAL_NOTMUCH_LINKER = CC
 ifneq ($(LINKER_RESOLVES_LIBRARY_DEPENDENCIES),1)
 FINAL_NOTMUCH_LDFLAGS += $(CONFIGURE_LDFLAGS)
-- 
1.7.0.5



Recent linker errors for notmuch-shared

2010-04-22 Thread Ben Gamari
Hey all,

When I pulled a few days ago I noticed that notmuch-shared failed to link due
to missing LDFLAGS. In particular, it seems that the linker flags don't include
CONFIGURE_LDFLAGS, meaning that all of the required external shared libraries
depedencies aren't linked against. Here is a patch to fix this. It works for
me, although perhaps this isn't what others envision. Thanks!

- Ben


problem with notmuch-search-authors-width in JSON emacs implementation

2010-04-22 Thread David Edmondson
On Thu, 22 Apr 2010 11:20:33 -0400, Jameson Rollins  wrote:
> On Thu, 22 Apr 2010 15:38:55 +0100, David Edmondson  wrote:
> > The `defcustom' does nothing if the variable already has a value.
> 
> But the defcustom is always going to be called before any customization
> value, since my personal customizations are always loaded last, so I'm
> don't see how this would ever apply.

I see. The original solution assumed that `notmuch.el' would be loaded
on demand rather than ahead of the call to `custom-set-variables'. I'll
find another solution.

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


[PATCH] First tests for JSON output and UTF-8 in mail body and subject

2010-04-22 Thread Carl Worth
On Wed, 14 Apr 2010 17:35:44 -0700, Carl Worth  wrote:
> On Tue, 13 Apr 2010 18:37:57 +0200, Gregor Hoffleit  
> wrote:
> > The test suite doesn't yet cover --format=json output nor UTF-8 in
> > subject or body.
> > 
> > This patch starts with test cases for 'search --format=json' and
> > 'show --format=json'.
...
> So, a double thanks for this test, it seems to have uncovered another
> bug.

I've now fixed that bug, (hurrah for deleting code!), and pushed out
these tests, (which did have to be updated to apply to the current test
suite, but that was straightforward).

Thanks again for the tests.

-Carl
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20100422/f4b7174f/attachment.pgp>


[notmuch] Fcc, Maildir, and Emacs message-mode -- a bit of code

2010-04-22 Thread Dirk Hohndel
On Thu, 22 Apr 2010 11:06:04 +0200, "Sebastian Spaeth"  wrote:
> As Carl stated that he would probably merge this one if someone tested
> it, here it comes: I tested it and it works great. When I define a
> non-existing directory as maildir it aborts with an error message that
> is visible to the user.
> 
> I put this in a branch based on cworth/master and with Jesse's
> permission, I renamed the functions and did some further cleanup (It's
> also integrated in the build system)
> 
> The git branch is here:
> http://github.com/spaetz/notmuch-all-feature/tree/feature/elisp-fcc
> 
> It's not enabled by default. Enable it with:
> 
> (setq message-fcc-handler-function 
>   '(lambda (destdir) 
>  (notmuch-maildir-fcc-write-buffer-to-maildir destdir t)))
> 
> (add-hook 'message-send-hook 
>   '(lambda ()
>  (message-add-header "Fcc: ~/mail/INBOX.Sent")))

I am now using this patch together with this little snippet in my .emacs
file to FCC into per-from-address specific sent folders

;; This is the list of alternatives that should be configurable as
;; defcustom (or simply set in .emacs for now)
(setq notmuch-fcc-dirs '(
  ("Dirk Hohndel " . "Maildir/Sent Items")
  ("Dirk Hohndel " . "MaildirInfradead/Sent")))

;This constructs a path, concatenating the content of the variable
;"message-directory" and the second part in the alist:
(defun my-fcc-header-setup ()
(let ((subdir (cdr (assoc (message-fetch-field "from") notmuch-fcc-dirs
 (message-add-header (concat "Fcc: " message-directory subdir
(add-hook 'message-send-hook 'my-fcc-header-setup)

(setq message-fcc-handler-function
   '(lambda (destdir)
   (notmuch-maildir-fcc-write-buffer-to-maildir destdir t)))

I am using the message-send-hook (instead of the
message-header-setup-hook as Sebastian initially suggested) because I
tend to edit the From line in my message buffer and want to make sure
that it uses the final From line. Also, this way the FCC also works
correctly with replies (the message-header-setup-hook doesn't get called
by our notmuch-reply function, it seems).

The disadvantage is that with the message-send-hook I don't get to see /
correct the FCC line in the message buffer - but since I trust the logic
here (and tested it quite a bit), I'm less concerned about this.

Finally, for other emacs-newbies like me - this concats the
message-directory variable with the path that you setup in the
notmuch-fcc-dirs associative array... so the path to the sent folder
needs to be relative to that.

Carl - I'd love to see this in 0.3

/D

-- 
Dirk Hohndel
Intel Open Source Technology Center


sort order regression

2010-04-22 Thread Sebastian Spaeth

jkr and I noticed that patch series are shown in reverse order now, in
fact threads seem to display messages at the same depth in reverse
chronological order now.

Here is my monologue from IRC:

Is that supposed to show the whole thread in reverse chronological order?:
notmuch show --entire-thread id:"1271927251-19867-3-git-send-email-Sebastian at 
SSpaeth.de"

doh, 
http://git.notmuchmail.org/git/notmuch/commitdiff/f43990ce134d838cdb2cdd5d0752a602e81cfdd9
sort order for within threads used to be SORT_OLDEST_FIRST
with that commit it was changed to be inherited from whatever it was (and by 
default notmuch does NEWEST_FIRST)
so that would cause the change IMHO.
someone does not seem to have run a test suite there :

query.cc sets to NEWEST-FIRST by default. So now we get messages at each depth 
NEWEST-FIRST. So the code is working as expected.
the problem is imho, that we previously had NEWEST_FIRST for top-level and an 
explicit OLDEST_FIRST within threads
< jkr> spaetz: yep.
and that explicit OLDEST_FIRST got removed


pull request

2010-04-22 Thread David Edmondson
On Thu, 22 Apr 2010 10:10:15 -0400, Servilio Afre Puentes  wrote:
> > Showing only one (with a variable allowing you to express preference) is
> > my intention. Any non-shown parts will appear as attachments - you can
> > save them using the button (and perhaps later view them).
> 
> Why not see them in-line if possible?

This will probably come later, sure. At the moment the entire buffer is
built in one pass before you see it. If we want to support the insertion
of parts 'on demand' then a little more work is required.

> >> What I miss in this view sometimes is the possibility of being able to
> >> see the structure of the thread. A way to toggle the expanded state of
> >> the messages originally expanded when I first opened the view would do
> >> this very nicely.
> >
> > Ah, so you want a "go back to how it was initially" command?
> 
> Yep, then bind it to a key that would alternate between collapsing all
> messages and expanding the ones that were originally expanded.

I'll give this some thought.

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


problem with notmuch-search-authors-width in JSON emacs implementation

2010-04-22 Thread David Edmondson
On Thu, 22 Apr 2010 10:12:59 -0400, Jameson Rollins  wrote:
> On Thu, 22 Apr 2010 15:04:45 +0100, David Edmondson  wrote:
> > Ah, when you set `notmuch-search-authors-width' the expression which
> > creates `notmuch-search-result-format' is not re-evaluated.
> > 
> > Do things get better if you restart emacs (sorry for suggesting that)?
> 
> I can't see how that would help, because notmuch-search-result-format is
> always going to be evaluated with the default value of
> notmuch-search-authors-width, which is defined immediately previous to
> it.

The `defcustom' does nothing if the variable already has a value.

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


[PATCH] notmuch.el: Make notmuch-show buffer name first subject, instead of thread-id (supersedes V1--3)

2010-04-22 Thread Sebastian Spaeth
On 2010-04-22, Sebastian Spaeth wrote:
> From: Jesse Rosenthal 

This patch must have slipped in the patch series of the 6 other patches
(which are all correct). Please ignore it.

Note to myself, never do "git send-email 00*"

Sebastian


[PATCH] Add 'G' keybinding to folder and search view that triggers external poll

2010-04-22 Thread Dirk Hohndel
On Thu, 22 Apr 2010 14:50:33 -0700, Carl Worth  wrote:
> On Fri, 09 Apr 2010 12:53:26 -0700, Dirk Hohndel  
> wrote:
> > The new functions first check if an external poll script has been defined in
> > the variable 'notmuch-external-refresh-script and if yes, runs that script
> > before executing the existing refresh function (which is bound to '=')
> 
> Thanks Dirk,
> 
> This is even handier than I expected.
> 
> I've pushed this now, but followed up immediately with a (totally
> trivial) change to reduce code duplication, and then a (slightly more
> major) change to define the controlling variable with defcustom so that
> the user can find the variable in the customize screen for notmuch.
> 
> I also renamed it to notmuch-poll-script so you'll need to update your
> setting for this feature to work.

I appreciate how nicely you can say "I liked the idea and then
completely rewrote the crap elisp that you submitted" :-)

/D

-- 
Dirk Hohndel
Intel Open Source Technology Center


problem with notmuch-search-authors-width in JSON emacs implementation

2010-04-22 Thread David Edmondson
On Thu, 22 Apr 2010 09:22:32 -0400, Jameson Rollins  wrote:
> > Can you show any explicit settings you have for
> > `notmuch-search-authors-width' and `notmuch-search-result-format'? Where
> > do you set them?
> 
> Changing notmuch-search-authors-width to anything longer than 20 (which
> is the default set internally) causes the problem (I had it set to 40
> when I first noticed).  It's very easy to test.  You can
> notmuch-search-authors-width on the fly from the configuration manager
> and see the result.  I have not modified notmuch-search-result-format.
> See my previous email on tracking down the issue.

Ah, when you set `notmuch-search-authors-width' the expression which
creates `notmuch-search-result-format' is not re-evaluated.

Do things get better if you restart emacs (sorry for suggesting that)?

If so then I have an idea how to fix it.

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


[PATCH] json: Replace `date_unix' with `timestamp' in show output

2010-04-22 Thread Carl Worth
On Fri, 16 Apr 2010 12:47:49 +0100, David Edmondson  wrote:
> Search output was already using `timestamp' for a very similar field,
> so follow that.

Thanks. I've just pushed this. I didn't find any other occurrence of
date_unix in the notmuch repository (or else I would have updated them).

Do we have any external code that is interpreting JSON output from
notmuch? I think some web frontends do, for example. That code will need
to be updated. And I give my encouragement for the authors of such code
to consider contributing them to be maintained within the notmuch
repository itself.

-Carl
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20100422/7ad2cd7e/attachment.pgp>


[PATCH] Add 'G' keybinding to folder and search view that triggers external poll

2010-04-22 Thread Carl Worth
On Fri, 09 Apr 2010 12:53:26 -0700, Dirk Hohndel  
wrote:
> The new functions first check if an external poll script has been defined in
> the variable 'notmuch-external-refresh-script and if yes, runs that script
> before executing the existing refresh function (which is bound to '=')

Thanks Dirk,

This is even handier than I expected.

I've pushed this now, but followed up immediately with a (totally
trivial) change to reduce code duplication, and then a (slightly more
major) change to define the controlling variable with defcustom so that
the user can find the variable in the customize screen for notmuch.

I also renamed it to notmuch-poll-script so you'll need to update your
setting for this feature to work.

-Carl
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20100422/706bc78f/attachment.pgp>


bug tracking

2010-04-22 Thread David Bremner
On Thu, 22 Apr 2010 11:47:13 -0400, Jameson Rollins  wrote:
> I now think it is essential that we put together a bug tracker for
> notmuch.  Things are moving pretty quickly now, which is great, but as
> the UI is frequently changing, I'm stumbling upon lots of little bugs.
> As I don't have the time to stop what I'm doing and figure out patches
> for them all, we really need some way to report and track issues.  I
> really think this is essential moving forward.
> 
> I have used things like trac and redmine in the past and they work quite
> well.  I don't have any other useful suggestions.  One of the newfangled
> git-based distributed bug trackers could be cool, but I've never used
> one, or gotten any feedback from anyone who has.
> 

It was thinking along these lines that got me to make the following list

 http://www.cs.unb.ca/~bremner/blog/posts/git-issue-trackers/

If people think the general concept of a distributed bug tracker is
worthwhile, I'm willing to investigate a more.  Feel free to cc

 bremner-comment-blog~posts~git-issue-trackers at pivot.cs.unb.ca

If you have comments about distributed bug trackers; this
semi-automatically gets added to the comments page.

So far, a few Debian people have endorsed "simple defects".

d


sort order regression

2010-04-22 Thread Carl Worth
On Thu, 22 Apr 2010 16:06:27 +0200, "Sebastian Spaeth"  wrote:
> 
> jkr and I noticed that patch series are shown in reverse order now, in
> fact threads seem to display messages at the same depth in reverse
> chronological order now.

My fault! Sorry about that.

On Thu, 22 Apr 2010 10:14:16 -0400, Jesse Rosenthal  
wrote:
> Just to follow up on this, it seems that the regression comes from the
> fix Carl introduced in 2a1a4f0551 to make his simplification of my patch

Indeed that was the problem. And your original code *did* pass the tests
I wrote. There are still a couple of cleanups I'd like to make, (like
assigning the subject only in _add_matched_message and not uselessly in
_add_message as well). But I can do those now without breaking the test
suite!

> Unfortunately, I'm not quite skilled enough at git to turn back some
> files to a certain state, tests to another state, and so on.

For now, since the test suite is just a single file, it's easy enough to
do:

cp test/notmuch-test latest-notmuch-test
git checkout HEAD~5 # or whatever
make
./latest-notmuch-test

Though that doesn't answer the question of how to do this with
git. Probably something like:

git checkout HEAD~5
git checkout master -- test
make test

On Thu, 22 Apr 2010 10:31:18 -0400, Jesse Rosenthal  
wrote:
> Sorry, got that slightly wrong. The following commits need to be
> reverted:
>  
> 36e4459a328b8449b3e9d510be81a332a9b35aaa
> f43990ce134d838cdb2cdd5d0752a602e81cfdd9
> 7fb56f9dc5d8e66f717f5e48ecbfbc11c8190182
> 
> When I do this, search order is right, and all tests are passed.

I did this. And before doing it I added a new test to show the
regression, (which the reverts then make pass).

So in my defense, it wasn't my fault[*] I didn't notice the
regression. It was the test suite's fault for not testing "notmuch show"
at all.

-Carl

[*] Except that I'm the one that wrote the test suite and didn't put any
"notmuch show" tests into it. Oops!
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20100422/71398637/attachment.pgp>


pull request

2010-04-22 Thread David Edmondson
On Thu, 22 Apr 2010 04:58:16 -0400, Servilio Afre Puentes  wrote:
> On 21 April 2010 17:03, Carl Worth  wrote:
> > On Mon, 19 Apr 2010 09:27:39 +0100, David Edmondson  wrote:
> [...]
> > Meanwhile, another issue with the result of this series is that I now
> > seem to get rendering for both the text/plain and the text/html
> > alternatives when a message has both. For now, the paragraphs are
> > wrapped much more nicely in the rendering of the html portion, but links
> > are apparently entirely missing. The link URLs at least appear in the
> > text/plain rendering, (which is pretty ugly, but at least not impossible
> > to use).
> >
> > If we could get one version or the other working completely, then it
> > would be nice to display only one.
> 
> I think that a better approach here would be to list them as parts if
> they are present, then have a [configurable] way to show only one by
> default, and the other would be available to show in-line.

Showing only one (with a variable allowing you to express preference) is
my intention. Any non-shown parts will appear as attachments - you can
save them using the button (and perhaps later view them).

This can make quite a big difference in a 200 message thread with lots
of 'text/plain or text/html ?' choices - using the text/plain part will
improve the performance of building the show buffer significantly.

> What I miss in this view sometimes is the possibility of being able to
> see the structure of the thread. A way to toggle the expanded state of
> the messages originally expanded when I first opened the view would do
> this very nicely.

Ah, so you want a "go back to how it was initially" command?

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


[PATCH] emacs: Add more functions to clean up text/plain parts

2010-04-22 Thread David Edmondson
Add:
- notmuch-wash-wrap-long-lines: Wrap lines longer than the width of
  the current window whilst maintaining any citation prefix.
- notmuch-wash-tidy-citations: Tidy up citations by:
  - compress repeated otherwise blank citation lines,
  - remove otherwise blank citation lines at the head and tail of a
citation and remove blank lines between attribution statements and
the citation,
- notmuch-wash-compress-blanks: Compress repeated blank lines and
  remove leading and trailing blank lines.

Enable `notmuch-wash-tidy-citations' and
`notmuch-wash-compress-blanks' by default by adding them to
`notmuch-show-insert-text/plain-hook'. `notmuch-wash-wrap-long-lines'
is not enabled by default.

If `notmuch-wash-wrap-long-lines' is enabled, word wrapping of the
buffer leads to an unappealing display of text, so provide a function
to disable it and add it to the list of `notmuch-show-mode' hook
functions.
---

This is a small variant on the previous version of the patch. The
wrapping of long lines is not enabled by default - it's simply an
option in the customise interface.

 emacs/Makefile.local  |3 +-
 emacs/coolj.el|  145 +
 emacs/notmuch-show.el |   25 +++--
 emacs/notmuch-wash.el |   72 -
 4 files changed, 239 insertions(+), 6 deletions(-)
 create mode 100644 emacs/coolj.el

diff --git a/emacs/Makefile.local b/emacs/Makefile.local
index 7537c3d..ce37ca2 100644
--- a/emacs/Makefile.local
+++ b/emacs/Makefile.local
@@ -9,7 +9,8 @@ emacs_sources := \
$(dir)/notmuch-wash.el \
$(dir)/notmuch-hello.el \
$(dir)/notmuch-mua.el \
-   $(dir)/notmuch-address.el
+   $(dir)/notmuch-address.el \
+   $(dir)/coolj.el

 emacs_images := \
$(dir)/notmuch-logo.png
diff --git a/emacs/coolj.el b/emacs/coolj.el
new file mode 100644
index 000..60af60a
--- /dev/null
+++ b/emacs/coolj.el
@@ -0,0 +1,145 @@
+;;; coolj.el --- automatically wrap long lines  -*- coding:utf-8 -*-
+
+;; Copyright (C) 2000, 2001, 2004, 2005, 2006, 2007, 2008, 2009 Free Software 
Foundation, Inc.
+
+;; Authors:Kai Grossjohann 
+;; Alex Schroeder 
+;; Chong Yidong 
+;; Maintainer: David Edmondson 
+;; Keywords: convenience, wp
+
+;; This file is not part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see .
+
+;;; Commentary:
+
+;;; This is a simple derivative of some functionality from
+;;; `longlines.el'. The key difference is that this version will
+;;; insert a prefix at the head of each wrapped line. The prefix is
+;;; calculated from the originating long line.
+
+;;; No minor-mode is provided, the caller is expected to call
+;;; `coolj-wrap-region' to wrap the region of interest.
+
+;;; Code:
+
+(defgroup coolj nil
+  "Wrapping of long lines with prefix."
+  :group 'fill)
+
+(defcustom coolj-wrap-follows-window-size t
+  "Non-nil means wrap text to the window size.
+Otherwise respect `fill-column'."
+  :group 'coolj
+  :type 'boolean)
+
+(defcustom coolj-line-prefix-regexp "^\\(>+ \\)*"
+  "Regular expression that matches line prefixes."
+  :group 'coolj
+  :type 'regexp)
+
+(defvar coolj-wrap-point nil)
+
+(make-variable-buffer-local 'coolj-wrap-point)
+
+(defun coolj-determine-prefix ()
+  "Determine the prefix for the current line."
+  (save-excursion
+(beginning-of-line)
+(if (re-search-forward coolj-line-prefix-regexp nil t)
+   (buffer-substring (match-beginning 0) (match-end 0))
+  "")))
+
+(defun coolj-wrap-buffer ()
+  "Wrap the current buffer."
+  (coolj-wrap-region (point-min) (point-max)))
+
+(defun coolj-wrap-region (beg end)
+  "Wrap each successive line, starting with the line before BEG.
+Stop when we reach lines after END that don't need wrapping, or the
+end of the buffer."
+  (setq fill-column (if coolj-wrap-follows-window-size
+   (window-width)
+ fill-column))
+  (let ((mod (buffer-modified-p)))
+(setq coolj-wrap-point (point))
+(goto-char beg)
+(forward-line -1)
+;; Two successful coolj-wrap-line's in a row mean successive
+;; lines don't need wrapping.
+(while (null (and (coolj-wrap-line)
+ (or (eobp)
+ (and (>= (point) end)
+  (coolj-wrap-line))
+(goto-char coolj-wrap-point)
+(set-buffer-modified-p mod)))

[PATCH 1/2] Add 'cat' subcommand

2010-04-22 Thread Anthony Towns
On Thu, Apr 22, 2010 at 12:37, Dirk Hohndel  wrote:
> On Wed, 21 Apr 2010 17:44:03 -0700, Carl Worth  wrote:
>> So I'd prefer to have this command behave just like all others and use
>> the same naming.
>> ? ? ? filename:/complete/path/to/file

Would "notmuch cat" be any different to "notmuch show" in this case?
What happens if you say "notmuch cat something" and multiple messages
match (eg, an id: for a mail that you both sent (Mail/.sent/cur/12345)
and received (Mail/.Lists.notmuch/cur/12346))?

Maybe notmuch show should be able to deal with all these things, and
notmuch cat could be an alias for something like:

notmuch show --format=mbox --show-duplicate-files $SPEC

?

> should we extend this to something generic that allows remote
> specifications?
> URI:file/path/to/local/file
> URI:ssh/user at host/path/to/file
> URI:git/user at host/path/to/file

You could already do that by using FUSE filesystems to mount your
remote mail dirs under those paths, without having to teach notmuch
about those protocols, as long as you still have the Xapian database
local.

If the Xapian database is remote, you need to invoke "ssh $USER@$HOST
notmuch" (or similar) instead of "notmuch", but the "cat" patch should
be enough to make that work right.

Otherwise, wouldn't you be better off just having this be something
for the database::path setting in .notmuch-config? So you say:

   [database]
   path=/home/aj/Mail

or

   [database]
   path=/home/aj/Mail/.git
   format=git

or

   [database]
   # multiple backends
   path=/home/aj/Mail
   path=git:///home/aj/OldMail.git

and have filename: just serve as a unique id that the database knows
how to convert to the contents of the file?

At most (afaics) maybe you'd want to say something like:

[database]
path=/home/aj/Mail
path.old=git:///home/aj/OldMail.git

so that any filename starting with "old/" has the "old/" trimmed and
gets passed to the git backend, while the rest go to the default file
backend.

Cheers,
aj

-- 
Anthony Towns 


[PATCH] emacs: Add notmuch-address.el for address completion using notmuch

2010-04-22 Thread Sebastian Spaeth
On 2010-04-22, David Edmondson wrote:
> A tool `notmuch-addresses' is required to produce addresses which
> match a query string. An example of a suitable script can be found in
> the git repository at
> http://jkr.acm.jhu.edu/git/notmuch_addresses.git
> There are no doubt others.

no doubt :-).

This works great, the only "disadvantage" is that it will disable bbdb
and eudc by default if a notmuch-addresses binary is available. I think
that is a reasonable assumption.

Is it really necessary to try to append ".exe"? Even Windows users
should be able to provide the full binary name if asked for it
(especially when using emacs on Windows).

in any case:

Signed-off: Sebastian Spaeth 


[PATCH] emacs: Re-arrange message sending code

2010-04-22 Thread Sebastian Spaeth
On 2010-04-22, David Edmondson wrote:
> Define a new `mail-user-agent' (`notmuch-user-agent') and use it by
> default. Re-arrange various routines that send mail to use this
> (compose, reply, forward). Insert a `User-Agent:' header by default.

I've been using this or a slightly earlier version of patch

Signed-off: Sebastian Spaeth 


python cnotmuch -> notmuch

2010-04-22 Thread Sebastian Spaeth
My "reply-to-sender-only" works too well, resending this to the notmuch list.

-- next part --
An embedded message was scrubbed...
From: unknown sender
Subject: no subject
Date: no date
Size: 930
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20100422/af87b706/attachment.eml>


[notmuch] auto-tagging replied messages

2010-04-22 Thread Sebastian Spaeth
On 2010-03-05, Jesse Rosenthal wrote:
> One element of traditional clients that I've missed in notmuch is the
> ability to easily see which messages have been replied to. A look at the
> thread structure will often make that clear, but for both searching and
> syncing, an "answered" tag would be nice.

This patch has been working great so far and is very useful. Can I
persuade someone to take this into the notmuch code and have a defcustom
as to which tag a reply should get (or disable if nil)?

Sebastian


[PATCH] emacs: Push the cursor to point-max on `n' or `N' at the end of a thread

2010-04-22 Thread David Edmondson
Sebastian pointed out that the pre-JSON UI would move the cursor to
the end of the buffer if `n' or `N' is hit when on the last (unread)
message. Mimic that behaviour in the new UI.
---
 emacs/notmuch-show.el |   20 +---
 1 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 379e344..d01bf36 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -816,9 +816,11 @@ any effects from previous calls to
 (defun notmuch-show-next-message ()
   "Show the next message."
   (interactive)
-  (notmuch-show-goto-message-next)
-  (notmuch-show-mark-read)
-  (notmuch-show-message-adjust))
+  (if (notmuch-show-goto-message-next)
+  (progn
+   (notmuch-show-mark-read)
+   (notmuch-show-message-adjust))
+(goto-char (point-max

 (defun notmuch-show-previous-message ()
   "Show the previous message."
@@ -830,10 +832,14 @@ any effects from previous calls to
 (defun notmuch-show-next-open-message ()
   "Show the next message."
   (interactive)
-  (while (and (notmuch-show-goto-message-next)
- (not (notmuch-show-message-visible-p
-  (notmuch-show-mark-read)
-  (notmuch-show-message-adjust))
+  (let (r)
+(while (and (setq r (notmuch-show-goto-message-next))
+   (not (notmuch-show-message-visible-p
+(if r
+   (progn
+ (notmuch-show-mark-read)
+ (notmuch-show-message-adjust))
+  (goto-char (point-max)

 (defun notmuch-show-previous-open-message ()
   "Show the previous message."
-- 
1.7.0



bug tracking

2010-04-22 Thread Jameson Rollins
I now think it is essential that we put together a bug tracker for
notmuch.  Things are moving pretty quickly now, which is great, but as
the UI is frequently changing, I'm stumbling upon lots of little bugs.
As I don't have the time to stop what I'm doing and figure out patches
for them all, we really need some way to report and track issues.  I
really think this is essential moving forward.

I have used things like trac and redmine in the past and they work quite
well.  I don't have any other useful suggestions.  One of the newfangled
git-based distributed bug trackers could be cool, but I've never used
one, or gotten any feedback from anyone who has.

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/20100422/ba5184ea/attachment.pgp>


problem with notmuch-search-authors-width in JSON emacs implementation

2010-04-22 Thread Jameson Rollins
On Thu, 22 Apr 2010 15:38:55 +0100, David Edmondson  wrote:
> The `defcustom' does nothing if the variable already has a value.

But the defcustom is always going to be called before any customization
value, since my personal customizations are always loaded last, so I'm
don't see how this would ever apply.

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/20100422/e2ce0469/attachment.pgp>


[PATCH 6/6] notmuch-maildir-fcc: replace caddr with (car (cdr (cdr)))

2010-04-22 Thread Sebastian Spaeth
The former requires 'cl to be loaded and during make install emacs complained 
about not knowing it.

Signed-off-by: Sebastian Spaeth 
---
 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 c47bfb3..3dc8283 100644
--- a/emacs/notmuch-maildir-fcc.el
+++ b/emacs/notmuch-maildir-fcc.el
@@ -58,7 +58,7 @@
 (defun notmuch-maildir-fcc-make-uniq-maildir-id ()
(let* ((ct (current-time))
  (timeid (+ (* (car ct) 65536) (cadr ct)))
- (microseconds (caddr ct))
+ (microseconds (car (cdr (cdr ct
  (hostname (notmuch-maildir-fcc-host-fixer system-name)))
  (setq notmuch-maildir-fcc-count (+ notmuch-maildir-fcc-count 1))
  (format "%d.%d_%d_%d.%s"
-- 
1.7.0.4



[PATCH 5/6] notmuch-maildir-fcc: use insert-buffer-substring

2010-04-22 Thread Sebastian Spaeth
Rather than the insert-buffer. Emacs complains that it is for interactive use
and not for use within elisp. So use insert-buffer-substring which does the
same thing when not handed any 'begin' 'end' parameters.

Signed-off-by: Sebastian Spaeth 
---
 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 f63c1c9..c47bfb3 100644
--- a/emacs/notmuch-maildir-fcc.el
+++ b/emacs/notmuch-maildir-fcc.el
@@ -103,7 +103,7 @@ non-nil, it will write it to cur/, and mark it as read. It 
should
 return t if successful, and nil otherwise."
   (let ((orig-buffer (buffer-name)))
 (with-temp-buffer 
-  (insert-buffer orig-buffer)
+  (insert-buffer-substring orig-buffer)
   (catch 'link-error
(let ((msg-id (notmuch-maildir-fcc-save-buffer-to-tmp destdir)))
  (when msg-id
-- 
1.7.0.4



[PATCH 4/6] add documentation example

2010-04-22 Thread Sebastian Spaeth
Show how to set up an FCC header hook. Some minor indentation fixes

Signed-off-by: Sebastian Spaeth 
---
 emacs/notmuch-maildir-fcc.el |   14 ++
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/emacs/notmuch-maildir-fcc.el b/emacs/notmuch-maildir-fcc.el
index c91095d..f63c1c9 100644
--- a/emacs/notmuch-maildir-fcc.el
+++ b/emacs/notmuch-maildir-fcc.el
@@ -35,16 +35,22 @@
 ;; (setq message-fcc-handler-function 
 ;;  '(lambda (destdir) 
 ;;  (notmuch-maildir-fcc-write-buffer-to-maildir destdir nil)))
-
+;;
+;; It will then honor the Fcc header that you set in your mail. They can
+;; be set up automatically via:
+;;
+;; (add-hook 'message-send-hook 
+;;  '(lambda ()
+;; (message-add-header "Fcc: ~/mail/INBOX.Sent")))

 (defvar notmuch-maildir-fcc-count 0)

 (defun notmuch-maildir-fcc-host-fixer (hostname)
   (replace-regexp-in-string "/\\|:"
'(lambda (s)
-(cond ((string-equal s "/") "\\057")
-  ((string-equal s ":") "\\072")
-  (t s)))
+   (cond ((string-equal s "/") "\\057")
+ ((string-equal s ":") "\\072")
+ (t s)))
hostname
t
t))
-- 
1.7.0.4



[PATCH 3/6] notmuch-maildir-fcc: rename all jkr/* functions to notmuch-maildir-fcc-*

2010-04-22 Thread Sebastian Spaeth
Signed-off-by: Sebastian Spaeth 
---
 emacs/notmuch-maildir-fcc.el |   38 +++---
 1 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/emacs/notmuch-maildir-fcc.el b/emacs/notmuch-maildir-fcc.el
index f18ccc8..c91095d 100644
--- a/emacs/notmuch-maildir-fcc.el
+++ b/emacs/notmuch-maildir-fcc.el
@@ -28,18 +28,18 @@
 ;;
 ;; (setq message-fcc-handler-function 
 ;;  '(lambda (destdir) 
-;;  (jkr/maildir-write-buffer-to-maildir destdir t)))
+;;  (notmuch-maildir-fcc-write-buffer-to-maildir destdir t)))
 ;;
 ;; if you want Fcc'd messages to be marked as new:
 ;;
 ;; (setq message-fcc-handler-function 
 ;;  '(lambda (destdir) 
-;;  (jkr/maildir-write-buffer-to-maildir destdir nil)))
+;;  (notmuch-maildir-fcc-write-buffer-to-maildir destdir nil)))


-(defvar jkr/maildir-count 0)
+(defvar notmuch-maildir-fcc-count 0)

-(defun jkr/maildir-host-fixer (hostname)
+(defun notmuch-maildir-fcc-host-fixer (hostname)
   (replace-regexp-in-string "/\\|:"
'(lambda (s)
 (cond ((string-equal s "/") "\\057")
@@ -49,31 +49,31 @@
t
t))

-(defun jkr/maildir-make-uniq-maildir-id ()
+(defun notmuch-maildir-fcc-make-uniq-maildir-id ()
(let* ((ct (current-time))
  (timeid (+ (* (car ct) 65536) (cadr ct)))
  (microseconds (caddr ct))
- (hostname (jkr/maildir-host-fixer system-name)))
- (setq jkr/maildir-count (+ jkr/maildir-count 1))
+ (hostname (notmuch-maildir-fcc-host-fixer system-name)))
+ (setq notmuch-maildir-fcc-count (+ notmuch-maildir-fcc-count 1))
  (format "%d.%d_%d_%d.%s"
 timeid
 (emacs-pid)
 microseconds
-jkr/maildir-count
+notmuch-maildir-fcc-count
 hostname)))

-(defun jkr/maildir-dir-is-maildir-p (dir)
+(defun notmuch-maildir-fcc-dir-is-maildir-p (dir)
   (and (file-exists-p (concat dir "/cur/"))
(file-exists-p (concat dir "/new/"))
(file-exists-p (concat dir "/tmp/"

-(defun jkr/maildir-save-buffer-to-tmp (destdir)
+(defun notmuch-maildir-fcc-save-buffer-to-tmp (destdir)
   "Returns the msg id of the message written to the temp directory
 if successful, nil if not."
-  (let ((msg-id (jkr/maildir-make-uniq-maildir-id)))
+  (let ((msg-id (notmuch-maildir-fcc-make-uniq-maildir-id)))
 (while (file-exists-p (concat destdir "/tmp/" msg-id))
-  (setq msg-id (jkr/maildir-make-uniq-maildir-id)))
-(cond ((jkr/maildir-dir-is-maildir-p destdir)
+  (setq msg-id (notmuch-maildir-fcc-make-uniq-maildir-id)))
+(cond ((notmuch-maildir-fcc-dir-is-maildir-p destdir)
   (write-file (concat destdir "/tmp/" msg-id))
   msg-id)
  (t
@@ -81,17 +81,17 @@ if successful, nil if not."
 destdir))
   nil

-(defun jkr/maildir-move-tmp-to-new (destdir msg-id)
+(defun notmuch-maildir-fcc-move-tmp-to-new (destdir msg-id)
   (add-name-to-file 
(concat destdir "/tmp/" msg-id)
(concat destdir "/new/" msg-id ":2,")))

-(defun jkr/maildir-move-tmp-to-cur (destdir msg-id  mark-seen)
+(defun notmuch-maildir-fcc-move-tmp-to-cur (destdir msg-id  mark-seen)
   (add-name-to-file 
(concat destdir "/tmp/" msg-id)
(concat destdir "/cur/" msg-id ":2," (when mark-seen "S"

-(defun jkr/maildir-write-buffer-to-maildir (destdir  mark-seen)
+(defun notmuch-maildir-fcc-write-buffer-to-maildir (destdir  
mark-seen)
   "Writes the current buffer to maildir destdir. If mark-seen is
 non-nil, it will write it to cur/, and mark it as read. It should
 return t if successful, and nil otherwise."
@@ -99,16 +99,16 @@ return t if successful, and nil otherwise."
 (with-temp-buffer 
   (insert-buffer orig-buffer)
   (catch 'link-error
-   (let ((msg-id (jkr/maildir-save-buffer-to-tmp destdir)))
+   (let ((msg-id (notmuch-maildir-fcc-save-buffer-to-tmp destdir)))
  (when msg-id
(cond (mark-seen
   (condition-case err
-  (jkr/maildir-move-tmp-to-cur destdir msg-id t)
+  (notmuch-maildir-fcc-move-tmp-to-cur destdir msg-id t)
 (file-already-exists
  (throw 'link-error nil
  (t 
   (condition-case err
-  (jkr/maildir-move-tmp-to-new destdir msg-id)
+  (notmuch-maildir-fcc-move-tmp-to-new destdir msg-id)
 (file-already-exists
  (throw 'link-error nil))
  (delete-file (concat destdir "/tmp/" msg-id
-- 
1.7.0.4



[PATCH 2/6] Integrate notmuch-maildir-fcc into notmuch

2010-04-22 Thread Sebastian Spaeth
Require notmuch-maildir-fcc and also install it.

Signed-off-by: Sebastian Spaeth 
---
 emacs/Makefile.local |3 ++-
 emacs/notmuch-maildir-fcc.el |4 +++-
 emacs/notmuch.el |1 +
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/emacs/Makefile.local b/emacs/Makefile.local
index f759c0d..c80e0e3 100644
--- a/emacs/Makefile.local
+++ b/emacs/Makefile.local
@@ -6,7 +6,8 @@ emacs_sources := \
$(dir)/notmuch.el \
$(dir)/notmuch-query.el \
$(dir)/notmuch-show.el \
-   $(dir)/notmuch-wash.el
+   $(dir)/notmuch-wash.el \
+   $(dir)/notmuch-maildir-fcc.el

 emacs_bytecode := $(subst .el,.elc,$(emacs_sources))

diff --git a/emacs/notmuch-maildir-fcc.el b/emacs/notmuch-maildir-fcc.el
index e7fddf1..f18ccc8 100644
--- a/emacs/notmuch-maildir-fcc.el
+++ b/emacs/notmuch-maildir-fcc.el
@@ -112,4 +112,6 @@ return t if successful, and nil otherwise."
 (file-already-exists
  (throw 'link-error nil))
  (delete-file (concat destdir "/tmp/" msg-id
-  t)))
\ No newline at end of file
+  t)))
+
+(provide 'notmuch-maildir-fcc)
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 57b7fcf..02760b4 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -53,6 +53,7 @@

 (require 'notmuch-lib)
 (require 'notmuch-show)
+(require 'notmuch-maildir-fcc)

 (defcustom notmuch-search-authors-width 20
   "Number of columns to use to display authors in a notmuch-search buffer."
-- 
1.7.0.4



[PATCH] notmuch.el: Make notmuch-show buffer name first subject, instead of thread-id (supersedes V1--3)

2010-04-22 Thread Sebastian Spaeth
From: Jesse Rosenthal 

(Embarassing -- this should be the last fix.)

Change the buffer name to a uniquified subject of the thread (i.e. the
subject of the first message in the thread) instead of the thread-id. This
is more meaningful to the user, and will make it easier to scroll through
numerous open buffers.

Note that this patch adds an optional `buffer-name' argument to notmuch
show.

This version supersedes V1--3 of this patch. It is rebased on HEAD,
ensures that the buffer names are unique, and that the `notmuch-show'
command can still be used interactively (fixing embarassing bugs in V2
and V3 which prevented that)

Signed-off-by: Jesse Rosenthal 
---
 emacs/notmuch.el |   25 -
 1 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 439303a..4b93d8e 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -1178,7 +1178,7 @@ All currently available key bindings:
  (lambda()
(hl-line-mode 1) ))

-(defun notmuch-show (thread-id  parent-buffer query-context)
+(defun notmuch-show (thread-id  parent-buffer query-context 
buffer-name)
   "Run \"notmuch show\" with the given thread ID and display results.

 The optional PARENT-BUFFER is the notmuch-search buffer from
@@ -1186,9 +1186,14 @@ which this notmuch-show command was executed, (so that 
the next
 thread from that buffer can be show when done with this one).

 The optional QUERY-CONTEXT is a notmuch search term. Only messages from the 
thread
-matching this search term are shown if non-nil. "
+matching this search term are shown if non-nil.
+
+The optional BUFFER-NAME provides the neame of the buffer in 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 (concat "*notmuch-show-" thread-id "*"
+  (when (null buffer-name)
+(setq buffer-name (concat "*notmuch-" thread-id "*")))
+  (let* ((thread-buffer-name (generate-new-buffer-name buffer-name))
+(buffer (get-buffer-create thread-buffer-name)))
 (switch-to-buffer buffer)
 (notmuch-show-mode)
 (set (make-local-variable 'notmuch-show-parent-buffer) parent-buffer)
@@ -1383,9 +1388,19 @@ Complete list of currently available key bindings:
 (defun notmuch-search-show-thread ()
   "Display the currently selected thread."
   (interactive)
-  (let ((thread-id (notmuch-search-find-thread-id)))
+  (let ((thread-id (notmuch-search-find-thread-id))
+   (subject (notmuch-search-find-subject))
+   buffer-name)
+(when (string-match "^[ \t]*$" subject)
+  (setq subject "[No Subject]"))
+(setq buffer-name (concat "*"
+ (truncate-string-to-width subject 32 nil nil t)
+ "*"))
 (if (> (length thread-id) 0)
-   (notmuch-show thread-id (current-buffer) notmuch-search-query-string)
+   (notmuch-show thread-id
+ (current-buffer)
+ notmuch-search-query-string
+ buffer-name)
   (error "End of search results"

 (defun notmuch-search-reply-to-thread ()
-- 
1.6.3.3



[PATCH 1/6] Add elisp file for FCC to maildir solution

2010-04-22 Thread Sebastian Spaeth
From: Jesse Rosenthal 

File grabbed from http://jkr.acm.jhu.edu/jkr-maildir.el
but not integrated yet.

Signed-off-by: Sebastian Spaeth 
---
 emacs/notmuch-maildir-fcc.el |  115 ++
 1 files changed, 115 insertions(+), 0 deletions(-)
 create mode 100644 emacs/notmuch-maildir-fcc.el

diff --git a/emacs/notmuch-maildir-fcc.el b/emacs/notmuch-maildir-fcc.el
new file mode 100644
index 000..e7fddf1
--- /dev/null
+++ b/emacs/notmuch-maildir-fcc.el
@@ -0,0 +1,115 @@
+;; This file is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published
+;; by the Free Software Foundation; either version 2, or (at your
+;; option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING.  If not, write to the
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
+
+;; Commentary: 
+;;
+;; This is the beginning of a solution for storing sent mail in a
+;; maildir in emacs message mode, presented because some people might
+;; find it useful. It is *not* fully tested, it *may* overwrite files,
+;; and any directories you point this at may no longer be there
+;; afterwards. Use at your own risk.
+;;
+;; To use this as the fcc handler for message-mode, put
+;; one of the following in your init file:
+;; 
+;; if you want Fcc'd messages to be marked as read:
+;;
+;; (setq message-fcc-handler-function 
+;;  '(lambda (destdir) 
+;;  (jkr/maildir-write-buffer-to-maildir destdir t)))
+;;
+;; if you want Fcc'd messages to be marked as new:
+;;
+;; (setq message-fcc-handler-function 
+;;  '(lambda (destdir) 
+;;  (jkr/maildir-write-buffer-to-maildir destdir nil)))
+
+
+(defvar jkr/maildir-count 0)
+
+(defun jkr/maildir-host-fixer (hostname)
+  (replace-regexp-in-string "/\\|:"
+   '(lambda (s)
+(cond ((string-equal s "/") "\\057")
+  ((string-equal s ":") "\\072")
+  (t s)))
+   hostname
+   t
+   t))
+
+(defun jkr/maildir-make-uniq-maildir-id ()
+   (let* ((ct (current-time))
+ (timeid (+ (* (car ct) 65536) (cadr ct)))
+ (microseconds (caddr ct))
+ (hostname (jkr/maildir-host-fixer system-name)))
+ (setq jkr/maildir-count (+ jkr/maildir-count 1))
+ (format "%d.%d_%d_%d.%s"
+timeid
+(emacs-pid)
+microseconds
+jkr/maildir-count
+hostname)))
+
+(defun jkr/maildir-dir-is-maildir-p (dir)
+  (and (file-exists-p (concat dir "/cur/"))
+   (file-exists-p (concat dir "/new/"))
+   (file-exists-p (concat dir "/tmp/"
+
+(defun jkr/maildir-save-buffer-to-tmp (destdir)
+  "Returns the msg id of the message written to the temp directory
+if successful, nil if not."
+  (let ((msg-id (jkr/maildir-make-uniq-maildir-id)))
+(while (file-exists-p (concat destdir "/tmp/" msg-id))
+  (setq msg-id (jkr/maildir-make-uniq-maildir-id)))
+(cond ((jkr/maildir-dir-is-maildir-p destdir)
+  (write-file (concat destdir "/tmp/" msg-id))
+  msg-id)
+ (t
+  (message (format "Can't write to %s. Not a maildir."  
+destdir))
+  nil
+
+(defun jkr/maildir-move-tmp-to-new (destdir msg-id)
+  (add-name-to-file 
+   (concat destdir "/tmp/" msg-id)
+   (concat destdir "/new/" msg-id ":2,")))
+
+(defun jkr/maildir-move-tmp-to-cur (destdir msg-id  mark-seen)
+  (add-name-to-file 
+   (concat destdir "/tmp/" msg-id)
+   (concat destdir "/cur/" msg-id ":2," (when mark-seen "S"
+
+(defun jkr/maildir-write-buffer-to-maildir (destdir  mark-seen)
+  "Writes the current buffer to maildir destdir. If mark-seen is
+non-nil, it will write it to cur/, and mark it as read. It should
+return t if successful, and nil otherwise."
+  (let ((orig-buffer (buffer-name)))
+(with-temp-buffer 
+  (insert-buffer orig-buffer)
+  (catch 'link-error
+   (let ((msg-id (jkr/maildir-save-buffer-to-tmp destdir)))
+ (when msg-id
+   (cond (mark-seen
+  (condition-case err
+  (jkr/maildir-move-tmp-to-cur destdir msg-id t)
+(file-already-exists
+ (throw 'link-error nil
+ (t 
+  (condition-case err
+  (jkr/maildir-move-tmp-to-new destdir msg-id)
+(file-already-exists
+ (throw 'link-error nil))
+

[notmuch] Fcc, Maildir, and Emacs message-mode -- a bit of code

2010-04-22 Thread Sebastian Spaeth
As Carl stated that he would probably merge this one if someone tested
it, here it comes: I tested it and it works great. When I define a
non-existing directory as maildir it aborts with an error message that
is visible to the user.

I put this in a branch based on cworth/master and with Jesse's
permission, I renamed the functions and did some further cleanup (It's
also integrated in the build system)

The git branch is here:
http://github.com/spaetz/notmuch-all-feature/tree/feature/elisp-fcc

It's not enabled by default. Enable it with:

(setq message-fcc-handler-function 
  '(lambda (destdir) 
 (notmuch-maildir-fcc-write-buffer-to-maildir destdir t)))

(add-hook 'message-send-hook 
  '(lambda ()
 (message-add-header "Fcc: ~/mail/INBOX.Sent")))

in your .emacs for now.

I'll send the patch series by mail in a second.

I have the slight problem that offlineimap takes the message from
INBOX.Sent/cur and stuffs it in INBOX.Sent/new (but that cannot really
be related to this as the mail ends up correctly in /cur after sending
it).

Sebastian


sort order regression

2010-04-22 Thread Jesse Rosenthal
On Thu, 22 Apr 2010 10:21:11 -0400, Jesse Rosenthal  
wrote:
> My suggestion would be to revert both the simplification and the fix to
> enable the simplification to pass: (36e4459a3, 2a1a4f0551).

Sorry, got that slightly wrong. The following commits need to be
reverted:

36e4459a328b8449b3e9d510be81a332a9b35aaa
f43990ce134d838cdb2cdd5d0752a602e81cfdd9
7fb56f9dc5d8e66f717f5e48ecbfbc11c8190182

When I do this, search order is right, and all tests are passed.

Best,
Jesse


sort order regression

2010-04-22 Thread Jesse Rosenthal
On Thu, 22 Apr 2010 10:14:16 -0400, Jesse Rosenthal  
wrote:
> Just to follow up on this, it seems that the regression comes from the
> fix Carl introduced in 2a1a4f0551 to make his simplification of my patch
> (simplification = 36e4459a3 , my patch = 4971b85641) pass tests. The
> question is whether my original, more complicated version would have
> passed the tests without the regressing fix.

Okay, I just tested using the current test suite: my patch (4971b85641)
passes all tests, while Carl's simplification fails.

My suggestion would be to revert both the simplification and the fix to
enable the simplification to pass: (36e4459a3, 2a1a4f0551).

Should we send reverts as patches?

Best,
Jesse


sort order regression

2010-04-22 Thread Jesse Rosenthal
On Thu, 22 Apr 2010 16:06:27 +0200, Sebastian Spaeth  
wrote:
> 
> jkr and I noticed that patch series are shown in reverse order now, in
> fact threads seem to display messages at the same depth in reverse
> chronological order now.

Just to follow up on this, it seems that the regression comes from the
fix Carl introduced in 2a1a4f0551 to make his simplification of my patch
(simplification = 36e4459a3 , my patch = 4971b85641) pass tests. The
question is whether my original, more complicated version would have
passed the tests without the regressing fix. I do know that it showed
the search order as expected.

Unfortunately, I'm not quite skilled enough at git to turn back some
files to a certain state, tests to another state, and so on.

Best,
Jesse


problem with notmuch-search-authors-width in JSON emacs implementation

2010-04-22 Thread Jameson Rollins
On Thu, 22 Apr 2010 15:04:45 +0100, David Edmondson  wrote:
> Ah, when you set `notmuch-search-authors-width' the expression which
> creates `notmuch-search-result-format' is not re-evaluated.
> 
> Do things get better if you restart emacs (sorry for suggesting that)?

I can't see how that would help, because notmuch-search-result-format is
always going to be evaluated with the default value of
notmuch-search-authors-width, which is defined immediately previous to
it.

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/20100422/11397e56/attachment.pgp>


pull request

2010-04-22 Thread Servilio Afre Puentes
On 22 April 2010 08:30, David Edmondson  wrote:
> On Thu, 22 Apr 2010 04:58:16 -0400, Servilio Afre Puentes  gmail.com> wrote:
>> On 21 April 2010 17:03, Carl Worth  wrote:
>> > On Mon, 19 Apr 2010 09:27:39 +0100, David Edmondson  wrote:
>> [...]
>> > Meanwhile, another issue with the result of this series is that I now
>> > seem to get rendering for both the text/plain and the text/html
>> > alternatives when a message has both. For now, the paragraphs are
>> > wrapped much more nicely in the rendering of the html portion, but links
>> > are apparently entirely missing. The link URLs at least appear in the
>> > text/plain rendering, (which is pretty ugly, but at least not impossible
>> > to use).
>> >
>> > If we could get one version or the other working completely, then it
>> > would be nice to display only one.
>>
>> I think that a better approach here would be to list them as parts if
>> they are present, then have a [configurable] way to show only one by
>> default, and the other would be available to show in-line.
>
> Showing only one (with a variable allowing you to express preference) is
> my intention. Any non-shown parts will appear as attachments - you can
> save them using the button (and perhaps later view them).

Why not see them in-line if possible?

> This can make quite a big difference in a 200 message thread with lots
> of 'text/plain or text/html ?' choices - using the text/plain part will
> improve the performance of building the show buffer significantly.

Yes, it can make a big difference.

>> What I miss in this view sometimes is the possibility of being able to
>> see the structure of the thread. A way to toggle the expanded state of
>> the messages originally expanded when I first opened the view would do
>> this very nicely.
>
> Ah, so you want a "go back to how it was initially" command?

Yep, then bind it to a key that would alternate between collapsing all
messages and expanding the ones that were originally expanded.

Servilio


[PATCH] emacs: Add notmuch-address.el for address completion using notmuch

2010-04-22 Thread David Edmondson
A tool `notmuch-addresses' is required to produce addresses which
match a query string. An example of a suitable script can be found in
the git repository at
http://jkr.acm.jhu.edu/git/notmuch_addresses.git
There are no doubt others.
---
 emacs/Makefile.local |3 +-
 emacs/notmuch-address.el |   91 ++
 2 files changed, 93 insertions(+), 1 deletions(-)
 create mode 100644 emacs/notmuch-address.el

diff --git a/emacs/Makefile.local b/emacs/Makefile.local
index e5013b3..7537c3d 100644
--- a/emacs/Makefile.local
+++ b/emacs/Makefile.local
@@ -8,7 +8,8 @@ emacs_sources := \
$(dir)/notmuch-show.el \
$(dir)/notmuch-wash.el \
$(dir)/notmuch-hello.el \
-   $(dir)/notmuch-mua.el
+   $(dir)/notmuch-mua.el \
+   $(dir)/notmuch-address.el

 emacs_images := \
$(dir)/notmuch-logo.png
diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el
new file mode 100644
index 000..69a52a2
--- /dev/null
+++ b/emacs/notmuch-address.el
@@ -0,0 +1,91 @@
+;; notmuch-address.el --- address completion with notmuch
+;;
+;; Copyright ?? David Edmondson
+;;
+;; This file is part of Notmuch.
+;;
+;; Notmuch is free software: you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; Notmuch is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with Notmuch.  If not, see .
+;;
+;; Authors: David Edmondson 
+
+(require 'message)
+
+;;
+
+(defcustom notmuch-address-command "notmuch-addresses"
+  "The command which generates possible addresses. It must take a
+single argument and output a list of possible matches, one per
+line."
+  :type 'string
+  :group 'notmuch)
+
+(defvar notmuch-address-message-alist-member
+  
'("^\\(Resent-\\)?\\(To\\|B?Cc\\|Reply-To\\|From\\|Mail-Followup-To\\|Mail-Copies-To\\):"
+ . notmuch-address-expand-name))
+
+(defvar notmuch-address-history nil)
+
+(defun notmuch-address-message-insinuate ()
+  (if (not (memq notmuch-address-message-alist-member 
message-completion-alist))
+  (setq message-completion-alist
+   (push notmuch-address-message-alist-member 
message-completion-alist
+
+(defun notmuch-address-options (original)
+  (process-lines notmuch-address-command original))
+
+(defun notmuch-address-expand-name ()
+  (let* ((end (point))
+(beg (save-excursion
+   (re-search-backward "\\(\\`\\|[\n:,]\\)[ \t]*")
+   (goto-char (match-end 0))
+   (point)))
+(orig (buffer-substring-no-properties beg end))
+(completion-ignore-case t)
+(options (notmuch-address-options orig))
+(chosen (if (eq (length options) 1)
+(car options)
+  (completing-read "Address: " (cdr options) nil nil (car 
options)
+   'notmuch-address-history
+(when chosen
+  (push chosen notmuch-address-history)
+  (delete-region beg end)
+  (insert chosen
+
+;; Copied from `w3m-which-command'.
+(defun notmuch-address-locate-command (command)
+  "Return non-nil if `command' is an executable either on
+`exec-path' or an absolute pathname."
+  (when (stringp command)
+(if (and (file-name-absolute-p command)
+(file-executable-p command))
+   command
+  (setq command (file-name-nondirectory command))
+  (catch 'found-command
+   (let (bin)
+ (dolist (dir exec-path)
+   (setq bin (expand-file-name command dir))
+   (when (or (and (file-executable-p bin)
+  (not (file-directory-p bin)))
+ (and (file-executable-p (setq bin (concat bin ".exe")))
+  (not (file-directory-p bin
+ (throw 'found-command bin
+
+;; If we can find the program specified by `notmuch-address-command',
+;; insinuate ourselves into `message-mode'.
+(when (notmuch-address-locate-command notmuch-address-command)
+  (notmuch-address-message-insinuate))
+
+;;
+
+(provide 'notmuch-address)
-- 
1.7.0



[PATCH] emacs: Re-arrange message sending code

2010-04-22 Thread David Edmondson
Define a new `mail-user-agent' (`notmuch-user-agent') and use it by
default. Re-arrange various routines that send mail to use this
(compose, reply, forward). Insert a `User-Agent:' header by default.
---
 emacs/Makefile.local   |5 +-
 emacs/notmuch-hello.el |2 +
 emacs/notmuch-lib.el   |   16 ++
 emacs/notmuch-mua.el   |  133 
 emacs/notmuch-show.el  |8 ++--
 emacs/notmuch.el   |   20 ++-
 6 files changed, 163 insertions(+), 21 deletions(-)
 create mode 100644 emacs/notmuch-mua.el

diff --git a/emacs/Makefile.local b/emacs/Makefile.local
index 6486d90..e5013b3 100644
--- a/emacs/Makefile.local
+++ b/emacs/Makefile.local
@@ -6,8 +6,9 @@ emacs_sources := \
$(dir)/notmuch.el \
$(dir)/notmuch-query.el \
$(dir)/notmuch-show.el \
-   $(dir)/notmuch-wash.el
-   $(dir)/notmuch-hello.el
+   $(dir)/notmuch-wash.el \
+   $(dir)/notmuch-hello.el \
+   $(dir)/notmuch-mua.el

 emacs_images := \
$(dir)/notmuch-logo.png
diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 13de6f8..fa6433e 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -25,6 +25,7 @@

 (require 'notmuch-lib)
 (require 'notmuch)
+(require 'notmuch-mua)

 (declare-function notmuch-search "notmuch" (query  oldest-first 
target-thread target-line))
 (declare-function notmuch-folder-count "notmuch" (search))
@@ -335,6 +336,7 @@ diagonal."

   (use-local-map widget-keymap)
   (local-set-key "=" 'notmuch-hello-update)
+  (local-set-key "m" 'notmuch-mua-mail)
   (local-set-key "q" '(lambda () (interactive) (kill-buffer (current-buffer
   (local-set-key "s" 'notmuch-hello-goto-search)
   (local-set-key "v" '(lambda () (interactive)
diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index 274d7ec..47c74b9 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -33,6 +33,22 @@
   :type '(alist :key-type (string) :value-type (string))
   :group 'notmuch)

+;;
+
+(defun notmuch-version ()
+  "Return a string with the notmuch version number."
+  (let ((long-string
+;; Trim off the trailing newline.
+(substring (shell-command-to-string
+(concat notmuch-command " --version"))
+   0 -1)))
+(if (string-match "^notmuch\\( version\\)? \\(.*\\)$"
+ long-string)
+   (match-string 2 long-string)
+  "unknown")))
+
+;;
+
 ;; XXX: This should be a generic function in emacs somewhere, not
 ;; here.
 (defun point-invisible-p ()
diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
new file mode 100644
index 000..acb7dbf
--- /dev/null
+++ b/emacs/notmuch-mua.el
@@ -0,0 +1,133 @@
+;; notmuch-mua.el --- emacs style mail-user-agent
+;;
+;; Copyright ?? David Edmondson
+;;
+;; This file is part of Notmuch.
+;;
+;; Notmuch is free software: you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; Notmuch is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with Notmuch.  If not, see .
+;;
+;; Authors: David Edmondson 
+
+(require 'cl)
+(require 'message)
+
+(require 'notmuch-lib)
+
+;;
+
+(defcustom notmuch-mua-send-hook '(notmuch-mua-message-send-hook)
+  "Hook run before sending messages."
+  :group 'notmuch
+  :type 'hook)
+
+(defcustom notmuch-mua-user-agent-function 'notmuch-mua-user-agent-full
+  "Function used to generate a `User-Agent:' string. If this is
+`nil' then no `User-Agent:' will be generated."
+  :group 'notmuch
+  :type 'function
+  :options '(notmuch-mua-user-agent-full
+notmuch-mua-user-agent-notmuch
+notmuch-mua-user-agent-emacs))
+
+;;
+
+(defun notmuch-mua-user-agent-full ()
+  "Generate a `User-Agent:' string suitable for notmuch."
+  (concat (notmuch-mua-user-agent-notmuch)
+ " "
+ (notmuch-mua-user-agent-emacs)))
+
+(defun notmuch-mua-user-agent-notmuch ()
+  "Generate a `User-Agent:' string suitable for notmuch."
+  (concat "Notmuch/" (notmuch-version) " (http://notmuchmail.org)"))
+
+(defun notmuch-mua-user-agent-emacs ()
+  "Generate a `User-Agent:' string suitable for notmuch."
+  (concat "Emacs/" emacs-version " (" system-configuration ")"))
+
+(defun notmuch-mua-reply (query-string)
+  (let (headers body)
+;; This make assumptions about the output of `notmuch reply', but
+;; really only that the headers come first followed by a blank
+;; line and then the body.
+(with-temp-buffer
+  (call-process notmuch-command nil t nil "reply" query-string)
+  (goto-char (point-min))
+  

[PATCH] json: Replace `date_unix' with `timestamp' in show output

2010-04-22 Thread David Edmondson
On Fri, 16 Apr 2010 12:47:49 +0100, David Edmondson  wrote:
> Search output was already using `timestamp' for a very similar field,
> so follow that.

Carl, this seems low-risk and easy to include for 0.3.

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


[PATCH] json: Replace `date_unix' with `timestamp' in show output

2010-04-22 Thread David Edmondson
Search output was already using `timestamp' for a very similar field,
so follow that.
---
 notmuch-show.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/notmuch-show.c b/notmuch-show.c
index 76873a1..26449fa 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -145,7 +145,7 @@ format_message_json (const void *ctx, notmuch_message_t 
*message, unused (int in
 date = notmuch_message_get_date (message);
 relative_date = notmuch_time_relative_date (ctx, date);

-printf ("\"id\": %s, \"match\": %s, \"filename\": %s, \"date_unix\": %ld, 
\"date_relative\": \"%s\", \"tags\": [",
+printf ("\"id\": %s, \"match\": %s, \"filename\": %s, \"timestamp\": %ld, 
\"date_relative\": \"%s\", \"tags\": [",
json_quote_str (ctx_quote, notmuch_message_get_message_id 
(message)),
notmuch_message_get_flag (message, NOTMUCH_MESSAGE_FLAG_MATCH) ? 
"true" : "false",
json_quote_str (ctx_quote, notmuch_message_get_filename (message)),
-- 
1.7.0



[PATCH] emacs: Add notmuch-hello.el, a friendly frontend to notmuch

2010-04-22 Thread David Edmondson
---
 emacs/Makefile.local   |5 +
 emacs/notmuch-hello.el |  359 
 emacs/notmuch-lib.el   |9 ++
 emacs/notmuch-logo.png |  Bin 0 -> 1671 bytes
 emacs/notmuch.el   |   28 +++--
 5 files changed, 390 insertions(+), 11 deletions(-)
 create mode 100644 emacs/notmuch-hello.el
 create mode 100644 emacs/notmuch-logo.png

diff --git a/emacs/Makefile.local b/emacs/Makefile.local
index f759c0d..6486d90 100644
--- a/emacs/Makefile.local
+++ b/emacs/Makefile.local
@@ -7,6 +7,10 @@ emacs_sources := \
$(dir)/notmuch-query.el \
$(dir)/notmuch-show.el \
$(dir)/notmuch-wash.el
+   $(dir)/notmuch-hello.el
+
+emacs_images := \
+   $(dir)/notmuch-logo.png

 emacs_bytecode := $(subst .el,.elc,$(emacs_sources))

@@ -26,5 +30,6 @@ install-emacs:
 ifeq ($(HAVE_EMACS),1)
install -m0644 $(emacs_bytecode) $(DESTDIR)$(emacslispdir)
 endif
+   install -m0644 $(emacs_images) $(DESTDIR)$(emacslispdir)

 CLEAN := $(CLEAN) $(emacs_bytecode)
diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
new file mode 100644
index 000..13de6f8
--- /dev/null
+++ b/emacs/notmuch-hello.el
@@ -0,0 +1,359 @@
+;; notmuch-hello.el --- welcome to notmuch, a frontend
+;;
+;; Copyright ?? David Edmondson
+;;
+;; This file is part of Notmuch.
+;;
+;; Notmuch is free software: you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; Notmuch is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with Notmuch.  If not, see .
+;;
+;; Authors: David Edmondson 
+
+(require 'widget)
+(require 'wid-edit) ; For `widget-forward'.
+(require 'cl)
+
+(require 'notmuch-lib)
+(require 'notmuch)
+
+(declare-function notmuch-search "notmuch" (query  oldest-first 
target-thread target-line))
+(declare-function notmuch-folder-count "notmuch" (search))
+
+(defcustom notmuch-hello-recent-searches-max 10
+  "The number of recent searches to store and display."
+  :type 'integer
+  :group 'notmuch)
+
+(defcustom notmuch-hello-show-empty-saved-searches nil
+  "Should saved searches with no messages be listed?"
+  :type 'boolean
+  :group 'notmuch)
+
+(defcustom notmuch-hello-indent 4
+  "How much to indent non-headers."
+  :type 'integer
+  :group 'notmuch)
+
+(defcustom notmuch-hello-saved-searches notmuch-folders
+  "A list of saved searches to display."
+  :type '(alist :key-type string :value-type string)
+  :group 'notmuch)
+
+(defcustom notmuch-hello-show-logo t
+  "Should the notmuch logo be shown?"
+  :type 'boolean
+  :group 'notmuch)
+
+(defcustom notmuch-hello-logo-background "#5f5f5f"
+  "Background colour for the notmuch logo."
+  :type 'color
+  :group 'notmuch)
+
+(defcustom notmuch-hello-jump-to-search nil
+  "Whether `notmuch-hello' should always jump to the search
+field."
+  :type 'boolean
+  :group 'notmuch)
+
+(defvar notmuch-hello-url "http://notmuchmail.org;
+  "The `notmuch' web site.")
+
+(defvar notmuch-hello-recent-searches nil)
+
+(defun notmuch-hello-remember-search (search)
+  (if (not (memq search notmuch-hello-recent-searches))
+  (push search notmuch-hello-recent-searches))
+  (if (> (length notmuch-hello-recent-searches)
+notmuch-hello-recent-searches-max)
+  (setq notmuch-hello-recent-searches (butlast 
notmuch-hello-recent-searches
+
+(defun notmuch-hello-trim (search)
+  "Trim whitespace."
+  (if (string-match "^[[:space:]]*\\(.*[^[:space:]]\\)[[:space:]]*$" search)
+  (match-string 1 search)
+search))
+
+(defun notmuch-hello-search (search)
+  (let ((search (notmuch-hello-trim search)))
+(notmuch-hello-remember-search search)
+(notmuch-search search notmuch-search-oldest-first nil nil 
#'notmuch-hello-search-continuation)))
+
+(defun notmuch-hello-add-saved-search (widget)
+  (interactive)
+  (let ((search (widget-value
+(symbol-value
+ (widget-get widget :notmuch-saved-search-widget
+   (name (completing-read "Name for saved search: "
+  notmuch-hello-saved-searches)))
+;; If an existing saved search with this name exists, remove it.
+(setq notmuch-hello-saved-searches
+ (loop for elem in notmuch-hello-saved-searches
+   if (not (equal name
+  (car elem)))
+   collect elem))
+;; Add the new one.
+(customize-save-variable 'notmuch-hello-saved-searches
+(push (cons name search)
+  notmuch-hello-saved-searches))
+(message "Saved '%s' as 

[PATCH] emacs/notmuch-show.el: Add `notmuch-show-toggle-all' bound to M-RET

2010-04-22 Thread David Edmondson
`notmuch-show-toggle-all' changes the visibility all of the messages
in the current thread. By default it makes all of the messages
visible. With a prefix argument, it makes them all not visible.
---
 emacs/notmuch-show.el |   13 +
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 916b39e..9775fb4 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -526,6 +526,7 @@ function is used. "
(define-key map "p" 'notmuch-show-previous-open-message)
(define-key map (kbd "DEL") 'notmuch-show-rewind)
(define-key map " " 'notmuch-show-advance-and-archive)
+   (define-key map (kbd "M-RET") 'notmuch-show-toggle-all)
(define-key map (kbd "RET") 'notmuch-show-toggle-message)
map)
   "Keymap for \"notmuch show\" buffers.")
@@ -900,6 +901,18 @@ to stdout or stderr will appear in the *Messages* buffer."
  (not (plist-get props :message-visible
   (force-window-update))

+(defun notmuch-show-toggle-all ()
+  "Change the visibility all of the messages in the current
+thread. By default make all of the messages visible. With a
+prefix argument, make them all not visible."
+  (interactive)
+  (save-excursion
+(goto-char (point-min))
+(loop do (notmuch-show-message-visible 
(notmuch-show-get-message-properties)
+  (not current-prefix-arg))
+ until (not (notmuch-show-goto-message-next
+  (force-window-update))
+
 (defun notmuch-show-next-button ()
   "Advance point to the next button in the buffer."
   (interactive)
-- 
1.7.0



problem with notmuch-search-authors-width in JSON emacs implementation

2010-04-22 Thread Jameson Rollins
On Thu, 22 Apr 2010 08:52:59 +0100, David Edmondson  wrote:
> On Thu, 22 Apr 2010 00:37:25 -0400, Jameson Rollins  finestructure.net> wrote:
> > On Wed, 21 Apr 2010 19:09:35 -0400, Jameson Rollins  > finestructure.net> wrote:
> > > Hey, folks.  I just build from Carl's HEAD which includes the new emacs
> > > JSON interface and I'm noticing a problem with the
> > > notmuch-search-authors-width variable.  If I set the variable as
> > > follows:
> > > 
> > > (setq notmuch-search-authors-width 40)
> > > 
> > > author lists that overrun the specified width start spitting out into
> > > the subject field.  I think bremner just confirmed this on irc.  I'll
> > > try to look into this when I get a chance, but I don't have time right
> > > now.  Maybe someone with more intimate knowledge of this piece of code
> > > could figure it out more quickly.
> 
> I thought that I had this fixed up properly. Sorry for the breakage.

No worries.

> Can you show any explicit settings you have for
> `notmuch-search-authors-width' and `notmuch-search-result-format'? Where
> do you set them?

Changing notmuch-search-authors-width to anything longer than 20 (which
is the default set internally) causes the problem (I had it set to 40
when I first noticed).  It's very easy to test.  You can
notmuch-search-authors-width on the fly from the configuration manager
and see the result.  I have not modified notmuch-search-result-format.
See my previous email on tracking down the issue.

Thanks for the help.

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/20100422/9bec72c1/attachment.pgp>


[PATCH 1/2] Add 'cat' subcommand

2010-04-22 Thread Michal Sojka
On Thu, 22 Apr 2010, Anthony Towns wrote:
> On Thu, Apr 22, 2010 at 12:37, Dirk Hohndel  wrote:
> > On Wed, 21 Apr 2010 17:44:03 -0700, Carl Worth  wrote:
> >> So I'd prefer to have this command behave just like all others and use
> >> the same naming.
> >> ? ? ? filename:/complete/path/to/file
> 
> Would "notmuch cat" be any different to "notmuch show" in this case?
> What happens if you say "notmuch cat something" and multiple messages
> match (eg, an id: for a mail that you both sent (Mail/.sent/cur/12345)
> and received (Mail/.Lists.notmuch/cur/12346))?
> 
> Maybe notmuch show should be able to deal with all these things, and
> notmuch cat could be an alias for something like:
> 
> notmuch show --format=mbox --show-duplicate-files $SPEC

I think this was discussed earlier with part subcommand and the result
was that "part" should become a part of show. The same probably applies
to the cat subcommand.

I don't think that --format=mbox is the right thing to do. A simple

grep -R '^From[^:]' ~/mail

shows that I have many messages where "From" is present in the body at
the beginning of the line so it would have to be escaped and all the
tools dealing with this output need to de-escape it.

I think that --format=raw is better and this command should fail if the
query produces more than one message.

> Otherwise, wouldn't you be better off just having this be something
> for the database::path setting in .notmuch-config? So you say:
> 
>[database]
>path=/home/aj/Mail
> 
> or
> 
>[database]
>path=/home/aj/Mail/.git
>format=git

This is something similar to what I have implemented in
id:1270737766-29237-1-git-send-email-sojkam1 at fel.cvut.cz. Carl doesn't
want to merge it in its current form so I'm extracting some features
from it and sending them separately.

-Michal


problem with notmuch-search-authors-width in JSON emacs implementation

2010-04-22 Thread David Edmondson
On Thu, 22 Apr 2010 00:37:25 -0400, Jameson Rollins  wrote:
> On Wed, 21 Apr 2010 19:09:35 -0400, Jameson Rollins  finestructure.net> wrote:
> > Hey, folks.  I just build from Carl's HEAD which includes the new emacs
> > JSON interface and I'm noticing a problem with the
> > notmuch-search-authors-width variable.  If I set the variable as
> > follows:
> > 
> > (setq notmuch-search-authors-width 40)
> > 
> > author lists that overrun the specified width start spitting out into
> > the subject field.  I think bremner just confirmed this on irc.  I'll
> > try to look into this when I get a chance, but I don't have time right
> > now.  Maybe someone with more intimate knowledge of this piece of code
> > could figure it out more quickly.

I thought that I had this fixed up properly. Sorry for the breakage.

Can you show any explicit settings you have for
`notmuch-search-authors-width' and `notmuch-search-result-format'? Where
do you set them?

The intention was that if you just want a wider display of authors you
set `notmuch-search-authors-width' (which has existed for some time) and
`notmuch-search-result-format' adapts accordingly.

Admittedly, this doesn't cope well if you modify
`notmuch-search-result-format' without also updating
`notmuch-search-authors-width'. Some more thought required...

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


[PATCH 1/2] Add 'cat' subcommand

2010-04-22 Thread Michal Sojka
On Thu, 22 Apr 2010, Carl Worth wrote:
> On Tue, 20 Apr 2010 12:14:56 +0200, Michal Sojka  
> wrote:
> > On 20.4.2010 09:21, David Edmondson wrote:
> >  > I'm puzzled why you chose to pass a filename as the argument to 'cat'
> >  > rather than a message id (id:foo at bar.com)?
> > 
> > The reason is that I want be able to distinguish between several 
> > messages with the same id.
> 
> All other commands currently accept the generic search terms to specify
> messages, (even a command like "notmuch reply" for which it would have
> been natural to accept only a single message).
> 
> So I'd prefer to have this command behave just like all others and use
> the same naming.
> 
> The question of how to unambiguously refer to a single file is
> orthogonal, (and similarly applies to all commands, such as "notmuch
> tag" etc.). I would recommend supporting a search syntax something like:
> 
>   filename:/complete/path/to/file
> 
> for that use case. And this should work fine whether the filenames are
> actual filenames or keys into some abstract file store of some sort.
> 
> What do you think?

It sounds reasonable. I looked at the code to see how this could be
implemented and I have a few questions:

If a filename:dir/file term is present in the query, it will be
necessary to first query the database for directory:dir to find the
 and then put in the query
file-direntry::file. This conversion is already
implemented in _notmuch_database_filename_to_direntry(). Right?

_notmuch_database_filename_to_direntry() requires writable database as
it creates the directory document if it doesn't exist. This is probably
not what we want for filename: queries - if the user types the filename
incorrectly, the nonexisting directory document could be added to the
database. So I think that _notmuch_database_find_directory_id() should
be modified to not modify the database. The directory documents should
be created somewhere else in notmuch new path. Do you agree?

-Michal


pull request

2010-04-22 Thread David Edmondson
On Wed, 21 Apr 2010 14:03:03 -0700, Carl Worth  wrote:
> > commit 2b6201fbf9209a875f216d48c30b95a6f583c575
> > 
> > emacs: Add more functions to clean up text/plain parts
> > 
> > Add:
> > - notmuch-wash-wrap-long-lines: Wrap lines longer than the width of
> >   the current window whilst maintaining any citation prefix.
> > - notmuch-wash-tidy-citations: Tidy up citations by:
> >   - compress repeated otherwise blank citation lines,
> >   - remove otherwise blank citation lines at the head and tail of a
> > citation and remove blank lines between attribution statements and
> > the citation,
> > - notmuch-wash-compress-blanks: Compress repeated blank lines and
> >   remove leading and trailing blank lines.
> 
> I did not push this one. I think this munges messages too much to be on
> by default.

Your concerns appear to be about `notmuch-wash-wrap-long-lines'. I agree
that it can generate unfortunate results in the "deep thread, narrow
terminal" case. Are the other two functions okay?

One of the reasons that I chose a hook-based approach is to allow the
user to decide which body cleaning should be applied. If you don't want
the line-wrapping to be enabled by default we can leave it out but
include the definition so that a user can enable it. The inline-patch
formatting is similar (I'll say more about that in response to your
comments on it).

> Dealing with broken messages that have entire paragraphs unwrapped is a
> separate issue from displaying correct messages nicely. I'd like to make
> correct messages work well first, and then worry about the broken
> messages. (For those, I'm much more willing to accept munged display of
> the message.)

Enabling `notmuch-wash-tidy-citations' and
`notmuch-wash-compress-blanks' by default would fit with this policy, I
think.

Then again, including the functions in the code but enabling none of
them by default would also be acceptable (I already enable them all and
have another function that is not shared).

> > commit 9e193a3998b7503e35d21013c71cc4ecaf6c9d50
> > 
> > emacs/notmuch-wash.el: Add `notmuch-wash-inline-patch'
> 
> The commit message for this one was enough to make me skip it for now:
> 
> > Due to the scope for error in detecting inline patches (and their
> > extent), this function is not enabled by default.
> 
> For this entire series it would be very nice to have some emacs-based
> testing in the test suite. And for a patch like this with heuristics
> that are known to not be perfect, I think it's essential to have that
> testing in place first.

Testing for Emacs is something that I'm looking into. There doesn't seem
to be a de-facto best framework.

Aside from the need to test, this particular patch will benefit only
minimally from testing - there will always be false positive cases
however good the analysis used. Are you saying that we can not tolerate
any false-positives, or that we just need to demonstrate that it is down
to some acceptable level? (Though I've no idea how I would achieve the
latter.)

> > commit 444de7e73d988cab9b8d1fef851c8ad26174a996
> > 
> > emacs/notmuch-show.el: Part headers are real buttons that save the part
> 
> Pushed. This is a delightful improvement to our handling of attachments.
> 
> I'd like the text on the button to give some more instruction, such as:
> 
>   "Click or press Enter to save."
> 
> And if we could pull it off, (I don't know how flexible the button
> widget is in emacs), it would be nice to have something like this as
> well:
> 
>   "Or press V to view."
> 
> so that one could easily use an external viewer for a single attachment.

Agreed. There are a bunch of enhancements that I'd like to make here,
including toggling the visibility of part, viewing in another buffer,
view externally, force the type, etc.

> Meanwhile, another issue with the result of this series is that I now
> seem to get rendering for both the text/plain and the text/html
> alternatives when a message has both.

This is a consequence of `notmuch show' squashing the MIME details in
the message before output. In particular most messages which include
both text/plain and text/html parts are declared as
multipart/alternative, but the UI never gets to see that detail. Work on
improving that is happening (slowly) at:
http://github.com/dme/notmuch/tree/multipart
(please don't start using this - the JSON output is mostly-okay, but
text output is broken and the Emacs code is incomplete!)

multipart/alternative suppor would fix this. multipart/related is
necessary for displaying HTML with inline images that are part of the
message ('cid:' images). multipart/signed and multipart/encrypted are
necessary for PGP (and others). If `notmuch' can be persuaded to include
the structure in the JSON output then I think that the Emacs code is in
reasonable shape to be extended to display things well.

> For now, the paragraphs are wrapped much more nicely in the 

[PATCH] emacs: Add notmuch-address.el for address completion using notmuch

2010-04-22 Thread Dirk Hohndel
On Thu, 22 Apr 2010 10:03:43 +0100, David Edmondson  wrote:
> A tool `notmuch-addresses' is required to produce addresses which
> match a query string. An example of a suitable script can be found in
> the git repository at
> http://jkr.acm.jhu.edu/git/notmuch_addresses.git
> There are no doubt others.

+1 on getting this into 0.3

/D

-- 
Dirk Hohndel
Intel Open Source Technology Center


Notmuch success: Xapian database corrupt

2010-04-22 Thread John Fremlin
After the encouraging message from Sebastian. I deleted the
.notmuch/xapian dir and started again.

It went off a good rate (300+ files/sec) and here was the final score

Processed 494764 total files in 2h 54m 41s (47 files/sec.). 
Added 226817 new messages to the database.

This is much faster than before. As I haven't changed the storage or the
filesystem (ext4,data=ordered over encrypted aes-xts-plain), I just
don't know what made the difference. My kernel is now 2.6.32-21-generic
#32-Ubuntu and I had an older one the first try a month or so ago.

Carl Worth  writes:
[...]
> Welcome to notmuch, and I'm so sorry to hear that your initial attempt
> to use it was so frustrating.

Thanks for the welcome! I was initially impressed by it but rather
worried about relying on it after the database corruption.

> I'm not aware of any bugs in notmuch that can result in a corrupt Xapian
> database. In fact, this can't be a bug in notmuch alone (since Xapian is
> detecting the corruption). There must at least be a bug in Xapian or
> else some lower-level failure is occurring (disk full?) that Xapian
> can't deal with.

Disk full is quite likely. I'll try to avoid that in future.

[...]
> So there's some performance problem that you're having in addition to
> the database corruption. Hopefully we can figure that out. What kernel
> and filesystem are you using? Are you using an encrypted partition?

Happy to say (though frustrating for you), this time it's much
faster. Maybe because I had more disk free this time round so the Xapian
database became less fragmented? (Speculation, no evidence.) 


pull request

2010-04-22 Thread David Edmondson
On Wed, 21 Apr 2010 12:15:48 -0700, Carl Worth  wrote:
> Sure. Hiding a message with 'b' is visually identical to hiding it with
> RET.

That's not quite true. `b' will (would) hide only the body. If the
header is visible `b' will not hide it.

> Except that the internal mechanism is distinct, so that afterwards one
> can't make it visible again with RET.

The internal mechanism is distinct because it does a different
thing. The original code drew a distinction between header visibility,
body visibility and message-as-a-whole visibility. I agree that visually
there is no difference between 'header and body hidden' and 'message
hidden'. It's possible to have only the header visible, which I've yet
to find a use for. The code works as I intended, though I'd agree that
may not be the desired behaviour :-)

Given that I've never used `b' other than in testing, I'm not worried
about it going away.

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


pull request

2010-04-22 Thread Servilio Afre Puentes
On 21 April 2010 17:03, Carl Worth  wrote:
> On Mon, 19 Apr 2010 09:27:39 +0100, David Edmondson  wrote:
[...]
> Meanwhile, another issue with the result of this series is that I now
> seem to get rendering for both the text/plain and the text/html
> alternatives when a message has both. For now, the paragraphs are
> wrapped much more nicely in the rendering of the html portion, but links
> are apparently entirely missing. The link URLs at least appear in the
> text/plain rendering, (which is pretty ugly, but at least not impossible
> to use).
>
> If we could get one version or the other working completely, then it
> would be nice to display only one.

I think that a better approach here would be to list them as parts if
they are present, then have a [configurable] way to show only one by
default, and the other would be available to show in-line.

[...]
>> commit e9d737feb5a49fd59e1f27bccd24cac2fd1ef749
>>
>> ? ? emacs/notmuch-show.el: Add `notmuch-show-toggle-all' bound to M-RET
>>
>> ? ? `notmuch-show-toggle-all' changes the visibility all of the messages
>> ? ? in the current thread. By default it makes all of the messages not
>> ? ? visible. With a prefix argument, it makes them all visible.
>
> I didn't push this one yet.
>
> The feature is *almost* what I want. It's just that I often want to open
> all messages in a thread, (and I've never found myself wanting to close
> all messages). So I'd like to switch which behavior requires the prefix
> argument here.

What I miss in this view sometimes is the possibility of being able to
see the structure of the thread. A way to toggle the expanded state of
the messages originally expanded when I first opened the view would do
this very nicely.

[...]
> [Aside: We could improve our help screen by making RET on any line then
> bring up the full help message for that function.]

+1

>> commit b3be927b54956a7258f203159e0bdb954e686c80
>>
>> ? ? emacs: Support for customizing search result display
>
> Finally, this is pushed. It's a quite lovely feature that's quite easy
> to take advantage of from "M-x customize-group" "notmuch".
>
> Anyone, if you haven't tried that mode yet for customizing notmuch, you
> should give it a try. (And we should add some hint somewhere to make it
> easier to find. Perhaps a keybinding to get to the customization
> buffer.)

The help screen is a very good place to place a link to the
customization screen.

Servilio


[PATCH] Add 'd'elete keybinding to search and show views

2010-04-22 Thread Jameson Rollins
On Wed, 21 Apr 2010 17:20:41 -0700, Dirk Hohndel  
wrote:
> Well, that would take away a big reason for adding this -
> convenience. In the end it's user experience design. The question is
> (based on expected behavior) - do you expect a deleted email to stay
> visible in your inbox. I don't - and I know that many people do.

I actually have my default "inbox" set to be the search "tag:inbox and
not tag:delete", so it's true that in general I don't usually want to
see the deleted messages.  However, I think the right solution is to
have the default view be "inbox and not deleted", instead of using the
delete key to remove inbox tags.  I just feel like I want to have
fine-grained control over tagging.  By the same token, I don't want
hitting the space bar to archive messages when all I really want to do
is advance to the next message.

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/20100422/02dcc175/attachment.pgp>


problem with notmuch-search-authors-width in JSON emacs implementation

2010-04-22 Thread Jameson Rollins
On Wed, 21 Apr 2010 19:09:35 -0400, Jameson Rollins  wrote:
> Hey, folks.  I just build from Carl's HEAD which includes the new emacs
> JSON interface and I'm noticing a problem with the
> notmuch-search-authors-width variable.  If I set the variable as
> follows:
> 
> (setq notmuch-search-authors-width 40)
> 
> author lists that overrun the specified width start spitting out into
> the subject field.  I think bremner just confirmed this on irc.  I'll
> try to look into this when I get a chance, but I don't have time right
> now.  Maybe someone with more intimate knowledge of this piece of code
> could figure it out more quickly.

So I think I see what might be happening here, but I don't know elisp
well enough to fix it.  Maybe one of the elisp experts out there can
help me figure it out.

notmuch-search-authors-width is actually called three times in
notmuch.el:

0 servo:~/src/notmuch/git [master] $ grep -nH notmuch-search-authors-width 
emacs/*
emacs/notmuch.el:57:(defcustom notmuch-search-authors-width 20
emacs/notmuch.el:65:("authors" . ,(format "%%-%ds " 
notmuch-search-authors-width))
emacs/notmuch.el:626: (if (> authors-length 
notmuch-search-authors-width)
emacs/notmuch.el:627: (set 'authors (concat (substring 
authors 0 (- notmuch-search-authors-width 3)) "...")))
0 servo:~/src/notmuch/git [master] $ 

The first call is inside the defcustom definition for
notmuch-search-result-format.  The second two are in the
notmuch-search-process-filter function.  It's pretty clear from the
behavior that setting notmuch-search-authors-width, either with setq or
with "Customize Options", affects what is returned in
notmuch-search-process-filter, but *not* in the defcustom for
notmuch-search-result-format.  I guess what's happening is that the
value used in the defcustom definition of notmuch-search-result-format
is set when the defcustom is defined, and isn't changed later with the
new user-set value.

Do any elisp experts out there know any way out of this?  Is there a way
to escape the expansion of the variable used in
notmuch-search-result-format until it is actually called?

I guess we're using notmuch-search-authors-width to "nicely" truncate
the author list and add the "..." at the end.  We could just straight
truncate the authors field with something like '%-.40s', I think, which
would make the code a little simpler, but might not be as nice.

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/20100422/6b0f5ebf/attachment-0001.pgp>


Re: pull request

2010-04-22 Thread David Edmondson
On Wed, 21 Apr 2010 12:15:48 -0700, Carl Worth cwo...@cworth.org wrote:
 Sure. Hiding a message with 'b' is visually identical to hiding it with
 RET.

That's not quite true. `b' will (would) hide only the body. If the
header is visible `b' will not hide it.

 Except that the internal mechanism is distinct, so that afterwards one
 can't make it visible again with RET.

The internal mechanism is distinct because it does a different
thing. The original code drew a distinction between header visibility,
body visibility and message-as-a-whole visibility. I agree that visually
there is no difference between 'header and body hidden' and 'message
hidden'. It's possible to have only the header visible, which I've yet
to find a use for. The code works as I intended, though I'd agree that
may not be the desired behaviour :-)

Given that I've never used `b' other than in testing, I'm not worried
about it going away.

dme.
-- 
David Edmondson, http://dme.org
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: Update on 0.3 progress

2010-04-22 Thread Jesse Rosenthal
On Wed, 21 Apr 2010 18:11:14 -0700, Carl Worth cwo...@cworth.org wrote:
 Most of what came in in response to this request has now been merged.
 Notable things that made the merge window but have not been merged yet
 include...

Hi Carl,

Just wanted to call one more thing to your attention: the patch covering
the regression in argument-quoting to enable remote usage
( id:m14oj4qz5r@watt.gilman.jhu.edu ).

The code in notmuch-show changed somewhat, so I elected to rewrite this
rather trivial patch froms scratch.

Thanks for the updates.

All best,
Jesse
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 1/2] Add 'cat' subcommand

2010-04-22 Thread Michal Sojka
On Thu, 22 Apr 2010, Carl Worth wrote:
 On Tue, 20 Apr 2010 12:14:56 +0200, Michal Sojka sojk...@fel.cvut.cz wrote:
  On 20.4.2010 09:21, David Edmondson wrote:
I'm puzzled why you chose to pass a filename as the argument to 'cat'
rather than a message id (id:f...@bar.com)?
  
  The reason is that I want be able to distinguish between several 
  messages with the same id.
 
 All other commands currently accept the generic search terms to specify
 messages, (even a command like notmuch reply for which it would have
 been natural to accept only a single message).
 
 So I'd prefer to have this command behave just like all others and use
 the same naming.
 
 The question of how to unambiguously refer to a single file is
 orthogonal, (and similarly applies to all commands, such as notmuch
 tag etc.). I would recommend supporting a search syntax something like:
 
   filename:/complete/path/to/file
 
 for that use case. And this should work fine whether the filenames are
 actual filenames or keys into some abstract file store of some sort.
 
 What do you think?

It sounds reasonable. I looked at the code to see how this could be
implemented and I have a few questions:

If a filename:dir/file term is present in the query, it will be
necessary to first query the database for directory:dir to find the
directory_ID and then put in the query
file-direntry:directory_ID:file. This conversion is already
implemented in _notmuch_database_filename_to_direntry(). Right?

_notmuch_database_filename_to_direntry() requires writable database as
it creates the directory document if it doesn't exist. This is probably
not what we want for filename: queries - if the user types the filename
incorrectly, the nonexisting directory document could be added to the
database. So I think that _notmuch_database_find_directory_id() should
be modified to not modify the database. The directory documents should
be created somewhere else in notmuch new path. Do you agree?

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


Re: [PATCH 1/2] Add 'cat' subcommand

2010-04-22 Thread Michal Sojka
On Thu, 22 Apr 2010, Anthony Towns wrote:
 On Thu, Apr 22, 2010 at 12:37, Dirk Hohndel hohn...@infradead.org wrote:
  On Wed, 21 Apr 2010 17:44:03 -0700, Carl Worth cwo...@cworth.org wrote:
  So I'd prefer to have this command behave just like all others and use
  the same naming.
        filename:/complete/path/to/file
 
 Would notmuch cat be any different to notmuch show in this case?
 What happens if you say notmuch cat something and multiple messages
 match (eg, an id: for a mail that you both sent (Mail/.sent/cur/12345)
 and received (Mail/.Lists.notmuch/cur/12346))?
 
 Maybe notmuch show should be able to deal with all these things, and
 notmuch cat could be an alias for something like:
 
 notmuch show --format=mbox --show-duplicate-files $SPEC

I think this was discussed earlier with part subcommand and the result
was that part should become a part of show. The same probably applies
to the cat subcommand.

I don't think that --format=mbox is the right thing to do. A simple

grep -R '^From[^:]' ~/mail

shows that I have many messages where From is present in the body at
the beginning of the line so it would have to be escaped and all the
tools dealing with this output need to de-escape it.

I think that --format=raw is better and this command should fail if the
query produces more than one message.

 Otherwise, wouldn't you be better off just having this be something
 for the database::path setting in .notmuch-config? So you say:
 
[database]
path=/home/aj/Mail
 
 or
 
[database]
path=/home/aj/Mail/.git
format=git

This is something similar to what I have implemented in
id:1270737766-29237-1-git-send-email-sojk...@fel.cvut.cz. Carl doesn't
want to merge it in its current form so I'm extracting some features
from it and sending them separately.

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


Re: pull request

2010-04-22 Thread David Edmondson
On Wed, 21 Apr 2010 14:03:03 -0700, Carl Worth cwo...@cworth.org wrote:
  commit 2b6201fbf9209a875f216d48c30b95a6f583c575
  
  emacs: Add more functions to clean up text/plain parts
  
  Add:
  - notmuch-wash-wrap-long-lines: Wrap lines longer than the width of
the current window whilst maintaining any citation prefix.
  - notmuch-wash-tidy-citations: Tidy up citations by:
- compress repeated otherwise blank citation lines,
- remove otherwise blank citation lines at the head and tail of a
  citation and remove blank lines between attribution statements and
  the citation,
  - notmuch-wash-compress-blanks: Compress repeated blank lines and
remove leading and trailing blank lines.
 
 I did not push this one. I think this munges messages too much to be on
 by default.

Your concerns appear to be about `notmuch-wash-wrap-long-lines'. I agree
that it can generate unfortunate results in the deep thread, narrow
terminal case. Are the other two functions okay?

One of the reasons that I chose a hook-based approach is to allow the
user to decide which body cleaning should be applied. If you don't want
the line-wrapping to be enabled by default we can leave it out but
include the definition so that a user can enable it. The inline-patch
formatting is similar (I'll say more about that in response to your
comments on it).

 Dealing with broken messages that have entire paragraphs unwrapped is a
 separate issue from displaying correct messages nicely. I'd like to make
 correct messages work well first, and then worry about the broken
 messages. (For those, I'm much more willing to accept munged display of
 the message.)

Enabling `notmuch-wash-tidy-citations' and
`notmuch-wash-compress-blanks' by default would fit with this policy, I
think.

Then again, including the functions in the code but enabling none of
them by default would also be acceptable (I already enable them all and
have another function that is not shared).

  commit 9e193a3998b7503e35d21013c71cc4ecaf6c9d50
  
  emacs/notmuch-wash.el: Add `notmuch-wash-inline-patch'
 
 The commit message for this one was enough to make me skip it for now:
 
  Due to the scope for error in detecting inline patches (and their
  extent), this function is not enabled by default.
 
 For this entire series it would be very nice to have some emacs-based
 testing in the test suite. And for a patch like this with heuristics
 that are known to not be perfect, I think it's essential to have that
 testing in place first.

Testing for Emacs is something that I'm looking into. There doesn't seem
to be a de-facto best framework.

Aside from the need to test, this particular patch will benefit only
minimally from testing - there will always be false positive cases
however good the analysis used. Are you saying that we can not tolerate
any false-positives, or that we just need to demonstrate that it is down
to some acceptable level? (Though I've no idea how I would achieve the
latter.)

  commit 444de7e73d988cab9b8d1fef851c8ad26174a996
  
  emacs/notmuch-show.el: Part headers are real buttons that save the part
 
 Pushed. This is a delightful improvement to our handling of attachments.
 
 I'd like the text on the button to give some more instruction, such as:
 
   Click or press Enter to save.
 
 And if we could pull it off, (I don't know how flexible the button
 widget is in emacs), it would be nice to have something like this as
 well:
 
   Or press V to view.
 
 so that one could easily use an external viewer for a single attachment.

Agreed. There are a bunch of enhancements that I'd like to make here,
including toggling the visibility of part, viewing in another buffer,
view externally, force the type, etc.

 Meanwhile, another issue with the result of this series is that I now
 seem to get rendering for both the text/plain and the text/html
 alternatives when a message has both.

This is a consequence of `notmuch show' squashing the MIME details in
the message before output. In particular most messages which include
both text/plain and text/html parts are declared as
multipart/alternative, but the UI never gets to see that detail. Work on
improving that is happening (slowly) at:
http://github.com/dme/notmuch/tree/multipart
(please don't start using this - the JSON output is mostly-okay, but
text output is broken and the Emacs code is incomplete!)

multipart/alternative suppor would fix this. multipart/related is
necessary for displaying HTML with inline images that are part of the
message ('cid:' images). multipart/signed and multipart/encrypted are
necessary for PGP (and others). If `notmuch' can be persuaded to include
the structure in the JSON output then I think that the Emacs code is in
reasonable shape to be extended to display things well.

 For now, the paragraphs are wrapped much more nicely in the rendering
 of the html portion, but links are apparently entirely 

Re: Notmuch success: Xapian database corrupt

2010-04-22 Thread John Fremlin
After the encouraging message from Sebastian. I deleted the
.notmuch/xapian dir and started again.

It went off a good rate (300+ files/sec) and here was the final score

Processed 494764 total files in 2h 54m 41s (47 files/sec.). 
Added 226817 new messages to the database.

This is much faster than before. As I haven't changed the storage or the
filesystem (ext4,data=ordered over encrypted aes-xts-plain), I just
don't know what made the difference. My kernel is now 2.6.32-21-generic
#32-Ubuntu and I had an older one the first try a month or so ago.

Carl Worth cwo...@cworth.org writes:
[...]
 Welcome to notmuch, and I'm so sorry to hear that your initial attempt
 to use it was so frustrating.

Thanks for the welcome! I was initially impressed by it but rather
worried about relying on it after the database corruption.

 I'm not aware of any bugs in notmuch that can result in a corrupt Xapian
 database. In fact, this can't be a bug in notmuch alone (since Xapian is
 detecting the corruption). There must at least be a bug in Xapian or
 else some lower-level failure is occurring (disk full?) that Xapian
 can't deal with.

Disk full is quite likely. I'll try to avoid that in future.

[...]
 So there's some performance problem that you're having in addition to
 the database corruption. Hopefully we can figure that out. What kernel
 and filesystem are you using? Are you using an encrypted partition?

Happy to say (though frustrating for you), this time it's much
faster. Maybe because I had more disk free this time round so the Xapian
database became less fragmented? (Speculation, no evidence.) 
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: problem with notmuch-search-authors-width in JSON emacs implementation

2010-04-22 Thread David Edmondson
On Thu, 22 Apr 2010 00:37:25 -0400, Jameson Rollins 
jroll...@finestructure.net wrote:
 On Wed, 21 Apr 2010 19:09:35 -0400, Jameson Rollins 
 jroll...@finestructure.net wrote:
  Hey, folks.  I just build from Carl's HEAD which includes the new emacs
  JSON interface and I'm noticing a problem with the
  notmuch-search-authors-width variable.  If I set the variable as
  follows:
  
  (setq notmuch-search-authors-width 40)
  
  author lists that overrun the specified width start spitting out into
  the subject field.  I think bremner just confirmed this on irc.  I'll
  try to look into this when I get a chance, but I don't have time right
  now.  Maybe someone with more intimate knowledge of this piece of code
  could figure it out more quickly.

I thought that I had this fixed up properly. Sorry for the breakage.

Can you show any explicit settings you have for
`notmuch-search-authors-width' and `notmuch-search-result-format'? Where
do you set them?

The intention was that if you just want a wider display of authors you
set `notmuch-search-authors-width' (which has existed for some time) and
`notmuch-search-result-format' adapts accordingly.

Admittedly, this doesn't cope well if you modify
`notmuch-search-result-format' without also updating
`notmuch-search-authors-width'. Some more thought required...

dme.
-- 
David Edmondson, http://dme.org
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] emacs/notmuch-show.el: Add `notmuch-show-toggle-all' bound to M-RET

2010-04-22 Thread David Edmondson
`notmuch-show-toggle-all' changes the visibility all of the messages
in the current thread. By default it makes all of the messages
visible. With a prefix argument, it makes them all not visible.
---
 emacs/notmuch-show.el |   13 +
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 916b39e..9775fb4 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -526,6 +526,7 @@ function is used. 
(define-key map p 'notmuch-show-previous-open-message)
(define-key map (kbd DEL) 'notmuch-show-rewind)
(define-key map   'notmuch-show-advance-and-archive)
+   (define-key map (kbd M-RET) 'notmuch-show-toggle-all)
(define-key map (kbd RET) 'notmuch-show-toggle-message)
map)
   Keymap for \notmuch show\ buffers.)
@@ -900,6 +901,18 @@ to stdout or stderr will appear in the *Messages* buffer.
  (not (plist-get props :message-visible
   (force-window-update))
 
+(defun notmuch-show-toggle-all ()
+  Change the visibility all of the messages in the current
+thread. By default make all of the messages visible. With a
+prefix argument, make them all not visible.
+  (interactive)
+  (save-excursion
+(goto-char (point-min))
+(loop do (notmuch-show-message-visible 
(notmuch-show-get-message-properties)
+  (not current-prefix-arg))
+ until (not (notmuch-show-goto-message-next
+  (force-window-update))
+
 (defun notmuch-show-next-button ()
   Advance point to the next button in the buffer.
   (interactive)
-- 
1.7.0

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


[PATCH] emacs: Re-arrange message sending code

2010-04-22 Thread David Edmondson
Define a new `mail-user-agent' (`notmuch-user-agent') and use it by
default. Re-arrange various routines that send mail to use this
(compose, reply, forward). Insert a `User-Agent:' header by default.
---
 emacs/Makefile.local   |5 +-
 emacs/notmuch-hello.el |2 +
 emacs/notmuch-lib.el   |   16 ++
 emacs/notmuch-mua.el   |  133 
 emacs/notmuch-show.el  |8 ++--
 emacs/notmuch.el   |   20 ++-
 6 files changed, 163 insertions(+), 21 deletions(-)
 create mode 100644 emacs/notmuch-mua.el

diff --git a/emacs/Makefile.local b/emacs/Makefile.local
index 6486d90..e5013b3 100644
--- a/emacs/Makefile.local
+++ b/emacs/Makefile.local
@@ -6,8 +6,9 @@ emacs_sources := \
$(dir)/notmuch.el \
$(dir)/notmuch-query.el \
$(dir)/notmuch-show.el \
-   $(dir)/notmuch-wash.el
-   $(dir)/notmuch-hello.el
+   $(dir)/notmuch-wash.el \
+   $(dir)/notmuch-hello.el \
+   $(dir)/notmuch-mua.el
 
 emacs_images := \
$(dir)/notmuch-logo.png
diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 13de6f8..fa6433e 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -25,6 +25,7 @@
 
 (require 'notmuch-lib)
 (require 'notmuch)
+(require 'notmuch-mua)
 
 (declare-function notmuch-search notmuch (query optional oldest-first 
target-thread target-line))
 (declare-function notmuch-folder-count notmuch (search))
@@ -335,6 +336,7 @@ diagonal.
 
   (use-local-map widget-keymap)
   (local-set-key = 'notmuch-hello-update)
+  (local-set-key m 'notmuch-mua-mail)
   (local-set-key q '(lambda () (interactive) (kill-buffer (current-buffer
   (local-set-key s 'notmuch-hello-goto-search)
   (local-set-key v '(lambda () (interactive)
diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index 274d7ec..47c74b9 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -33,6 +33,22 @@
   :type '(alist :key-type (string) :value-type (string))
   :group 'notmuch)
 
+;;
+
+(defun notmuch-version ()
+  Return a string with the notmuch version number.
+  (let ((long-string
+;; Trim off the trailing newline.
+(substring (shell-command-to-string
+(concat notmuch-command  --version))
+   0 -1)))
+(if (string-match ^notmuch\\( version\\)? \\(.*\\)$
+ long-string)
+   (match-string 2 long-string)
+  unknown)))
+
+;;
+
 ;; XXX: This should be a generic function in emacs somewhere, not
 ;; here.
 (defun point-invisible-p ()
diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
new file mode 100644
index 000..acb7dbf
--- /dev/null
+++ b/emacs/notmuch-mua.el
@@ -0,0 +1,133 @@
+;; notmuch-mua.el --- emacs style mail-user-agent
+;;
+;; Copyright © David Edmondson
+;;
+;; This file is part of Notmuch.
+;;
+;; Notmuch is free software: you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; Notmuch is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with Notmuch.  If not, see http://www.gnu.org/licenses/.
+;;
+;; Authors: David Edmondson d...@dme.org
+
+(require 'cl)
+(require 'message)
+
+(require 'notmuch-lib)
+
+;;
+
+(defcustom notmuch-mua-send-hook '(notmuch-mua-message-send-hook)
+  Hook run before sending messages.
+  :group 'notmuch
+  :type 'hook)
+
+(defcustom notmuch-mua-user-agent-function 'notmuch-mua-user-agent-full
+  Function used to generate a `User-Agent:' string. If this is
+`nil' then no `User-Agent:' will be generated.
+  :group 'notmuch
+  :type 'function
+  :options '(notmuch-mua-user-agent-full
+notmuch-mua-user-agent-notmuch
+notmuch-mua-user-agent-emacs))
+
+;;
+
+(defun notmuch-mua-user-agent-full ()
+  Generate a `User-Agent:' string suitable for notmuch.
+  (concat (notmuch-mua-user-agent-notmuch)
+  
+ (notmuch-mua-user-agent-emacs)))
+
+(defun notmuch-mua-user-agent-notmuch ()
+  Generate a `User-Agent:' string suitable for notmuch.
+  (concat Notmuch/ (notmuch-version)  (http://notmuchmail.org)))
+
+(defun notmuch-mua-user-agent-emacs ()
+  Generate a `User-Agent:' string suitable for notmuch.
+  (concat Emacs/ emacs-version  ( system-configuration )))
+
+(defun notmuch-mua-reply (query-string)
+  (let (headers body)
+;; This make assumptions about the output of `notmuch reply', but
+;; really only that the headers come first followed by a blank
+;; line and then the body.
+(with-temp-buffer
+  (call-process notmuch-command nil t nil reply query-string)
+  (goto-char (point-min))
+  (if 

[PATCH] emacs: Add notmuch-address.el for address completion using notmuch

2010-04-22 Thread David Edmondson
A tool `notmuch-addresses' is required to produce addresses which
match a query string. An example of a suitable script can be found in
the git repository at
http://jkr.acm.jhu.edu/git/notmuch_addresses.git
There are no doubt others.
---
 emacs/Makefile.local |3 +-
 emacs/notmuch-address.el |   91 ++
 2 files changed, 93 insertions(+), 1 deletions(-)
 create mode 100644 emacs/notmuch-address.el

diff --git a/emacs/Makefile.local b/emacs/Makefile.local
index e5013b3..7537c3d 100644
--- a/emacs/Makefile.local
+++ b/emacs/Makefile.local
@@ -8,7 +8,8 @@ emacs_sources := \
$(dir)/notmuch-show.el \
$(dir)/notmuch-wash.el \
$(dir)/notmuch-hello.el \
-   $(dir)/notmuch-mua.el
+   $(dir)/notmuch-mua.el \
+   $(dir)/notmuch-address.el
 
 emacs_images := \
$(dir)/notmuch-logo.png
diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el
new file mode 100644
index 000..69a52a2
--- /dev/null
+++ b/emacs/notmuch-address.el
@@ -0,0 +1,91 @@
+;; notmuch-address.el --- address completion with notmuch
+;;
+;; Copyright © David Edmondson
+;;
+;; This file is part of Notmuch.
+;;
+;; Notmuch is free software: you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; Notmuch is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with Notmuch.  If not, see http://www.gnu.org/licenses/.
+;;
+;; Authors: David Edmondson d...@dme.org
+
+(require 'message)
+
+;;
+
+(defcustom notmuch-address-command notmuch-addresses
+  The command which generates possible addresses. It must take a
+single argument and output a list of possible matches, one per
+line.
+  :type 'string
+  :group 'notmuch)
+
+(defvar notmuch-address-message-alist-member
+  
'(^\\(Resent-\\)?\\(To\\|B?Cc\\|Reply-To\\|From\\|Mail-Followup-To\\|Mail-Copies-To\\):
+ . notmuch-address-expand-name))
+
+(defvar notmuch-address-history nil)
+
+(defun notmuch-address-message-insinuate ()
+  (if (not (memq notmuch-address-message-alist-member 
message-completion-alist))
+  (setq message-completion-alist
+   (push notmuch-address-message-alist-member 
message-completion-alist
+
+(defun notmuch-address-options (original)
+  (process-lines notmuch-address-command original))
+
+(defun notmuch-address-expand-name ()
+  (let* ((end (point))
+(beg (save-excursion
+   (re-search-backward \\(\\`\\|[\n:,]\\)[ \t]*)
+   (goto-char (match-end 0))
+   (point)))
+(orig (buffer-substring-no-properties beg end))
+(completion-ignore-case t)
+(options (notmuch-address-options orig))
+(chosen (if (eq (length options) 1)
+(car options)
+  (completing-read Address:  (cdr options) nil nil (car 
options)
+   'notmuch-address-history
+(when chosen
+  (push chosen notmuch-address-history)
+  (delete-region beg end)
+  (insert chosen
+
+;; Copied from `w3m-which-command'.
+(defun notmuch-address-locate-command (command)
+  Return non-nil if `command' is an executable either on
+`exec-path' or an absolute pathname.
+  (when (stringp command)
+(if (and (file-name-absolute-p command)
+(file-executable-p command))
+   command
+  (setq command (file-name-nondirectory command))
+  (catch 'found-command
+   (let (bin)
+ (dolist (dir exec-path)
+   (setq bin (expand-file-name command dir))
+   (when (or (and (file-executable-p bin)
+  (not (file-directory-p bin)))
+ (and (file-executable-p (setq bin (concat bin .exe)))
+  (not (file-directory-p bin
+ (throw 'found-command bin
+
+;; If we can find the program specified by `notmuch-address-command',
+;; insinuate ourselves into `message-mode'.
+(when (notmuch-address-locate-command notmuch-address-command)
+  (notmuch-address-message-insinuate))
+
+;;
+
+(provide 'notmuch-address)
-- 
1.7.0

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


[PATCH] notmuch.el: Make notmuch-show buffer name first subject, instead of thread-id (supersedes V1--3)

2010-04-22 Thread Sebastian Spaeth
From: Jesse Rosenthal jrosent...@jhu.edu

(Embarassing -- this should be the last fix.)

Change the buffer name to a uniquified subject of the thread (i.e. the
subject of the first message in the thread) instead of the thread-id. This
is more meaningful to the user, and will make it easier to scroll through
numerous open buffers.

Note that this patch adds an optional `buffer-name' argument to notmuch
show.

This version supersedes V1--3 of this patch. It is rebased on HEAD,
ensures that the buffer names are unique, and that the `notmuch-show'
command can still be used interactively (fixing embarassing bugs in V2
and V3 which prevented that)

Signed-off-by: Jesse Rosenthal jrosent...@jhu.edu
---
 emacs/notmuch.el |   25 -
 1 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 439303a..4b93d8e 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -1178,7 +1178,7 @@ All currently available key bindings:
  (lambda()
(hl-line-mode 1) ))
 
-(defun notmuch-show (thread-id optional parent-buffer query-context)
+(defun notmuch-show (thread-id optional parent-buffer query-context 
buffer-name)
   Run \notmuch show\ with the given thread ID and display results.
 
 The optional PARENT-BUFFER is the notmuch-search buffer from
@@ -1186,9 +1186,14 @@ which this notmuch-show command was executed, (so that 
the next
 thread from that buffer can be show when done with this one).
 
 The optional QUERY-CONTEXT is a notmuch search term. Only messages from the 
thread
-matching this search term are shown if non-nil. 
+matching this search term are shown if non-nil.
+
+The optional BUFFER-NAME provides the neame of the buffer in 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 (concat *notmuch-show- thread-id *
+  (when (null buffer-name)
+(setq buffer-name (concat *notmuch- thread-id *)))
+  (let* ((thread-buffer-name (generate-new-buffer-name buffer-name))
+(buffer (get-buffer-create thread-buffer-name)))
 (switch-to-buffer buffer)
 (notmuch-show-mode)
 (set (make-local-variable 'notmuch-show-parent-buffer) parent-buffer)
@@ -1383,9 +1388,19 @@ Complete list of currently available key bindings:
 (defun notmuch-search-show-thread ()
   Display the currently selected thread.
   (interactive)
-  (let ((thread-id (notmuch-search-find-thread-id)))
+  (let ((thread-id (notmuch-search-find-thread-id))
+   (subject (notmuch-search-find-subject))
+   buffer-name)
+(when (string-match ^[ \t]*$ subject)
+  (setq subject [No Subject]))
+(setq buffer-name (concat *
+ (truncate-string-to-width subject 32 nil nil t)
+ *))
 (if ( (length thread-id) 0)
-   (notmuch-show thread-id (current-buffer) notmuch-search-query-string)
+   (notmuch-show thread-id
+ (current-buffer)
+ notmuch-search-query-string
+ buffer-name)
   (error End of search results
 
 (defun notmuch-search-reply-to-thread ()
-- 
1.6.3.3

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


[PATCH 2/6] Integrate notmuch-maildir-fcc into notmuch

2010-04-22 Thread Sebastian Spaeth
Require notmuch-maildir-fcc and also install it.

Signed-off-by: Sebastian Spaeth sebast...@sspaeth.de
---
 emacs/Makefile.local |3 ++-
 emacs/notmuch-maildir-fcc.el |4 +++-
 emacs/notmuch.el |1 +
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/emacs/Makefile.local b/emacs/Makefile.local
index f759c0d..c80e0e3 100644
--- a/emacs/Makefile.local
+++ b/emacs/Makefile.local
@@ -6,7 +6,8 @@ emacs_sources := \
$(dir)/notmuch.el \
$(dir)/notmuch-query.el \
$(dir)/notmuch-show.el \
-   $(dir)/notmuch-wash.el
+   $(dir)/notmuch-wash.el \
+   $(dir)/notmuch-maildir-fcc.el
 
 emacs_bytecode := $(subst .el,.elc,$(emacs_sources))
 
diff --git a/emacs/notmuch-maildir-fcc.el b/emacs/notmuch-maildir-fcc.el
index e7fddf1..f18ccc8 100644
--- a/emacs/notmuch-maildir-fcc.el
+++ b/emacs/notmuch-maildir-fcc.el
@@ -112,4 +112,6 @@ return t if successful, and nil otherwise.
 (file-already-exists
  (throw 'link-error nil))
  (delete-file (concat destdir /tmp/ msg-id
-  t)))
\ No newline at end of file
+  t)))
+
+(provide 'notmuch-maildir-fcc)
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 57b7fcf..02760b4 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -53,6 +53,7 @@
 
 (require 'notmuch-lib)
 (require 'notmuch-show)
+(require 'notmuch-maildir-fcc)
 
 (defcustom notmuch-search-authors-width 20
   Number of columns to use to display authors in a notmuch-search buffer.
-- 
1.7.0.4

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


[PATCH 5/6] notmuch-maildir-fcc: use insert-buffer-substring

2010-04-22 Thread Sebastian Spaeth
Rather than the insert-buffer. Emacs complains that it is for interactive use
and not for use within elisp. So use insert-buffer-substring which does the
same thing when not handed any 'begin' 'end' parameters.

Signed-off-by: Sebastian Spaeth sebast...@sspaeth.de
---
 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 f63c1c9..c47bfb3 100644
--- a/emacs/notmuch-maildir-fcc.el
+++ b/emacs/notmuch-maildir-fcc.el
@@ -103,7 +103,7 @@ non-nil, it will write it to cur/, and mark it as read. It 
should
 return t if successful, and nil otherwise.
   (let ((orig-buffer (buffer-name)))
 (with-temp-buffer 
-  (insert-buffer orig-buffer)
+  (insert-buffer-substring orig-buffer)
   (catch 'link-error
(let ((msg-id (notmuch-maildir-fcc-save-buffer-to-tmp destdir)))
  (when msg-id
-- 
1.7.0.4

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


[PATCH 6/6] notmuch-maildir-fcc: replace caddr with (car (cdr (cdr)))

2010-04-22 Thread Sebastian Spaeth
The former requires 'cl to be loaded and during make install emacs complained 
about not knowing it.

Signed-off-by: Sebastian Spaeth sebast...@sspaeth.de
---
 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 c47bfb3..3dc8283 100644
--- a/emacs/notmuch-maildir-fcc.el
+++ b/emacs/notmuch-maildir-fcc.el
@@ -58,7 +58,7 @@
 (defun notmuch-maildir-fcc-make-uniq-maildir-id ()
(let* ((ct (current-time))
  (timeid (+ (* (car ct) 65536) (cadr ct)))
- (microseconds (caddr ct))
+ (microseconds (car (cdr (cdr ct
  (hostname (notmuch-maildir-fcc-host-fixer system-name)))
  (setq notmuch-maildir-fcc-count (+ notmuch-maildir-fcc-count 1))
  (format %d.%d_%d_%d.%s
-- 
1.7.0.4

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


Re: [notmuch] auto-tagging replied messages

2010-04-22 Thread Sebastian Spaeth
On 2010-03-05, Jesse Rosenthal wrote:
 One element of traditional clients that I've missed in notmuch is the
 ability to easily see which messages have been replied to. A look at the
 thread structure will often make that clear, but for both searching and
 syncing, an answered tag would be nice.

This patch has been working great so far and is very useful. Can I
persuade someone to take this into the notmuch code and have a defcustom
as to which tag a reply should get (or disable if nil)?

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


Re: [PATCH] emacs: Add notmuch-address.el for address completion using notmuch

2010-04-22 Thread Sebastian Spaeth
On 2010-04-22, David Edmondson wrote:
 A tool `notmuch-addresses' is required to produce addresses which
 match a query string. An example of a suitable script can be found in
 the git repository at
 http://jkr.acm.jhu.edu/git/notmuch_addresses.git
 There are no doubt others.

no doubt :-).

This works great, the only disadvantage is that it will disable bbdb
and eudc by default if a notmuch-addresses binary is available. I think
that is a reasonable assumption.

Is it really necessary to try to append .exe? Even Windows users
should be able to provide the full binary name if asked for it
(especially when using emacs on Windows).

in any case:

Signed-off: Sebastian Spaeth sebast...@sspaeth.de
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] emacs: Add more functions to clean up text/plain parts

2010-04-22 Thread David Edmondson
Add:
- notmuch-wash-wrap-long-lines: Wrap lines longer than the width of
  the current window whilst maintaining any citation prefix.
- notmuch-wash-tidy-citations: Tidy up citations by:
  - compress repeated otherwise blank citation lines,
  - remove otherwise blank citation lines at the head and tail of a
citation and remove blank lines between attribution statements and
the citation,
- notmuch-wash-compress-blanks: Compress repeated blank lines and
  remove leading and trailing blank lines.

Enable `notmuch-wash-tidy-citations' and
`notmuch-wash-compress-blanks' by default by adding them to
`notmuch-show-insert-text/plain-hook'. `notmuch-wash-wrap-long-lines'
is not enabled by default.

If `notmuch-wash-wrap-long-lines' is enabled, word wrapping of the
buffer leads to an unappealing display of text, so provide a function
to disable it and add it to the list of `notmuch-show-mode' hook
functions.
---

This is a small variant on the previous version of the patch. The
wrapping of long lines is not enabled by default - it's simply an
option in the customise interface.

 emacs/Makefile.local  |3 +-
 emacs/coolj.el|  145 +
 emacs/notmuch-show.el |   25 +++--
 emacs/notmuch-wash.el |   72 -
 4 files changed, 239 insertions(+), 6 deletions(-)
 create mode 100644 emacs/coolj.el

diff --git a/emacs/Makefile.local b/emacs/Makefile.local
index 7537c3d..ce37ca2 100644
--- a/emacs/Makefile.local
+++ b/emacs/Makefile.local
@@ -9,7 +9,8 @@ emacs_sources := \
$(dir)/notmuch-wash.el \
$(dir)/notmuch-hello.el \
$(dir)/notmuch-mua.el \
-   $(dir)/notmuch-address.el
+   $(dir)/notmuch-address.el \
+   $(dir)/coolj.el
 
 emacs_images := \
$(dir)/notmuch-logo.png
diff --git a/emacs/coolj.el b/emacs/coolj.el
new file mode 100644
index 000..60af60a
--- /dev/null
+++ b/emacs/coolj.el
@@ -0,0 +1,145 @@
+;;; coolj.el --- automatically wrap long lines  -*- coding:utf-8 -*-
+
+;; Copyright (C) 2000, 2001, 2004, 2005, 2006, 2007, 2008, 2009 Free Software 
Foundation, Inc.
+
+;; Authors:Kai Grossjohann kai.grossjoh...@cs.uni-dortmund.de
+;; Alex Schroeder a...@gnu.org
+;; Chong Yidong c...@stupidchicken.com
+;; Maintainer: David Edmondson d...@dme.org
+;; Keywords: convenience, wp
+
+;; This file is not part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see http://www.gnu.org/licenses/.
+
+;;; Commentary:
+
+;;; This is a simple derivative of some functionality from
+;;; `longlines.el'. The key difference is that this version will
+;;; insert a prefix at the head of each wrapped line. The prefix is
+;;; calculated from the originating long line.
+
+;;; No minor-mode is provided, the caller is expected to call
+;;; `coolj-wrap-region' to wrap the region of interest.
+
+;;; Code:
+
+(defgroup coolj nil
+  Wrapping of long lines with prefix.
+  :group 'fill)
+
+(defcustom coolj-wrap-follows-window-size t
+  Non-nil means wrap text to the window size.
+Otherwise respect `fill-column'.
+  :group 'coolj
+  :type 'boolean)
+
+(defcustom coolj-line-prefix-regexp ^\\(+ \\)*
+  Regular expression that matches line prefixes.
+  :group 'coolj
+  :type 'regexp)
+
+(defvar coolj-wrap-point nil)
+
+(make-variable-buffer-local 'coolj-wrap-point)
+
+(defun coolj-determine-prefix ()
+  Determine the prefix for the current line.
+  (save-excursion
+(beginning-of-line)
+(if (re-search-forward coolj-line-prefix-regexp nil t)
+   (buffer-substring (match-beginning 0) (match-end 0))
+  )))
+
+(defun coolj-wrap-buffer ()
+  Wrap the current buffer.
+  (coolj-wrap-region (point-min) (point-max)))
+
+(defun coolj-wrap-region (beg end)
+  Wrap each successive line, starting with the line before BEG.
+Stop when we reach lines after END that don't need wrapping, or the
+end of the buffer.
+  (setq fill-column (if coolj-wrap-follows-window-size
+   (window-width)
+ fill-column))
+  (let ((mod (buffer-modified-p)))
+(setq coolj-wrap-point (point))
+(goto-char beg)
+(forward-line -1)
+;; Two successful coolj-wrap-line's in a row mean successive
+;; lines don't need wrapping.
+(while (null (and (coolj-wrap-line)
+ (or (eobp)
+ (and (= (point) end)
+  (coolj-wrap-line))
+

Re: pull request

2010-04-22 Thread David Edmondson
On Thu, 22 Apr 2010 04:58:16 -0400, Servilio Afre Puentes servi...@gmail.com 
wrote:
 On 21 April 2010 17:03, Carl Worth cwo...@cworth.org wrote:
  On Mon, 19 Apr 2010 09:27:39 +0100, David Edmondson d...@dme.org wrote:
 [...]
  Meanwhile, another issue with the result of this series is that I now
  seem to get rendering for both the text/plain and the text/html
  alternatives when a message has both. For now, the paragraphs are
  wrapped much more nicely in the rendering of the html portion, but links
  are apparently entirely missing. The link URLs at least appear in the
  text/plain rendering, (which is pretty ugly, but at least not impossible
  to use).
 
  If we could get one version or the other working completely, then it
  would be nice to display only one.
 
 I think that a better approach here would be to list them as parts if
 they are present, then have a [configurable] way to show only one by
 default, and the other would be available to show in-line.

Showing only one (with a variable allowing you to express preference) is
my intention. Any non-shown parts will appear as attachments - you can
save them using the button (and perhaps later view them).

This can make quite a big difference in a 200 message thread with lots
of 'text/plain or text/html ?' choices - using the text/plain part will
improve the performance of building the show buffer significantly.

 What I miss in this view sometimes is the possibility of being able to
 see the structure of the thread. A way to toggle the expanded state of
 the messages originally expanded when I first opened the view would do
 this very nicely.

Ah, so you want a go back to how it was initially command?

dme.
-- 
David Edmondson, http://dme.org
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: problem with notmuch-search-authors-width in JSON emacs implementation

2010-04-22 Thread Jameson Rollins
On Thu, 22 Apr 2010 08:52:59 +0100, David Edmondson d...@dme.org wrote:
 On Thu, 22 Apr 2010 00:37:25 -0400, Jameson Rollins 
 jroll...@finestructure.net wrote:
  On Wed, 21 Apr 2010 19:09:35 -0400, Jameson Rollins 
  jroll...@finestructure.net wrote:
   Hey, folks.  I just build from Carl's HEAD which includes the new emacs
   JSON interface and I'm noticing a problem with the
   notmuch-search-authors-width variable.  If I set the variable as
   follows:
   
   (setq notmuch-search-authors-width 40)
   
   author lists that overrun the specified width start spitting out into
   the subject field.  I think bremner just confirmed this on irc.  I'll
   try to look into this when I get a chance, but I don't have time right
   now.  Maybe someone with more intimate knowledge of this piece of code
   could figure it out more quickly.
 
 I thought that I had this fixed up properly. Sorry for the breakage.

No worries.

 Can you show any explicit settings you have for
 `notmuch-search-authors-width' and `notmuch-search-result-format'? Where
 do you set them?

Changing notmuch-search-authors-width to anything longer than 20 (which
is the default set internally) causes the problem (I had it set to 40
when I first noticed).  It's very easy to test.  You can
notmuch-search-authors-width on the fly from the configuration manager
and see the result.  I have not modified notmuch-search-result-format.
See my previous email on tracking down the issue.

Thanks for the help.

jamie.


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


Re: [PATCH] notmuch.el: Make notmuch-show buffer name first subject, instead of thread-id (supersedes V1--3)

2010-04-22 Thread Sebastian Spaeth
On 2010-04-22, Sebastian Spaeth wrote:
 From: Jesse Rosenthal jrosent...@jhu.edu

This patch must have slipped in the patch series of the 6 other patches
(which are all correct). Please ignore it.

Note to myself, never do git send-email 00*

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


Re: problem with notmuch-search-authors-width in JSON emacs implementation

2010-04-22 Thread David Edmondson
On Thu, 22 Apr 2010 09:22:32 -0400, Jameson Rollins 
jroll...@finestructure.net wrote:
  Can you show any explicit settings you have for
  `notmuch-search-authors-width' and `notmuch-search-result-format'? Where
  do you set them?
 
 Changing notmuch-search-authors-width to anything longer than 20 (which
 is the default set internally) causes the problem (I had it set to 40
 when I first noticed).  It's very easy to test.  You can
 notmuch-search-authors-width on the fly from the configuration manager
 and see the result.  I have not modified notmuch-search-result-format.
 See my previous email on tracking down the issue.

Ah, when you set `notmuch-search-authors-width' the expression which
creates `notmuch-search-result-format' is not re-evaluated.

Do things get better if you restart emacs (sorry for suggesting that)?

If so then I have an idea how to fix it.

dme.
-- 
David Edmondson, http://dme.org
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


sort order regression

2010-04-22 Thread Sebastian Spaeth

jkr and I noticed that patch series are shown in reverse order now, in
fact threads seem to display messages at the same depth in reverse
chronological order now.

Here is my monologue from IRC:

Is that supposed to show the whole thread in reverse chronological order?:
notmuch show --entire-thread 
id:1271927251-19867-3-git-send-email-sebast...@sspaeth.de

doh, 
http://git.notmuchmail.org/git/notmuch/commitdiff/f43990ce134d838cdb2cdd5d0752a602e81cfdd9
sort order for within threads used to be SORT_OLDEST_FIRST
with that commit it was changed to be inherited from whatever it was (and by 
default notmuch does NEWEST_FIRST)
so that would cause the change IMHO.
someone does not seem to have run a test suite there :

query.cc sets to NEWEST-FIRST by default. So now we get messages at each depth 
NEWEST-FIRST. So the code is working as expected.
the problem is imho, that we previously had NEWEST_FIRST for top-level and an 
explicit OLDEST_FIRST within threads
 jkr spaetz: yep.
and that explicit OLDEST_FIRST got removed
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: pull request

2010-04-22 Thread Servilio Afre Puentes
On 22 April 2010 08:30, David Edmondson d...@dme.org wrote:
 On Thu, 22 Apr 2010 04:58:16 -0400, Servilio Afre Puentes 
 servi...@gmail.com wrote:
 On 21 April 2010 17:03, Carl Worth cwo...@cworth.org wrote:
  On Mon, 19 Apr 2010 09:27:39 +0100, David Edmondson d...@dme.org wrote:
 [...]
  Meanwhile, another issue with the result of this series is that I now
  seem to get rendering for both the text/plain and the text/html
  alternatives when a message has both. For now, the paragraphs are
  wrapped much more nicely in the rendering of the html portion, but links
  are apparently entirely missing. The link URLs at least appear in the
  text/plain rendering, (which is pretty ugly, but at least not impossible
  to use).
 
  If we could get one version or the other working completely, then it
  would be nice to display only one.

 I think that a better approach here would be to list them as parts if
 they are present, then have a [configurable] way to show only one by
 default, and the other would be available to show in-line.

 Showing only one (with a variable allowing you to express preference) is
 my intention. Any non-shown parts will appear as attachments - you can
 save them using the button (and perhaps later view them).

Why not see them in-line if possible?

 This can make quite a big difference in a 200 message thread with lots
 of 'text/plain or text/html ?' choices - using the text/plain part will
 improve the performance of building the show buffer significantly.

Yes, it can make a big difference.

 What I miss in this view sometimes is the possibility of being able to
 see the structure of the thread. A way to toggle the expanded state of
 the messages originally expanded when I first opened the view would do
 this very nicely.

 Ah, so you want a go back to how it was initially command?

Yep, then bind it to a key that would alternate between collapsing all
messages and expanding the ones that were originally expanded.

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


Re: sort order regression

2010-04-22 Thread Jesse Rosenthal
On Thu, 22 Apr 2010 16:06:27 +0200, Sebastian Spaeth sebast...@sspaeth.de 
wrote:
 
 jkr and I noticed that patch series are shown in reverse order now, in
 fact threads seem to display messages at the same depth in reverse
 chronological order now.

Just to follow up on this, it seems that the regression comes from the
fix Carl introduced in 2a1a4f0551 to make his simplification of my patch
(simplification = 36e4459a3 , my patch = 4971b85641) pass tests. The
question is whether my original, more complicated version would have
passed the tests without the regressing fix. I do know that it showed
the search order as expected.

Unfortunately, I'm not quite skilled enough at git to turn back some
files to a certain state, tests to another state, and so on.

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


Re: sort order regression

2010-04-22 Thread Jesse Rosenthal
On Thu, 22 Apr 2010 10:14:16 -0400, Jesse Rosenthal jrosent...@jhu.edu wrote:
 Just to follow up on this, it seems that the regression comes from the
 fix Carl introduced in 2a1a4f0551 to make his simplification of my patch
 (simplification = 36e4459a3 , my patch = 4971b85641) pass tests. The
 question is whether my original, more complicated version would have
 passed the tests without the regressing fix.

Okay, I just tested using the current test suite: my patch (4971b85641)
passes all tests, while Carl's simplification fails.

My suggestion would be to revert both the simplification and the fix to
enable the simplification to pass: (36e4459a3, 2a1a4f0551).

Should we send reverts as patches?

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


Re: sort order regression

2010-04-22 Thread Jesse Rosenthal
On Thu, 22 Apr 2010 10:21:11 -0400, Jesse Rosenthal jrosent...@jhu.edu wrote:
 My suggestion would be to revert both the simplification and the fix to
 enable the simplification to pass: (36e4459a3, 2a1a4f0551).

Sorry, got that slightly wrong. The following commits need to be
reverted:
 
36e4459a328b8449b3e9d510be81a332a9b35aaa
f43990ce134d838cdb2cdd5d0752a602e81cfdd9
7fb56f9dc5d8e66f717f5e48ecbfbc11c8190182

When I do this, search order is right, and all tests are passed.

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


Re: problem with notmuch-search-authors-width in JSON emacs implementation

2010-04-22 Thread David Edmondson
On Thu, 22 Apr 2010 10:12:59 -0400, Jameson Rollins 
jroll...@finestructure.net wrote:
 On Thu, 22 Apr 2010 15:04:45 +0100, David Edmondson d...@dme.org wrote:
  Ah, when you set `notmuch-search-authors-width' the expression which
  creates `notmuch-search-result-format' is not re-evaluated.
  
  Do things get better if you restart emacs (sorry for suggesting that)?
 
 I can't see how that would help, because notmuch-search-result-format is
 always going to be evaluated with the default value of
 notmuch-search-authors-width, which is defined immediately previous to
 it.

The `defcustom' does nothing if the variable already has a value.

dme.
-- 
David Edmondson, http://dme.org
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: pull request

2010-04-22 Thread David Edmondson
On Thu, 22 Apr 2010 10:10:15 -0400, Servilio Afre Puentes servi...@gmail.com 
wrote:
  Showing only one (with a variable allowing you to express preference) is
  my intention. Any non-shown parts will appear as attachments - you can
  save them using the button (and perhaps later view them).
 
 Why not see them in-line if possible?

This will probably come later, sure. At the moment the entire buffer is
built in one pass before you see it. If we want to support the insertion
of parts 'on demand' then a little more work is required.

  What I miss in this view sometimes is the possibility of being able to
  see the structure of the thread. A way to toggle the expanded state of
  the messages originally expanded when I first opened the view would do
  this very nicely.
 
  Ah, so you want a go back to how it was initially command?
 
 Yep, then bind it to a key that would alternate between collapsing all
 messages and expanding the ones that were originally expanded.

I'll give this some thought.

dme.
-- 
David Edmondson, http://dme.org
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] emacs: Add notmuch-address.el for address completion using notmuch

2010-04-22 Thread Dirk Hohndel
On Thu, 22 Apr 2010 10:03:43 +0100, David Edmondson d...@dme.org wrote:
 A tool `notmuch-addresses' is required to produce addresses which
 match a query string. An example of a suitable script can be found in
 the git repository at
 http://jkr.acm.jhu.edu/git/notmuch_addresses.git
 There are no doubt others.

+1 on getting this into 0.3

/D

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


bug tracking

2010-04-22 Thread Jameson Rollins
I now think it is essential that we put together a bug tracker for
notmuch.  Things are moving pretty quickly now, which is great, but as
the UI is frequently changing, I'm stumbling upon lots of little bugs.
As I don't have the time to stop what I'm doing and figure out patches
for them all, we really need some way to report and track issues.  I
really think this is essential moving forward.

I have used things like trac and redmine in the past and they work quite
well.  I don't have any other useful suggestions.  One of the newfangled
git-based distributed bug trackers could be cool, but I've never used
one, or gotten any feedback from anyone who has.

jamie.


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


Re: problem with notmuch-search-authors-width in JSON emacs implementation

2010-04-22 Thread David Edmondson
On Thu, 22 Apr 2010 11:20:33 -0400, Jameson Rollins 
jroll...@finestructure.net wrote:
 On Thu, 22 Apr 2010 15:38:55 +0100, David Edmondson d...@dme.org wrote:
  The `defcustom' does nothing if the variable already has a value.
 
 But the defcustom is always going to be called before any customization
 value, since my personal customizations are always loaded last, so I'm
 don't see how this would ever apply.

I see. The original solution assumed that `notmuch.el' would be loaded
on demand rather than ahead of the call to `custom-set-variables'. I'll
find another solution.

dme.
-- 
David Edmondson, http://dme.org
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: bug tracking

2010-04-22 Thread David Bremner
On Thu, 22 Apr 2010 11:47:13 -0400, Jameson Rollins 
jroll...@finestructure.net wrote:
 I now think it is essential that we put together a bug tracker for
 notmuch.  Things are moving pretty quickly now, which is great, but as
 the UI is frequently changing, I'm stumbling upon lots of little bugs.
 As I don't have the time to stop what I'm doing and figure out patches
 for them all, we really need some way to report and track issues.  I
 really think this is essential moving forward.
 
 I have used things like trac and redmine in the past and they work quite
 well.  I don't have any other useful suggestions.  One of the newfangled
 git-based distributed bug trackers could be cool, but I've never used
 one, or gotten any feedback from anyone who has.
 

It was thinking along these lines that got me to make the following list

 http://www.cs.unb.ca/~bremner/blog/posts/git-issue-trackers/

If people think the general concept of a distributed bug tracker is
worthwhile, I'm willing to investigate a more.  Feel free to cc

 bremner-comment-blog~posts~git-issue-track...@pivot.cs.unb.ca

If you have comments about distributed bug trackers; this
semi-automatically gets added to the comments page.

So far, a few Debian people have endorsed simple defects.

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


Improved diff-based failure reports from the test suite

2010-04-22 Thread Carl Worth
On Fri, 16 Apr 2010 10:17:15 +0200, Michal Sojka sojk...@fel.cvut.cz wrote:
 It's definitely better than before. The current implementation of
 pass_if_equal has IMHO one drawback - if it compares multiline text and
 there is a difference, it is quite hard to see where.
 
 In my tests for maildir synchronization I use this approach:
 
   notmuch search tag:inbox | filter_output  actual 
   diff -u - actual EOF
   thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; test message 3 (inbox)
   EOF
 
 Thanks to the usee of diff, I immediately see only the differences.

I just added a very long multi-line test to the test suite.

So I took the opportunity to fix it to output the failures with diff. It
also saves both the complete expected and actual output (for any failed
tests) to files of the form test-XXX.expected and test-XXX.output.

Enjoy!

-Carl


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


Re: [PATCH] Add 'G' keybinding to folder and search view that triggers external poll

2010-04-22 Thread Carl Worth
On Fri, 09 Apr 2010 12:53:26 -0700, Dirk Hohndel hohn...@infradead.org wrote:
 The new functions first check if an external poll script has been defined in
 the variable 'notmuch-external-refresh-script and if yes, runs that script
 before executing the existing refresh function (which is bound to '=')

Thanks Dirk,

This is even handier than I expected.

I've pushed this now, but followed up immediately with a (totally
trivial) change to reduce code duplication, and then a (slightly more
major) change to define the controlling variable with defcustom so that
the user can find the variable in the customize screen for notmuch.

I also renamed it to notmuch-poll-script so you'll need to update your
setting for this feature to work.

-Carl


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


Re: [PATCH] Add 'G' keybinding to folder and search view that triggers external poll

2010-04-22 Thread Dirk Hohndel
On Thu, 22 Apr 2010 14:50:33 -0700, Carl Worth cwo...@cworth.org wrote:
 On Fri, 09 Apr 2010 12:53:26 -0700, Dirk Hohndel hohn...@infradead.org 
 wrote:
  The new functions first check if an external poll script has been defined in
  the variable 'notmuch-external-refresh-script and if yes, runs that script
  before executing the existing refresh function (which is bound to '=')
 
 Thanks Dirk,
 
 This is even handier than I expected.
 
 I've pushed this now, but followed up immediately with a (totally
 trivial) change to reduce code duplication, and then a (slightly more
 major) change to define the controlling variable with defcustom so that
 the user can find the variable in the customize screen for notmuch.
 
 I also renamed it to notmuch-poll-script so you'll need to update your
 setting for this feature to work.

I appreciate how nicely you can say I liked the idea and then
completely rewrote the crap elisp that you submitted :-)

/D

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


Recent linker errors for notmuch-shared

2010-04-22 Thread Ben Gamari
Hey all,

When I pulled a few days ago I noticed that notmuch-shared failed to link due
to missing LDFLAGS. In particular, it seems that the linker flags don't include
CONFIGURE_LDFLAGS, meaning that all of the required external shared libraries
depedencies aren't linked against. Here is a patch to fix this. It works for
me, although perhaps this isn't what others envision. Thanks!

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


[PATCH] Fix linker error from insufficient LDFLAGS

2010-04-22 Thread Ben Gamari
It seems that LDFLAGS have recently been reorganized, along with the
introduction of a notmuch-shared rule. Unfortunately, the LDFLAGS used
in notmuch-shared don't include CONFIGURE_LDFLAGS. This caused linking
to fail with the following,

$ make V=1
gcc debugger.o gmime-filter-reply.o gmime-filter-headers.o notmuch.o 
notmuch-config.o notmuch-count.o notmuch-dump.o notmuch-new.o notmuch-reply.o 
notmuch-restore.o notmuch-search.o notmuch-search-tags.o notmuch-setup.o 
notmuch-show.o notmuch-tag.o notmuch-time.o query-string.o show-message.o 
json.o  -Llib -lnotmuch -o notmuch-shared
/usr/bin/ld: gmime-filter-reply.o: undefined reference to symbol 
'g_mime_filter_set_size'
/usr/bin/ld: note: 'g_mime_filter_set_size' is defined in DSO 
//usr/lib64/libgmime-2.4.so.2 so try adding it to the linker command line
//usr/lib64/libgmime-2.4.so.2: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
make: *** [notmuch-shared] Error 1
---
 Makefile.local |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Makefile.local b/Makefile.local
index 5bb570b..33b8213 100644
--- a/Makefile.local
+++ b/Makefile.local
@@ -31,7 +31,7 @@ GPG_FILE=$(SHA1_FILE).asc
 # Smash together user's values with our extra values
 FINAL_CFLAGS = -DNOTMUCH_VERSION=$(VERSION) $(CFLAGS) $(WARN_CFLAGS) 
$(CONFIGURE_CFLAGS) $(extra_cflags)
 FINAL_CXXFLAGS = $(CXXFLAGS) $(WARN_CXXFLAGS) $(CONFIGURE_CXXFLAGS) 
$(extra_cflags) $(extra_cxxflags)
-FINAL_NOTMUCH_LDFLAGS = $(LDFLAGS) -Llib -lnotmuch
+FINAL_NOTMUCH_LDFLAGS = $(LDFLAGS) -Llib -lnotmuch $(CONFIGURE_LDFLAGS)
 FINAL_NOTMUCH_LINKER = CC
 ifneq ($(LINKER_RESOLVES_LIBRARY_DEPENDENCIES),1)
 FINAL_NOTMUCH_LDFLAGS += $(CONFIGURE_LDFLAGS)
-- 
1.7.0.5

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


Re: [PATCH] First tests for JSON output and UTF-8 in mail body and subject

2010-04-22 Thread Carl Worth
On Wed, 14 Apr 2010 17:35:44 -0700, Carl Worth cwo...@cworth.org wrote:
 On Tue, 13 Apr 2010 18:37:57 +0200, Gregor Hoffleit gre...@hoffleit.de 
 wrote:
  The test suite doesn't yet cover --format=json output nor UTF-8 in
  subject or body.
  
  This patch starts with test cases for 'search --format=json' and
  'show --format=json'.
...
 So, a double thanks for this test, it seems to have uncovered another
 bug.

I've now fixed that bug, (hurrah for deleting code!), and pushed out
these tests, (which did have to be updated to apply to the current test
suite, but that was straightforward).

Thanks again for the tests.

-Carl


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


[PATCH] Makefile.local: Fix LDFLAGS for notmuch-shared

2010-04-22 Thread Adrien Bustany
This commit adds GMIME_LDFLAGS and TALLOC_LDFLAGS to the linker flags
when linking notmuch-shared. Without these flags, linking fails because
of undefined symbols.
---
 Makefile.local |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Makefile.local b/Makefile.local
index 5bb570b..37dd745 100644
--- a/Makefile.local
+++ b/Makefile.local
@@ -31,7 +31,7 @@ GPG_FILE=$(SHA1_FILE).asc
 # Smash together user's values with our extra values
 FINAL_CFLAGS = -DNOTMUCH_VERSION=$(VERSION) $(CFLAGS) $(WARN_CFLAGS) 
$(CONFIGURE_CFLAGS) $(extra_cflags)
 FINAL_CXXFLAGS = $(CXXFLAGS) $(WARN_CXXFLAGS) $(CONFIGURE_CXXFLAGS) 
$(extra_cflags) $(extra_cxxflags)
-FINAL_NOTMUCH_LDFLAGS = $(LDFLAGS) -Llib -lnotmuch
+FINAL_NOTMUCH_LDFLAGS = $(LDFLAGS) $(GMIME_LDFLAGS) $(TALLOC_LDFLAGS) -Llib 
-lnotmuch
 FINAL_NOTMUCH_LINKER = CC
 ifneq ($(LINKER_RESOLVES_LIBRARY_DEPENDENCIES),1)
 FINAL_NOTMUCH_LDFLAGS += $(CONFIGURE_LDFLAGS)
-- 
1.7.0.1

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


Add tests (and fix bug exposed by test) for author reordering

2010-04-22 Thread Dirk Hohndel

I want Carl to enforce the adding of tests. Once again writing the test exposed 
a bug 
that I hadn't noticed before. So here's the test plus the patch that fixes the 
bug.

/D

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


[PATCH 1/2] Add tests for author reordering

2010-04-22 Thread Dirk Hohndel
Test the different permutation of which authors match the search;
This exposes a bug in the existing reordering code

Signed-off-by: Dirk Hohndel hohn...@infradead.org
---
 test/notmuch-test |   27 +++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/test/notmuch-test b/test/notmuch-test
index 3c1cd9f..2b76f04 100755
--- a/test/notmuch-test
+++ b/test/notmuch-test
@@ -858,6 +858,33 @@ printf  Searching returns all three messages in one 
thread...
 output=$($NOTMUCH search foo | notmuch_search_sanitize)
 pass_if_equal $output thread:XXX   2000-01-01 [3/3] Notmuch Test Suite; 
brokenthreadtest (inbox unread)
 
+printf \nTesting author reordering;\n
+printf  Adding parent message...\t\t\t
+generate_message [body]=findme [id]=new-parent-id 
[subject]=author-reorder-threadtest '[from]=User u...@example.com' 
'[date]=Sat, 01 Jan 2000 12:00:00 -'
+output=$(NOTMUCH_NEW)
+pass_if_equal $output Added 1 new message to the database.
+printf  Adding initial child message...\t\t
+generate_message [body]=findme '[in-reply-to]=\new-parent-id\' 
[subject]=author-reorder-threadtest '[from]=User1 us...@example.com' 
'[date]=Sat, 01 Jan 2000 12:00:00 -'
+output=$(NOTMUCH_NEW)
+pass_if_equal $output Added 1 new message to the database.
+printf  Adding second child message...\t\t\t
+generate_message [body]=findme '[in-reply-to]=\new-parent-id\' 
[subject]=author-reorder-threadtest '[from]=User2 us...@example.com' 
'[date]=Sat, 01 Jan 2000 12:00:00 -'
+output=$(NOTMUCH_NEW)
+pass_if_equal $output Added 1 new message to the database.
+printf  Searching when all three messages match...\t
+output=$($NOTMUCH search findme | notmuch_search_sanitize)
+pass_if_equal $output thread:XXX   2000-01-01 [3/3] User, User1, User2; 
author-reorder-threadtest (inbox unread)
+printf  Searching when two messages match...\t\t
+output=$($NOTMUCH search User1 or User2 | notmuch_search_sanitize)
+pass_if_equal $output thread:XXX   2000-01-01 [2/3] User1, User2| User; 
author-reorder-threadtest (inbox unread)
+printf  Searching when only one message matches...\t
+output=$($NOTMUCH search User2 | notmuch_search_sanitize)
+pass_if_equal $output thread:XXX   2000-01-01 [1/3] User2| User, User1; 
author-reorder-threadtest (inbox unread)
+printf  Searching when only first message matches...\t
+output=$($NOTMUCH search User | notmuch_search_sanitize)
+pass_if_equal $output thread:XXX   2000-01-01 [1/3] User| User1, User2; 
author-reorder-threadtest (inbox unread)
+
+
 echo 
 echo Notmuch test suite complete.
 
-- 
1.6.6.1

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


  1   2   >