unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [RFC/PATCH] Add search-files command
@ 2010-01-13 10:24 Ali Polatel
  2010-01-13 12:44 ` Fernando Carrijo
  2010-01-13 13:17 ` [RFC/PATCH v2] " Ali Polatel
  0 siblings, 2 replies; 6+ messages in thread
From: Ali Polatel @ 2010-01-13 10:24 UTC (permalink / raw)
  To: notmuch

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 5444 bytes --]

This command can be used to integrate notmuch with other MUAs as a
searching client. The idea is simple, a simple script could get
search-terms as argument and create a "virtual" maildir which has
symbolic links to files output by search-files command. This is similar
to nmzmail.
---
 Makefile.local         |    1 +
 notmuch-client.h       |    3 +
 notmuch-search-files.c |  107 ++++++++++++++++++++++++++++++++++++++++++++++++
 notmuch.c              |   13 ++++++
 4 files changed, 124 insertions(+), 0 deletions(-)
 create mode 100644 notmuch-search-files.c

diff --git a/Makefile.local b/Makefile.local
index 933ff4c..78bc25d 100644
--- a/Makefile.local
+++ b/Makefile.local
@@ -12,6 +12,7 @@ notmuch_client_srcs =		\
 	notmuch-reply.c		\
 	notmuch-restore.c	\
 	notmuch-search.c	\
+	notmuch-search-files.c  \
 	notmuch-search-tags.c   \
 	notmuch-setup.c		\
 	notmuch-show.c		\
diff --git a/notmuch-client.h b/notmuch-client.h
index 77766de..d505d30 100644
--- a/notmuch-client.h
+++ b/notmuch-client.h
@@ -96,6 +96,9 @@ int
 notmuch_search_command (void *ctx, int argc, char *argv[]);
 
 int
+notmuch_search_files_command (void *ctx, int argc, char *argv[]);
+
+int
 notmuch_setup_command (void *ctx, int argc, char *argv[]);
 
 int
diff --git a/notmuch-search-files.c b/notmuch-search-files.c
new file mode 100644
index 0000000..b48783a
--- /dev/null
+++ b/notmuch-search-files.c
@@ -0,0 +1,107 @@
+/* notmuch - Not much of an email program, (just index and search)
+ *
+ * Copyright © 2009 Carl Worth
+ *
+ * This program 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.
+ *
+ * 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 this program.  If not, see http://www.gnu.org/licenses/ .
+ *
+ * Author: Ali Polatel <alip@exherbo.org>
+ */
+
+#include "notmuch-client.h"
+
+static void
+do_search_files (notmuch_query_t *query)
+{
+    notmuch_message_t *message;
+    notmuch_messages_t *messages;
+
+    for (messages = notmuch_query_search_messages (query);
+	 notmuch_messages_has_more (messages);
+	 notmuch_messages_advance (messages))
+    {
+	message = notmuch_messages_get (messages);
+	printf ("%s\n", notmuch_message_get_filename (message));
+	notmuch_message_destroy(message);
+    }
+}
+
+int
+notmuch_search_files_command (void *ctx, int argc, char *argv[])
+{
+    notmuch_config_t *config;
+    notmuch_database_t *notmuch;
+    notmuch_query_t *query;
+    char *query_str;
+    char *opt;
+    notmuch_sort_t sort = NOTMUCH_SORT_NEWEST_FIRST;
+    int i;
+
+    for (i = 0; i < argc && argv[i][0] == '-'; i++) {
+	if (strcmp (argv[i], "--") == 0) {
+	    i++;
+	    break;
+	}
+        if (STRNCMP_LITERAL (argv[i], "--sort=") == 0) {
+	    opt = argv[i] + sizeof ("--sort=") - 1;
+	    if (strcmp (opt, "oldest-first") == 0) {
+		sort = NOTMUCH_SORT_OLDEST_FIRST;
+	    } else if (strcmp (opt, "newest-first") == 0) {
+		sort = NOTMUCH_SORT_NEWEST_FIRST;
+	    } else {
+		fprintf (stderr, "Invalid value for --sort: %s\n", opt);
+		return 1;
+	    }
+	} else {
+	    fprintf (stderr, "Unrecognized option: %s\n", argv[i]);
+	    return 1;
+	}
+    }
+
+    argc -= i;
+    argv += i;
+
+    config = notmuch_config_open (ctx, NULL, NULL);
+    if (config == NULL)
+	return 1;
+
+    notmuch = notmuch_database_open (notmuch_config_get_database_path (config),
+				     NOTMUCH_DATABASE_MODE_READ_ONLY);
+    if (notmuch == NULL)
+	return 1;
+
+    query_str = query_string_from_args (ctx, argc, argv);
+    if (query_str == NULL) {
+	fprintf (stderr, "Out of memory.\n");
+	return 1;
+    }
+    if (*query_str == '\0') {
+	fprintf (stderr, "Error: notmuch search-files requires at least one search term.\n");
+	return 1;
+    }
+
+    query = notmuch_query_create (notmuch, query_str);
+    if (query == NULL) {
+	fprintf (stderr, "Out of memory\n");
+	return 1;
+    }
+
+    notmuch_query_set_sort (query, sort);
+
+    do_search_files (query);
+
+    notmuch_query_destroy (query);
+    notmuch_database_close (notmuch);
+
+    return 0;
+}
diff --git a/notmuch.c b/notmuch.c
index 87479f8..4907339 100644
--- a/notmuch.c
+++ b/notmuch.c
@@ -165,6 +165,19 @@ command_t commands[] = {
       "\n"
       "\t\tSee \"notmuch help search-terms\" for details of the search\n"
       "\t\tterms syntax." },
