queries switching from MH-E to notmuch

2011-08-18 Thread Stephen Eglen

[Apologies if this has gone through more than once, I've been having
problems subscribing.]

I'd like to switching emacs mailers, from MH-E to notmuch, as I need a
mailer with decent IMAP support.  Compared to gnus, notmuch (with
offlineimap) seems much quicker, and I like the sound of tags + fast
searching.  Can anyone help with the following points:

1. Deleting emails 

I've seen the suggestions on the emacstips for  keybindings to bind 'd'
to adding deleted tags.  But how do you then delete the mails from
the local Maildir (and then for offlineimap to propagate back the
deletions to the remote imap server)?  Do you run cron jobs to do this?

2. viewing both the search results and current thread

I'm used to the MH-E (and VM) idea that when browsing a folder (or, here,
search results) the top window shows the subject lines, and the bottom,
larger, window shows the current message.  e.g. see the top screenshot
at: http://mh-e.sourceforge.net/screenshots/.  As you scroll through the
folder contents at the top, the bottom window shows the corresponding message.

By contrast, in notmuch it seems that you either see just the search
results, or one thread, but not both.  Would it be feasible to get
something more like the behaviour of VM and MH-E?  I can write elisp
fluently, but before I look into it, I thought I'd check to see whether
this is feasible.  (I've just seen that this is the bottom item on Keith
P's wish list: http://keithp.com/notmuch/)

Thanks,
Stephen


gmail syncing sort of working

2011-08-18 Thread Sebastian Spaeth
On Wed, 17 Aug 2011 19:31:36 -0700, Alex Botero-Lowry  wrote:
> p.s. I also ran into an issue with the notmuch python bindings where I had
> to wrap every c_void_p in POINTER() or it would segfault for any method that
> tried to use a pointer. Also the sed command that tries to build notmuch.sym
> doesn't work on freebsd, i changed it to work, but i'm pretty sure it won't
> work on linux anymore. :) I wonder if using ctags might actually work for
> that.

Can someone with experience on python's ctypes comment on that? I read
the terse documentation and tutorial on ctypes, and it doesn't say that
one shouldn't be able to use c_void_p as a pointer, and it doesn't
really say how using POINTER could change things (it seems to create a
new pointer type, but I fail to see why that should help?)

That having said, if you provide a patch, I'll be applying it if it
fixes things.

Sebastian
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20110818/ee42d721/attachment.pgp>


Re: gmail syncing sort of working

2011-08-18 Thread Sebastian Spaeth
On Wed, 17 Aug 2011 19:31:36 -0700, Alex Botero-Lowry 
alex.boterolo...@gmail.com wrote:
 p.s. I also ran into an issue with the notmuch python bindings where I had
 to wrap every c_void_p in POINTER() or it would segfault for any method that
 tried to use a pointer. Also the sed command that tries to build notmuch.sym
 doesn't work on freebsd, i changed it to work, but i'm pretty sure it won't
 work on linux anymore. :) I wonder if using ctags might actually work for
 that.

Can someone with experience on python's ctypes comment on that? I read
the terse documentation and tutorial on ctypes, and it doesn't say that
one shouldn't be able to use c_void_p as a pointer, and it doesn't
really say how using POINTER could change things (it seems to create a
new pointer type, but I fail to see why that should help?)

That having said, if you provide a patch, I'll be applying it if it
fixes things.

Sebastian


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


queries switching from MH-E to notmuch

2011-08-18 Thread Stephen Eglen

[Apologies if this has gone through more than once, I've been having
problems subscribing.]

I'd like to switching emacs mailers, from MH-E to notmuch, as I need a
mailer with decent IMAP support.  Compared to gnus, notmuch (with
offlineimap) seems much quicker, and I like the sound of tags + fast
searching.  Can anyone help with the following points:

1. Deleting emails 

I've seen the suggestions on the emacstips for  keybindings to bind 'd'
to adding deleted tags.  But how do you then delete the mails from
the local Maildir (and then for offlineimap to propagate back the
deletions to the remote imap server)?  Do you run cron jobs to do this?

2. viewing both the search results and current thread

I'm used to the MH-E (and VM) idea that when browsing a folder (or, here,
search results) the top window shows the subject lines, and the bottom,
larger, window shows the current message.  e.g. see the top screenshot
at: http://mh-e.sourceforge.net/screenshots/.  As you scroll through the
folder contents at the top, the bottom window shows the corresponding message.