+    { "search-files", notmuch_search_files_command,
+      "[options...] <search-terms> [...]",
+      "\t\tSearch for filenames matching the given search terms.",
+      "\t\tSupported options for search-files include:\n"
+      "\n"
+      "\t\t--sort=(newest-first|oldest-first)\n"
+      "\n"
+      "\t\t\tPresent results in either chronological order\n"
+      "\t\t\t(oldest-first) or reverse chronological order\n"
+      "\t\t\t(newest-first), which is the default.\n"
+      "\n"
+      "\t\tSee \"notmuch help search-terms\" for details of the search\n"
+      "\t\tterms syntax." },
     { "show", notmuch_show_command,
       "<search-terms> [...]",
       "\t\tShow all messages matching the search terms.",
-- 
1.6.6

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

* Re: [RFC/PATCH] Add search-files command
  2010-01-13 10:24 [RFC/PATCH] Add search-files command Ali Polatel
@ 2010-01-13 12:44 ` Fernando Carrijo
  2010-01-13 13:11   ` Ali Polatel
  2010-01-13 13:17 ` [RFC/PATCH v2] " Ali Polatel
  1 sibling, 1 reply; 6+ messages in thread
From: Fernando Carrijo @ 2010-01-13 12:44 UTC (permalink / raw)
  To: Ali Polatel, notmuch

Hi Ali,

On Wed, 13 Jan 2010 12:24:22 +0200, Ali Polatel <alip@exherbo.org> wrote:

> This command can be used to integrate notmuch with other MUAs as a
> searching client. The idea is simple, a simple script could get
> search-terms as argument and create a "virtual" maildir which has
> symbolic links to files output by search-files command. This is similar
> to nmzmail.
> ---
>  Makefile.local         |    1 +
>  notmuch-client.h       |    3 +
>  notmuch-search-files.c |  107 ++++++++++++++++++++++++++++++++++++++++++++++++
>  notmuch.c              |   13 ++++++
>  4 files changed, 124 insertions(+), 0 deletions(-)
>  create mode 100644 notmuch-search-files.c
> 
> diff --git a/Makefile.local b/Makefile.local
> index 933ff4c..78bc25d 100644
> --- a/Makefile.local
> +++ b/Makefile.local
> @@ -12,6 +12,7 @@ notmuch_client_srcs =		\
>  	notmuch-reply.c		\
>  	notmuch-restore.c	\
>  	notmuch-search.c	\
> +	notmuch-search-files.c  \
>  	notmuch-search-tags.c   \
>  	notmuch-setup.c		\
>  	notmuch-show.c		\
> diff --git a/notmuch-client.h b/notmuch-client.h
> index 77766de..d505d30 100644
> --- a/notmuch-client.h
> +++ b/notmuch-client.h
> @@ -96,6 +96,9 @@ int
>  notmuch_search_command (void *ctx, int argc, char *argv[]);
>  
>  int
> +notmuch_search_files_command (void *ctx, int argc, char *argv[]);
> +
> +int
>  notmuch_setup_command (void *ctx, int argc, char *argv[]);
>  
>  int
> diff --git a/notmuch-search-files.c b/notmuch-search-files.c
> new file mode 100644
> index 0000000..b48783a
> --- /dev/null
> +++ b/notmuch-search-files.c
> @@ -0,0 +1,107 @@
> +/* notmuch - Not much of an email program, (just index and search)
> + *
> + * Copyright © 2009 Carl Worth

I almost certainly should not be speaking in the name of Carl, but a
few weeks ago he replied with the following words to a message which
somehow raised the discussion of copyright holding in notmuch source
code:

  "Please feel free to retain your own copyright. I certainly don't
   deserve anything being assigned to me."

The message-id of his reply is: 873a34tf8b.fsf@yoom.home.cworth.org,
just in the case you want to check the context in which it occurred.

> + *
> + * This program 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.
> + *
> + * 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 this program.  If not, see http://www.gnu.org/licenses/ .
> + *
> + * Author: Ali Polatel <alip@exherbo.org>
> + */
> +
> +#include "notmuch-client.h"
> +
> +static void
> +do_search_files (notmuch_query_t *query)
> +{
> +    notmuch_message_t *message;
> +    notmuch_messages_t *messages;
> +
> +    for (messages = notmuch_query_search_messages (query);
> +	 notmuch_messages_has_more (messages);
> +	 notmuch_messages_advance (messages))
> +    {
> +	message = notmuch_messages_get (messages);
> +	printf ("%s\n", notmuch_message_get_filename (message));
> +	notmuch_message_destroy(message);
> +    }
> +}
> +
> +int
> +notmuch_search_files_command (void *ctx, int argc, char *argv[])
> +{
> +    notmuch_config_t *config;
> +    notmuch_database_t *notmuch;
> +    notmuch_query_t *query;
> +    char *query_str;
> +    char *opt;
> +    notmuch_sort_t sort = NOTMUCH_SORT_NEWEST_FIRST;
> +    int i;
> +
> +    for (i = 0; i < argc && argv[i][0] == '-'; i++) {
> +	if (strcmp (argv[i], "--") == 0) {
> +	    i++;
> +	    break;
> +	}
> +        if (STRNCMP_LITERAL (argv[i], "--sort=") == 0) {
> +	    opt = argv[i] + sizeof ("--sort=") - 1;
> +	    if (strcmp (opt, "oldest-first") == 0) {
> +		sort = NOTMUCH_SORT_OLDEST_FIRST;
> +	    } else if (strcmp (opt, "newest-first") == 0) {
> +		sort = NOTMUCH_SORT_NEWEST_FIRST;
> +	    } else {
> +		fprintf (stderr, "Invalid value for --sort: %s\n", opt);
> +		return 1;
> +	    }
> +	} else {
> +	    fprintf (stderr, "Unrecognized option: %s\n", argv[i]);
> +	    return 1;
> +	}
> +    }
> +
> +    argc -= i;
> +    argv += i;
> +
> +    config = notmuch_config_open (ctx, NULL, NULL);
> +    if (config == NULL)
> +	return 1;
> +
> +    notmuch = notmuch_database_open (notmuch_config_get_database_path (config),
> +				     NOTMUCH_DATABASE_MODE_READ_ONLY);
> +    if (notmuch == NULL)
> +	return 1;
> +
> +    query_str = query_string_from_args (ctx, argc, argv);
> +    if (query_str == NULL) {
> +	fprintf (stderr, "Out of memory.\n");
> +	return 1;
> +    }
> +    if (*query_str == '\0') {
> +	fprintf (stderr, "Error: notmuch search-files requires at least one search term.\n");

Could we break this line so that it did not go beyond the column limit
set by the coding conventions? Maybe we should go one step further and
import the file CODING_STYLE from cairo into notmuch's repository.

> +	return 1;
> +    }
> +
> +    query = notmuch_query_create (notmuch, query_str);
> +    if (query == NULL) {
> +	fprintf (stderr, "Out of memory\n");
> +	return 1;
> +    }
> +
> +    notmuch_query_set_sort (query, sort);
> +
> +    do_search_files (query);
> +
> +    notmuch_query_destroy (query);
> +    notmuch_database_close (notmuch);

It is not something of major importance, but I realized that the
function notmuch_config_close is only being called when notmuch is
executed with no arguments. As we know, the kernel shall close all
open file descriptors upon program termination, but wouldn't it be
better if we did it explicitly? Or did I overlook something?

Kind regards,
Fernando Carrijo.

> +
> +    return 0;
> +}
> diff --git a/notmuch.c b/notmuch.c
> index 87479f8..4907339 100644
> --- a/notmuch.c
> +++ b/notmuch.c
> @@ -165,6 +165,19 @@ command_t commands[] = {
>        "\n"
>        "\t\tSee \"notmuch help search-terms\" for details of the search\n"
>        "\t\tterms syntax." },
> +    { "search-files", notmuch_search_files_command,
> +      "[options...] <search-terms> [...]",
> +      "\t\tSearch for filenames matching the given search terms.",
> +      "\t\tSupported options for search-files include:\n"
> +      "\n"
> +      "\t\t--sort=(newest-first|oldest-first)\n"
> +      "\n"
> +      "\t\t\tPresent results in either chronological order\n"
> +      "\t\t\t(oldest-first) or reverse chronological order\n"
> +      "\t\t\t(newest-first), which is the default.\n"
> +      "\n"
> +      "\t\tSee \"notmuch help search-terms\" for details of the search\n"
> +      "\t\tterms syntax." },
>      { "show", notmuch_show_command,
>        "<search-terms> [...]",
>        "\t\tShow all messages matching the search terms.",
> -- 
> 1.6.6
> 
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

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

* Re: [RFC/PATCH] Add search-files command
  2010-01-13 12:44 ` Fernando Carrijo
@ 2010-01-13 13:11   ` Ali Polatel
  0 siblings, 0 replies; 6+ messages in thread
From: Ali Polatel @ 2010-01-13 13:11 UTC (permalink / raw)
  To: Fernando Carrijo; +Cc: notmuch

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

Fernando Carrijo yazmış:
> Hi Ali,

Hey Fernando,

> On Wed, 13 Jan 2010 12:24:22 +0200, Ali Polatel <alip@exherbo.org> wrote:
<snip>
> > diff --git a/notmuch-search-files.c b/notmuch-search-files.c
> > new file mode 100644
> > index 0000000..b48783a
> > --- /dev/null
> > +++ b/notmuch-search-files.c
> > @@ -0,0 +1,107 @@
> > +/* notmuch - Not much of an email program, (just index and search)
> > + *
> > + * Copyright © 2009 Carl Worth
> 
> I almost certainly should not be speaking in the name of Carl, but a
> few weeks ago he replied with the following words to a message which
> somehow raised the discussion of copyright holding in notmuch source
> code:
> 
>   "Please feel free to retain your own copyright. I certainly don't
>    deserve anything being assigned to me."
> 
> The message-id of his reply is: 873a34tf8b.fsf@yoom.home.cworth.org,
> just in the case you want to check the context in which it occurred.
> 

Thanks, I don't really care about who owns the copyright as long as it's
open source but I'll change it if that's what Carl wishes.

<snip>
> > +    if (*query_str == '\0') {
> > +	fprintf (stderr, "Error: notmuch search-files requires at least one search term.\n");
> 
> Could we break this line so that it did not go beyond the column limit
> set by the coding conventions? Maybe we should go one step further and
> import the file CODING_STYLE from cairo into notmuch's repository.
> 

Sure, I didn't know much about the coding style and as you said there's
no document about it in notmuch's repository.

> > +	return 1;
> > +    }
> > +
> > +    query = notmuch_query_create (notmuch, query_str);
> > +    if (query == NULL) {
> > +	fprintf (stderr, "Out of memory\n");
> > +	return 1;
> > +    }
> > +
> > +    notmuch_query_set_sort (query, sort);
> > +
> > +    do_search_files (query);
> > +
> > +    notmuch_query_destroy (query);
> > +    notmuch_database_close (notmuch);
> 
> It is not something of major importance, but I realized that the
> function notmuch_config_close is only being called when notmuch is
> executed with no arguments. As we know, the kernel shall close all
> open file descriptors upon program termination, but wouldn't it be
> better if we did it explicitly? Or did I overlook something?
> 

Nope, it's good coding practise to free all resources before exit, I
didn't do it for config because neither the search command does it.
I'll send an updated patch soonish and I'll also send a separate patch
for notmuch-search.c as well.

> Kind regards,
> Fernando Carrijo.
> 

-- 
Regards,
Ali Polatel

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

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

* [RFC/PATCH v2] Add search-files command
  2010-01-13 10:24 [RFC/PATCH] Add search-files command Ali Polatel
  2010-01-13 12:44 ` Fernando Carrijo
@ 2010-01-13 13:17 ` Ali Polatel
  2010-01-13 22:52   ` Jameson Rollins
  1 sibling, 1 reply; 6+ messages in thread
From: Ali Polatel @ 2010-01-13 13:17 UTC (permalink / raw)
  To: notmuch

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 5593 bytes --]