By contrast, in notmuch it seems that you either see just the search
results, or one thread, but not both.  Would it be feasible to get
something more like the behaviour of VM and MH-E?  I can write elisp
fluently, but before I look into it, I thought I'd check to see whether
this is feasible.  (I've just seen that this is the bottom item on Keith
P's wish list: http://keithp.com/notmuch/)

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


[PATCH] Added --initial-index and --last-index to search/show

2011-08-18 Thread James Vasile
Sometimes you need to ask notmuch for just a few messages, and notmuch
supports that with date range options.  Date ranges, however, are not
sufficient for an application that is paging and just wants message x
through y, then x+d through y+d, etc.  And if you're sending the json
results of a search to a client for rendering, it makes sense to just
send the small ranges the client actually wants.

This patch implements --initial-index and --last-index as options to
search and show.  It lets you select the xth through the yth message
and receive results that pertain only to those messages.

I did not enable this option for results specifying --output=tags
since the output of a tag search isn't much data.
---
 notmuch-search.c |   48 ++--
 notmuch-show.c   |   30 ++
 notmuch.1|   32 
 notmuch.c|   18 +-
 4 files changed, 117 insertions(+), 11 deletions(-)

diff --git a/notmuch-search.c b/notmuch-search.c
index faccaf7..f7deb4a 100644
--- a/notmuch-search.c
+++ b/notmuch-search.c
@@ -194,7 +194,9 @@ static int
 do_search_threads (const search_format_t *format,
   notmuch_query_t *query,
   notmuch_sort_t sort,
-  output_t output)
+  output_t output,
+  int initial_thread,
+  int last_thread)
 {
 notmuch_thread_t *thread;
 notmuch_threads_t *threads;
@@ -208,8 +210,15 @@ do_search_threads (const search_format_t *format,
 
 fputs (format-results_start, stdout);
 
+last_thread -= initial_thread;
+
+for (;
+initial_thread  0  notmuch_threads_valid (threads);
+notmuch_threads_move_to_next (threads))
+   initial_thread--;
+
 for (;
-notmuch_threads_valid (threads);
+last_thread != 0  notmuch_threads_valid (threads);
 notmuch_threads_move_to_next (threads))
 {
int first_tag = 1;
@@ -258,6 +267,7 @@ do_search_threads (const search_format_t *format,
first_thread = 0;
 
notmuch_thread_destroy (thread);
+   last_thread--;
 }
 
 if (first_thread)
@@ -271,7 +281,9 @@ do_search_threads (const search_format_t *format,
 static int
 do_search_messages (const search_format_t *format,
notmuch_query_t *query,
-   output_t output)
+   output_t output,
+   int initial_message,
+   int last_message)
 {
 notmuch_message_t *message;
 notmuch_messages_t *messages;
@@ -284,8 +296,15 @@ do_search_messages (const search_format_t *format,
 
 fputs (format-results_start, stdout);
 
+last_message -= initial_message;
+
+for (;
+initial_message  0  notmuch_messages_valid (messages);   
+notmuch_messages_move_to_next (messages))
+   initial_message--;
+
 for (;
-notmuch_messages_valid (messages);
+last_message != 0  notmuch_messages_valid (messages); 
 notmuch_messages_move_to_next (messages))
 {
message = notmuch_messages_get (messages);
@@ -318,6 +337,7 @@ do_search_messages (const search_format_t *format,
}
 
notmuch_message_destroy (message);
+   last_message--;
 }
 
 notmuch_messages_destroy (messages);
@@ -394,6 +414,8 @@ notmuch_search_command (void *ctx, int argc, char *argv[])
 const search_format_t *format = format_text;
 int i, ret;
 output_t output = OUTPUT_SUMMARY;
+int initial_index = 0;
+int last_index = -1;
 
 for (i = 0; i  argc  argv[i][0] == '-'; i++) {
if (strcmp (argv[i], --) == 0) {
@@ -420,6 +442,16 @@ notmuch_search_command (void *ctx, int argc, char *argv[])
fprintf (stderr, Invalid value for --format: %s\n, opt);
return 1;
}
+   } else if (STRNCMP_LITERAL (argv[i], --last-index=) == 0) {
+   opt = argv[i] + sizeof (--last-index=) - 1;
+   last_index = atoi(opt);
+   if (last_index == 0) {
+   fprintf (stderr, Last index set to 0.\n);
+   return 1;
+   }
+   } else if (STRNCMP_LITERAL (argv[i], --initial-index=) == 0) {
+   opt = argv[i] + sizeof (--initial-index=) - 1;
+   initial_index = atoi(opt);
} else if (STRNCMP_LITERAL (argv[i], --output=) == 0) {
opt = argv[i] + sizeof (--output=) - 1;
if (strcmp (opt, summary) == 0) {
@@ -476,13 +508,17 @@ notmuch_search_command (void *ctx, int argc, char *argv[])
 default:
 case OUTPUT_SUMMARY:
 case OUTPUT_THREADS:
-   ret = do_search_threads (format, query, sort, output);
+   ret = do_search_threads (format, query, sort, output, initial_index, 
last_index);
break;
 case OUTPUT_MESSAGES:
 case OUTPUT_FILES:
-   ret = do_search_messages (format, query, output);
+   ret = do_search_messages (format, query, output,