This command can be used to integrate notmuch with other MUAs as a
searching client. The idea is simple, a simple script could get
search-terms as argument and create a "virtual" maildir which has
symbolic links to files output by search-files command. This is similar
to nmzmail.

Version 2:
- Update copyright
- Respect coding style about long lines
- Free config structure on exit

---
 Makefile.local         |    1 +
 notmuch-client.h       |    3 +
 notmuch-search-files.c |  109 ++++++++++++++++++++++++++++++++++++++++++++++++
 notmuch.c              |   13 ++++++
 4 files changed, 126 insertions(+), 0 deletions(-)
 create mode 100644 notmuch-search-files.c

diff --git a/Makefile.local b/Makefile.local
index 933ff4c..78bc25d 100644
--- a/Makefile.local
+++ b/Makefile.local
@@ -12,6 +12,7 @@ notmuch_client_srcs =		\
 	notmuch-reply.c		\
 	notmuch-restore.c	\
 	notmuch-search.c	\
+	notmuch-search-files.c  \
 	notmuch-search-tags.c   \
 	notmuch-setup.c		\
 	notmuch-show.c		\
diff --git a/notmuch-client.h b/notmuch-client.h
index 77766de..d505d30 100644
--- a/notmuch-client.h
+++ b/notmuch-client.h
@@ -96,6 +96,9 @@ int
 notmuch_search_command (void *ctx, int argc, char *argv[]);
 
 int
+notmuch_search_files_command (void *ctx, int argc, char *argv[]);
+
+int
 notmuch_setup_command (void *ctx, int argc, char *argv[]);
 
 int
diff --git a/notmuch-search-files.c b/notmuch-search-files.c
new file mode 100644
index 0000000..7b6d14d
--- /dev/null
+++ b/notmuch-search-files.c
@@ -0,0 +1,109 @@
+/* notmuch - Not much of an email program, (just index and search)
+ *
+ * Copyright © 2010 Ali Polatel
+ *
+ * This program 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.
+ *
+ * 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 this program.  If not, see http://www.gnu.org/licenses/ .
+ *
+ * Author: Ali Polatel <alip@exherbo.org>
+ */
+
+#include "notmuch-client.h"
+
+static void
+do_search_files (notmuch_query_t *query)
+{
+    notmuch_message_t *message;
+    notmuch_messages_t *messages;
+
+    for (messages = notmuch_query_search_messages (query);
+	 notmuch_messages_has_more (messages);
+	 notmuch_messages_advance (messages))
+    {
+	message = notmuch_messages_get (messages);
+	printf ("%s\n", notmuch_message_get_filename (message));
+	notmuch_message_destroy(message);
+    }
+}
+
+int
+notmuch_search_files_command (void *ctx, int argc, char *argv[])
+{
+    notmuch_config_t *config;
+    notmuch_database_t *notmuch;
+    notmuch_query_t *query;
+    char *query_str;
+    char *opt;
+    notmuch_sort_t sort = NOTMUCH_SORT_NEWEST_FIRST;
+    int i;
+
+    for (i = 0; i < argc && argv[i][0] == '-'; i++) {
+	if (strcmp (argv[i], "--") == 0) {
+	    i++;
+	    break;
+	}
+        if (STRNCMP_LITERAL (argv[i], "--sort=") == 0) {
+	    opt = argv[i] + sizeof ("--sort=") - 1;
+	    if (strcmp (opt, "oldest-first") == 0) {
+		sort = NOTMUCH_SORT_OLDEST_FIRST;
+	    } else if (strcmp (opt, "newest-first") == 0) {
+		sort = NOTMUCH_SORT_NEWEST_FIRST;
+	    } else {
+		fprintf (stderr, "Invalid value for --sort: %s\n", opt);
+		return 1;
+	    }
+	} else {
+	    fprintf (stderr, "Unrecognized option: %s\n", argv[i]);
+	    return 1;
+	}
+    }
+
+    argc -= i;
+    argv += i;
+
+    config = notmuch_config_open (ctx, NULL, NULL);
+    if (config == NULL)
+	return 1;
+
+    notmuch = notmuch_database_open (notmuch_config_get_database_path (config),
+				     NOTMUCH_DATABASE_MODE_READ_ONLY);
+    if (notmuch == NULL)
+	return 1;
+
+    query_str = query_string_from_args (ctx, argc, argv);
+    if (query_str == NULL) {
+	fprintf (stderr, "Out of memory.\n");
+	return 1;
+    }
+    if (*query_str == '\0') {
+	fprintf (stderr, "Error: notmuch search-files requires"
+			 " at least one search term.\n");
+	return 1;
+    }
+
+    query = notmuch_query_create (notmuch, query_str);
+    if (query == NULL) {
+	fprintf (stderr, "Out of memory\n");
+	return 1;
+    }
+
+    notmuch_query_set_sort (query, sort);
+
+    do_search_files (query);
+
+    notmuch_config_close (config);
+    notmuch_query_destroy (query);
+    notmuch_database_close (notmuch);
+
+    return 0;
+}
diff --git a/notmuch.c b/notmuch.c
index 87479f8..4907339 100644
--- a/notmuch.c
+++ b/notmuch.c
@@ -165,6 +165,19 @@ command_t commands[] = {
       "\n"
       "\t\tSee \"notmuch help search-terms\" for details of the search\n"
       "\t\tterms syntax." },
+    { "search-files", notmuch_search_files_command,
+      "[options...] <search-terms> [...]",
+      "\t\tSearch for filenames matching the given search terms.",
+      "\t\tSupported options for search-files include:\n"
+      "\n"
+      "\t\t--sort=(newest-first|oldest-first)\n"
+      "\n"
+      "\t\t\tPresent results in either chronological order\n"
+      "\t\t\t(oldest-first) or reverse chronological order\n"
+      "\t\t\t(newest-first), which is the default.\n"
+      "\n"
+      "\t\tSee \"notmuch help search-terms\" for details of the search\n"
+      "\t\tterms syntax." },
     { "show", notmuch_show_command,
       "<search-terms> [...]",
       "\t\tShow all messages matching the search terms.",
-- 
1.6.6

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

* Re: [RFC/PATCH v2] Add search-files command
  2010-01-13 13:17 ` [RFC/PATCH v2] " Ali Polatel
@ 2010-01-13 22:52   ` Jameson Rollins
  2010-01-14  6:36     ` Ali Polatel
  0 siblings, 1 reply; 6+ messages in thread
From: Jameson Rollins @ 2010-01-13 22:52 UTC (permalink / raw)
  To: Ali Polatel; +Cc: notmuch

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

On Wed, Jan 13, 2010 at 03:17:41PM +0200, Ali Polatel wrote:
> This command can be used to integrate notmuch with other MUAs as a
> searching client. The idea is simple, a simple script could get
> search-terms as argument and create a "virtual" maildir which has
> symbolic links to files output by search-files command. This is similar
> to nmzmail.

Hi, Ali.  I was also recently asking about a way to output just the
file names of message resulting from searches.  This is an important
feature for handling deleting and moving in mail clients as well.  I
believe that Carl said this would be easier once he applied the JSON
output patches that are in the queue right now.  Hopefully we'll see
those soon.

Personally I think the right way to implement this from a UI
perspective would be to just have an output filter for the 'search'
subcommand, something like:

notmuch search --output=filename <search-term>...

If output formatting was well enough supported one could even imagine
getting rid of the 'show' subcommand in favor of just the 'search'
subcommand with output formatting options.

jamie.

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

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

* Re: [RFC/PATCH v2] Add search-files command
  2010-01-13 22:52   ` Jameson Rollins
@ 2010-01-14  6:36     ` Ali Polatel
  0 siblings, 0 replies; 6+ messages in thread
From: Ali Polatel @ 2010-01-14  6:36 UTC (permalink / raw)
  To: Jameson Rollins; +Cc: notmuch

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

Jameson Rollins yazmış:
> On Wed, Jan 13, 2010 at 03:17:41PM +0200, Ali Polatel wrote:
> > This command can be used to integrate notmuch with other MUAs as a
> > searching client. The idea is simple, a simple script could get
> > search-terms as argument and create a "virtual" maildir which has
> > symbolic links to files output by search-files command. This is similar
> > to nmzmail.
> 
> Hi, Ali.  I was also recently asking about a way to output just the
> file names of message resulting from searches.  This is an important
> feature for handling deleting and moving in mail clients as well.  I
> believe that Carl said this would be easier once he applied the JSON
> output patches that are in the queue right now.  Hopefully we'll see
> those soon.
> 
> Personally I think the right way to implement this from a UI
> perspective would be to just have an output filter for the 'search'
> subcommand, something like:
> 
> notmuch search --output=filename <search-term>...
> 
> If output formatting was well enough supported one could even imagine
> getting rid of the 'show' subcommand in favor of just the 'search'
> subcommand with output formatting options.

That's even better! I think I'll be using my patch until these patches
are merged :)

> 
> jamie.

-- 
Regards,
Ali Polatel

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

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

end of thread, other threads:[~2010-01-14  6:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-13 10:24 [RFC/PATCH] Add search-files command Ali Polatel
2010-01-13 12:44 ` Fernando Carrijo
2010-01-13 13:11   ` Ali Polatel
2010-01-13 13:17 ` [RFC/PATCH v2] " Ali Polatel
2010-01-13 22:52   ` Jameson Rollins
2010-01-14  6:36     ` Ali Polatel

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).