[PATCH] Set fill column to 70 in .dir-locals.el and refactor other settings.

2012-01-13 Thread Xavier Maillard

This controls where comments and other text wraps.  70 is the default
value, so this simply returns it to the default for people who have
overridden it.  Most notmuch code already adheres to this.
---
SO here is the patch (still sorry if I did it wrongly and very badly).

 .dir-locals.el |   19 ++-
 1 files changed, 6 insertions(+), 13 deletions(-)

diff --git a/.dir-locals.el b/.dir-locals.el
index aea630b..27f01c0 100644
--- a/.dir-locals.el
+++ b/.dir-locals.el
@@ -1,23 +1,16 @@
-; emacs local configuration settings for notmuch source
-; surmised by dkg on 2010-11-23 13:43:18-0500
-; amended by amdragon on 2011-06-06
+;; emacs local configuration settings for notmuch source
+;; surmised by dkg on 2010-11-23 13:43:18-0500
+;; amended by amdragon on 2011-06-06

-((c-mode
+((nil
   (indent-tabs-mode . t)
   (tab-width . 8)
   (c-basic-offset . 4)
+  (fill-column . 70))
+ (c-mode
   (c-file-style . "linux"))
  (c++-mode
-  (indent-tabs-mode . t)
-  (tab-width . 8)
-  (c-basic-offset . 4)
   (c-file-style . "linux"))
- (emacs-lisp-mode
-  (indent-tabs-mode . t)
-  (tab-width . 8))
  (shell-mode
-  (indent-tabs-mode . t)
-  (tab-width . 8)
-  (sh-basic-offset . 4)
   (sh-indentation . 4))
  )
-- 
1.7.1



[PATCH] Set fill column to 70 in .dir-locals.el.

2012-01-13 Thread Xavier Maillard
Sorry if it is not correct to act like this (did I ever tell how n00b I
am when it comes to git ?).

So I wanted to /amend/ your patch to add some refactoring to it.

I hope this will not hurt :/


/Xavier



[PATCH] emacs: whitespace-cleanup for emacs/*.el files

2012-01-13 Thread Xavier Maillard
On Fri, 13 Jan 2012 11:50:52 +0200, Tomi Ollila  wrote:
> On Fri, 13 Jan 2012 08:22:49 +, David Edmondson  wrote:
> > On Thu, 12 Jan 2012 23:07:03 +0100, Xavier Maillard  
> > wrote:
> > > On Wed, 11 Jan 2012 17:13:35 +0200, Tomi Ollila  
> > > wrote:
> > > > Executed
> > > > for f in emacs/*.el
> > > > do emacs -q --batch --eval \
> > > > "(progn (find-file \"$f\") (whitespace-cleanup) (save-buffer))"
> > > > done
> > > > 
> > > > which
> > > > removed trailing whitespace and empty lines at the end of file
> > > > removed spaces before tab (if any)
> > > > converted 8 spaces to tabs in the beginning of line
> > > 
> > > +1
> > > 
> > > Maybe we should note something about this as a /coding style/ rule ?
> > 
> > How about "Running `indent-region' over the file should produce no
> > changes" as well?
> 
> So, In addition to 'uncrustify.cfg' we need emacs reformatter along lines:

What about doing all of this directly in .dir-locals.el (could be
considered unsafe though to add an EVAL block).

/Xavier


[PATCH] Fix build warning: "/*" within comment

2012-01-13 Thread Austin Clements
---
 notmuch-show.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/notmuch-show.c b/notmuch-show.c
index 87a1c90..d14dac9 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -677,7 +677,7 @@ format_part_content_json (GMimeObject *part)

 if (g_mime_content_type_is_type (content_type, "text", "*"))
 {
-   /* For non-HTML text/* parts, we include the content in the
+   /* For non-HTML text parts, we include the content in the
 * JSON. Since JSON must be Unicode, we handle charset
 * decoding here and do not report a charset to the caller.
 * For text/html parts, we do not include the content. If a
-- 
1.7.7.3



[PATCH 2/2] notmuch-dev: Update the master branch when requested.

2012-01-13 Thread Xavier Maillard
Hi David,

Have you planned to cook something about this in notmuch wiki ?
That sounds like something I could use to test patches more easily than
I do currently.

Note: I am totally a dummy when I have to use git :/

Regards

/Xavier


[PATCH] Set fill column to 70 in .dir-locals.el.

2012-01-13 Thread David Bremner
On Thu, 12 Jan 2012 18:17:23 -0500, Austin Clements  wrote:
> This controls where comments and other text wraps.  70 is the default
> value, so this simply returns it to the default for people who have
> overridden it.  Most notmuch code already adheres to this.
> ---

pushed.

d


[PATCH v3] notmuch/emacs: Observe the charset of text/html parts, where known.

2012-01-13 Thread David Bremner
On Fri, 13 Jan 2012 09:44:46 +, David Edmondson  wrote:
> Add the charset of text/html parts to the JSON output of 'notmuch
> -show' when it is known. Observe the encoding when rendering such
> parts in emacs.
> ---

pushed


[PATCH v2 1/3] count: Convert to new-style argument parsing

2012-01-13 Thread David Bremner
On Fri, 13 Jan 2012 18:07:02 -0500, Austin Clements  wrote:
> ---
>  notmuch-count.c |   53 +
>  1 files changed, 25 insertions(+), 28 deletions(-)

This seems independent of the rest of the series, and kindof obvious by
this point, so I pushed it.

d



revised patch for gmime init, with test.

2012-01-13 Thread David Bremner
On Fri, 13 Jan 2012 12:52:48 -0800, Jameson Graef Rollins  wrote:
> 
> Doesn't everything need to be merged into master eventually anyway?  It
> seems to me that unless it's a change that very narrowly targeting an
> issue in a release branch that is not an issue in master, every patch
> will ultimately need to be applied to both.  It doesn't really make
> sense to me to apply a change to one branch and not the other, if they
> will eventually need to be applied to both anyway.

The following two sequences of commands apply the same changes, but
result in a different history graph.

1) notmuch checkout release && git am patch  && \
   notmuch checkout master && git cherry-pick release

2) notmuch checkout release && git am patch  && \
   notmuch checkout master && git merge release

well, they apply the same changes if release was an ancestor of master
when the they both began.



[PATCH] emacs: whitespace-cleanup for emacs/*.el files

2012-01-13 Thread David Bremner
On Fri, 13 Jan 2012 23:27:11 +0100, Xavier Maillard  wrote:
> 
> What about doing all of this directly in .dir-locals.el (could be
> considered unsafe though to add an EVAL block).
> 

I'm not crazy about this ideas, it sounds like it has the potential to
mix whitespace changes in with out changes in a commit. It also seems a
bit rude to do that to people, but maybe the latter is just conservatism.

d


notmuch release 0.11 now available

2012-01-13 Thread David Bremner

Where to obtain notmuch 0.11
===
  http://notmuchmail.org/releases/notmuch-0.11.tar.gz

Which can be verified with:

  http://notmuchmail.org/releases/notmuch-0.11.tar.gz.sha1
  11eb1d967af089ed36f6816f61ebae308bc19339  notmuch-0.11.tar.gz

  http://notmuchmail.org/releases/notmuch-0.11.tar.gz.sha1.asc
  (signed by David Bremner)

What's new in notmuch 0.11
=

Command-Line Interface
--

Hooks

  Hooks have been introduced to notmuch. Hooks are scripts that notmuch
  invokes before and after certain actions. Initially, "notmuch new"
  supports "pre-new" and "post-new" hooks that are run before and after
  importing new messages into the database.

notmuch reply --decrypt bugfix

  The "notmuch reply" command with --decrypt argument had a rarely
  occurring bug that caused an encrypted message not to be decrypted
  sometimes. This is now fixed.

Performance
---

Automatic tag query optimization

  "notmuch tag" now automatically optimizes the user's query to
  exclude messages whose tags won't change.  In the past, we've
  suggested that people do this by hand; this is no longer necessary.

Don't sort messages when creating a dump file

  This speeds up tag dumps considerably, without any loss of
  information. To replicate the old behavior of sorted output (for
  example to compare two dump files), one can use e.g. sort(1).

Memory Management
-

Reduction of memory leaks

  Two memory leaks when searching and showing messages were identified
  and fixed in this release.

Emacs Interface
---

Bug fixes

  notmuch-show-advance (bound to the spacebar in notmuch-show-mode) had
  a bug that caused it to always jump to the next message, even if it
  should have scrolled down to show more of the current message instead.
  This is now fixed.

Support "notmuch new" as a notmuch-poll-script

  It's now possible to use "notmuch new" as a notmuch-poll-script
  directly. This is also the new default. This allows taking better
  advantage of the "notmuch new" hooks from emacs without intermediate
  scripts.

Improvements in saved search management

  New saved searches are now appended to the list of saved searches,
  not inserted in front. It's also possible to define a sort function
  for displaying saved searches; alphabetical sort is provided.

Hooks for notmuch-hello

  Two new hooks have been added: "notmuch-hello-mode-hook" (called after
  entering notmuch-hello-mode) and "notmuch-hello-refresh-hook" (called
  after updating a notmuch-hello buffer).

New face for crypto parts headers

  Crypto parts used to be displayed with a hardcoded color. A new face
  has been introduced to fix this: notmuch-crypto-part-header. It
  defaults to the same value as before, but can be customized to match
  other color themes.

Use space as default thousands separator

  Large numbers in notmuch-hello are now displayed using a space as
  thousands separator (e.g. "123 456" instead of "123,456"). This can be
  changed by customizing "notmuch-hello-thousands-separator".

Call notmuch-show instead of notmuch-search when clicking on
buttonized id: links.

New function notmuch-show-advance

  This new function advances through just the current thread, and is
  less invasive than notmuch-show-advance-and-archive.  It can easily
  be bound to SPC with:

  (define-key notmuch-show-mode-map " " 'notmuch-show-advance)

Various performance improvements.

New add-on tool
---

The tool contrib/notmuch-deliver helps with initial delivery and
tagging of mail (replacing running notmuch new).


What is notmuch
===
Notmuch is a system for indexing, searching, reading, and tagging
large collections of email messages in maildir or mh format. It uses
the Xapian library to provide fast, full-text search with a convenient
search syntax.

For more about notmuch, see http://notmuchmail.org

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


[PATCH v3] notmuch/emacs: Observe the charset of text/html parts, where known.

2012-01-13 Thread Austin Clements
Quoth David Edmondson on Jan 13 at  9:44 am:
> Add the charset of text/html parts to the JSON output of 'notmuch
> -show' when it is known. Observe the encoding when rendering such
> parts in emacs.
> ---
> 
> Commentary added.
> 
>  emacs/notmuch-show.el |3 ++-
>  notmuch-show.c|   28 +++-
>  2 files changed, 25 insertions(+), 6 deletions(-)

LGTM.


[PATCH v2 3/3] search: Support automatic tag exclusions

2012-01-13 Thread Austin Clements
This adds a "search" section to the config file and an
"auto_tag_exclusions" setting in that section.  The search and count
commands pass tag tags from the configuration to the library.
---
 notmuch-client.h |8 
 notmuch-config.c |   42 ++
 notmuch-count.c  |8 
 notmuch-search.c |8 
 test/search  |   18 ++
 5 files changed, 84 insertions(+), 0 deletions(-)

diff --git a/notmuch-client.h b/notmuch-client.h
index 517c010..62ede28 100644
--- a/notmuch-client.h
+++ b/notmuch-client.h
@@ -235,6 +235,14 @@ void
 notmuch_config_set_maildir_synchronize_flags (notmuch_config_t *config,
  notmuch_bool_t synchronize_flags);

+const char **
+notmuch_config_get_auto_exclude_tags (notmuch_config_t *config, size_t 
*length);
+
+void
+notmuch_config_set_auto_exclude_tags (notmuch_config_t *config,
+ const char *list[],
+ size_t length);
+
 int
 notmuch_run_hook (const char *db_path, const char *hook);

diff --git a/notmuch-config.c b/notmuch-config.c
index d697138..3d4d5b9 100644
--- a/notmuch-config.c
+++ b/notmuch-config.c
@@ -84,6 +84,15 @@ static const char maildir_config_comment[] =
 "\tand update tags, while the \"notmuch tag\" and \"notmuch restore\"\n"
 "\tcommands will notice tag changes and update flags in filenames\n";

+static const char search_config_comment[] =
+" Search configuration\n"
+"\n"
+" The following option is supported here:\n"
+"\n"
+"\tauto_exclude_tags  A ;-separated list of tags that will be\n"
+"\t excluded from search results by default.  Using an excluded tag\n"
+"\t in a query will override that exclusion.\n";
+
 struct _notmuch_config {
 char *filename;
 GKeyFile *key_file;
@@ -96,6 +105,8 @@ struct _notmuch_config {
 const char **new_tags;
 size_t new_tags_length;
 notmuch_bool_t maildir_synchronize_flags;
+const char **auto_exclude_tags;
+size_t auto_exclude_tags_length;
 };

 static int
@@ -221,6 +232,7 @@ notmuch_config_open (void *ctx,
 int file_had_new_group;
 int file_had_user_group;
 int file_had_maildir_group;
+int file_had_search_group;

 if (is_new_ret)
*is_new_ret = 0;
@@ -252,6 +264,8 @@ notmuch_config_open (void *ctx,
 config->new_tags = NULL;
 config->new_tags_length = 0;
 config->maildir_synchronize_flags = TRUE;
+config->auto_exclude_tags = NULL;
+config->auto_exclude_tags_length = 0;

 if (! g_key_file_load_from_file (config->key_file,
 config->filename,
@@ -295,6 +309,7 @@ notmuch_config_open (void *ctx,
 file_had_new_group = g_key_file_has_group (config->key_file, "new");
 file_had_user_group = g_key_file_has_group (config->key_file, "user");
 file_had_maildir_group = g_key_file_has_group (config->key_file, 
"maildir");
+file_had_search_group = g_key_file_has_group (config->key_file, "search");


 if (notmuch_config_get_database_path (config) == NULL) {
@@ -345,6 +360,11 @@ notmuch_config_open (void *ctx,
notmuch_config_set_new_tags (config, tags, 2);
 }

+if (notmuch_config_get_auto_exclude_tags (config, ) == NULL) {
+   const char *tags[] = { "deleted", "spam" };
+   notmuch_config_set_auto_exclude_tags (config, tags, 2);
+}
+
 error = NULL;
 config->maildir_synchronize_flags =
g_key_file_get_boolean (config->key_file,
@@ -387,6 +407,11 @@ notmuch_config_open (void *ctx,
maildir_config_comment, NULL);
 }

+if (! file_had_search_group) {
+   g_key_file_set_comment (config->key_file, "search", NULL,
+   search_config_comment, NULL);
+}
+
 if (is_new_ret)
*is_new_ret = is_new;

@@ -597,6 +622,23 @@ notmuch_config_set_new_tags (notmuch_config_t *config,
 &(config->new_tags));
 }

+const char **
+notmuch_config_get_auto_exclude_tags (notmuch_config_t *config, size_t *length)
+{
+return _config_get_list (config, "search", "auto_exclude_tags",
+&(config->auto_exclude_tags),
+&(config->auto_exclude_tags_length), length);
+}
+
+void
+notmuch_config_set_auto_exclude_tags (notmuch_config_t *config,
+ const char *list[],
+ size_t length)
+{
+_config_set_list (config, "search", "auto_exclude_tags", list, length,
+ &(config->auto_exclude_tags));
+}
+
 /* Given a configuration item of the form . return the
  * component group and key. If any error occurs, print a message on
  * stderr and return 1. Otherwise, return 0.
diff --git a/notmuch-count.c b/notmuch-count.c
index 0982f99..f77861e 100644
--- a/notmuch-count.c
+++ b/notmuch-count.c
@@ -35,6 +35,9 @@ notmuch_count_command (void *ctx, int argc, 

[PATCH v2 2/3] lib: Add support for automatically excluding tags from queries

2012-01-13 Thread Austin Clements
This is useful for tags like "deleted" and "spam" that people
generally want to exclude from query results.  These exclusions will
be overridden if a tag is explicitly mentioned in a query.
---
 lib/notmuch.h |6 ++
 lib/query.cc  |   35 +++
 2 files changed, 41 insertions(+), 0 deletions(-)

diff --git a/lib/notmuch.h b/lib/notmuch.h
index 9f23a10..7929fe7 100644
--- a/lib/notmuch.h
+++ b/lib/notmuch.h
@@ -457,6 +457,12 @@ notmuch_query_set_sort (notmuch_query_t *query, 
notmuch_sort_t sort);
 notmuch_sort_t
 notmuch_query_get_sort (notmuch_query_t *query);

+/* Add a tag that will be excluded from the query results by default.
+ * This exclusion will be overridden if this tag appears explicitly in
+ * the query. */
+void
+notmuch_query_add_tag_exclude (notmuch_query_t *query, const char *tag);
+
 /* Execute a query for threads, returning a notmuch_threads_t object
  * which can be used to iterate over the results. The returned threads
  * object is owned by the query and as such, will only be valid until
diff --git a/lib/query.cc b/lib/query.cc
index b6c0f12..0b36602 100644
--- a/lib/query.cc
+++ b/lib/query.cc
@@ -27,6 +27,7 @@ struct _notmuch_query {
 notmuch_database_t *notmuch;
 const char *query_string;
 notmuch_sort_t sort;
+notmuch_string_list_t *exclude_terms;
 };

 typedef struct _notmuch_mset_messages {
@@ -76,6 +77,8 @@ notmuch_query_create (notmuch_database_t *notmuch,

 query->sort = NOTMUCH_SORT_NEWEST_FIRST;

+query->exclude_terms = _notmuch_string_list_create (query);
+
 return query;
 }

@@ -97,6 +100,13 @@ notmuch_query_get_sort (notmuch_query_t *query)
 return query->sort;
 }

+void
+notmuch_query_add_tag_exclude (notmuch_query_t *query, const char *tag)
+{
+char *term = talloc_asprintf (query, "%s%s", _find_prefix ("tag"), tag);
+_notmuch_string_list_append (query->exclude_terms, term);
+}
+
 /* We end up having to call the destructors explicitly because we had
  * to use "placement new" in order to initialize C++ objects within a
  * block that we allocated with talloc. So C++ is making talloc
@@ -112,6 +122,27 @@ _notmuch_messages_destructor (notmuch_mset_messages_t 
*messages)
 return 0;
 }

+/* Return a query that does not match messages with the excluded tags
+ * registered with the query.  Any tags that explicitly appear in
+ * xquery will not be excluded. */
+static Xapian::Query
+_notmuch_exclude_tags (notmuch_query_t *query, Xapian::Query xquery)
+{
+for (notmuch_string_node_t *term = query->exclude_terms->head; term;
+term = term->next) {
+   Xapian::TermIterator it = xquery.get_terms_begin ();
+   Xapian::TermIterator end = xquery.get_terms_end ();
+   for (; it != end; it++) {
+   if ((*it).compare (term->string) == 0)
+   break;
+   }
+   if (it == end)
+   xquery = Xapian::Query (Xapian::Query::OP_AND_NOT,
+   xquery, Xapian::Query (term->string));
+}
+return xquery;
+}
+
 notmuch_messages_t *
 notmuch_query_search_messages (notmuch_query_t *query)
 {
@@ -157,6 +188,8 @@ notmuch_query_search_messages (notmuch_query_t *query)
 mail_query, string_query);
}

+   final_query = _notmuch_exclude_tags (query, final_query);
+
enquire.set_weighting_scheme (Xapian::BoolWeight());

switch (query->sort) {
@@ -436,6 +469,8 @@ notmuch_query_count_messages (notmuch_query_t *query)
 mail_query, string_query);
}

+   final_query = _notmuch_exclude_tags (query, final_query);
+
enquire.set_weighting_scheme(Xapian::BoolWeight());
enquire.set_docid_order(Xapian::Enquire::ASCENDING);

-- 
1.7.7.3



[PATCH v2 1/3] count: Convert to new-style argument parsing

2012-01-13 Thread Austin Clements
---
 notmuch-count.c |   53 +
 1 files changed, 25 insertions(+), 28 deletions(-)

diff --git a/notmuch-count.c b/notmuch-count.c
index 20ce334..0982f99 100644
--- a/notmuch-count.c
+++ b/notmuch-count.c
@@ -21,6 +21,11 @@

 #include "notmuch-client.h"

+enum {
+OUTPUT_THREADS,
+OUTPUT_MESSAGES,
+};
+
 int
 notmuch_count_command (void *ctx, int argc, char *argv[])
 {
@@ -28,35 +33,23 @@ notmuch_count_command (void *ctx, int argc, char *argv[])
 notmuch_database_t *notmuch;
 notmuch_query_t *query;
 char *query_str;
-int i;
-notmuch_bool_t output_messages = TRUE;
+int opt_index;
+int output = OUTPUT_MESSAGES;

-argc--; argv++; /* skip subcommand argument */
+notmuch_opt_desc_t options[] = {
+   { NOTMUCH_OPT_KEYWORD, , "output", 'o',
+ (notmuch_keyword_t []){ { "threads", OUTPUT_THREADS },
+ { "messages", OUTPUT_MESSAGES },
+ { 0, 0 } } },
+   { 0, 0, 0, 0, 0 }
+};

-for (i = 0; i < argc && argv[i][0] == '-'; i++) {
-   if (strcmp (argv[i], "--") == 0) {
-   i++;
-   break;
-   }
-   if (STRNCMP_LITERAL (argv[i], "--output=") == 0) {
-   const char *opt = argv[i] + sizeof ("--output=") - 1;
-   if (strcmp (opt, "threads") == 0) {
-   output_messages = FALSE;
-   } else if (strcmp (opt, "messages") == 0) {
-   output_messages = TRUE;
-   } else {
-   fprintf (stderr, "Invalid value for --output: %s\n", opt);
-   return 1;
-   }
-   } else {
-   fprintf (stderr, "Unrecognized option: %s\n", argv[i]);
-   return 1;
-   }
+opt_index = parse_arguments (argc, argv, options, 1);
+
+if (opt_index < 0) {
+   return 1;
 }

-argc -= i;
-argv += i;
-
 config = notmuch_config_open (ctx, NULL, NULL);
 if (config == NULL)
return 1;
@@ -66,7 +59,7 @@ notmuch_count_command (void *ctx, int argc, char *argv[])
 if (notmuch == NULL)
return 1;

-query_str = query_string_from_args (ctx, argc, argv);
+query_str = query_string_from_args (ctx, argc-opt_index, argv+opt_index);
 if (query_str == NULL) {
fprintf (stderr, "Out of memory.\n");
return 1;
@@ -82,10 +75,14 @@ notmuch_count_command (void *ctx, int argc, char *argv[])
return 1;
 }

-if (output_messages)
+switch (output) {
+case OUTPUT_MESSAGES:
printf ("%u\n", notmuch_query_count_messages (query));
-else
+   break;
+case OUTPUT_THREADS:
printf ("%u\n", notmuch_query_count_threads (query));
+   break;
+}

 notmuch_query_destroy (query);
 notmuch_database_close (notmuch);
-- 
1.7.7.3



[PATCH v2 0/3]

2012-01-13 Thread Austin Clements
This addresses Jani's comments and improves some of the text and code
comments.



[PATCH] Set fill column to 70 in .dir-locals.el and refactor other settings.

2012-01-13 Thread Austin Clements
Quoth Xavier Maillard on Jan 13 at 11:42 pm:
> 
> This controls where comments and other text wraps.  70 is the default
> value, so this simply returns it to the default for people who have
> overridden it.  Most notmuch code already adheres to this.
> ---
> SO here is the patch (still sorry if I did it wrongly and very badly).
> 
>  .dir-locals.el |   19 ++-
>  1 files changed, 6 insertions(+), 13 deletions(-)
> 
> diff --git a/.dir-locals.el b/.dir-locals.el
> index aea630b..27f01c0 100644
> --- a/.dir-locals.el
> +++ b/.dir-locals.el
> @@ -1,23 +1,16 @@
> -; emacs local configuration settings for notmuch source
> -; surmised by dkg on 2010-11-23 13:43:18-0500
> -; amended by amdragon on 2011-06-06
> +;; emacs local configuration settings for notmuch source
> +;; surmised by dkg on 2010-11-23 13:43:18-0500
> +;; amended by amdragon on 2011-06-06
>  
> -((c-mode
> +((nil
>(indent-tabs-mode . t)
>(tab-width . 8)
>(c-basic-offset . 4)
> +  (fill-column . 70))
> + (c-mode
>(c-file-style . "linux"))
>   (c++-mode
> -  (indent-tabs-mode . t)
> -  (tab-width . 8)
> -  (c-basic-offset . 4)
>(c-file-style . "linux"))
> - (emacs-lisp-mode
> -  (indent-tabs-mode . t)
> -  (tab-width . 8))
>   (shell-mode
> -  (indent-tabs-mode . t)
> -  (tab-width . 8)
> -  (sh-basic-offset . 4)
>(sh-indentation . 4))
>   )

You ammended it right, but actually the configuration is intentionally
repeated for the various modes.  For some programming languages
(notably Python), it's inappropriate to mess with the tab settings
(especially indent-tabs-mode), hence I took a "whitelist" approach to
be on the safe side, rather than using global settings and then
enumerating the modes I happened to know would break.

This is admittedly subtle.  There should probably be a comment in the
file explaining this.


[PATCH] emacs: whitespace-cleanup for emacs/*.el files

2012-01-13 Thread David Edmondson
On Fri, 13 Jan 2012 11:50:52 +0200, Tomi Ollila  wrote:
> So, In addition to 'uncrustify.cfg' we need emacs reformatter along lines:
> 
> (defun reformat-elisp-buffer ()
>   (interactice)
>   (emacs-lisp-mode)
>   (whitespace-cleanup)
>   (indent-region (point-min) (point-max)))
> 
> And this located in same directory as 'uncrustify.cfg', wherever
> that ends up.

I'd be happy with that. Note that doing it initially will require a
bunch of fixes - using a single ';' as a comment leader doesn't produce
the desired result, and notmuch.el is full of it...
-- 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/20120113/96186e0c/attachment.pgp>


[PATCH v2] emacs: logically group def{custom,face}s

2012-01-13 Thread David Edmondson
On Thu, 12 Jan 2012 23:31:34 -0400, David Bremner  wrote:
> On Thu, 12 Jan 2012 18:12:16 +0100, Pieter Praet  wrote:
> > To allow for expansion whilst keeping everything tidy and organized,
> > move all defcustom/defface variables to the following subgroups,
> > defined in notmuch-lib.el:
> > 
> > - Hello
> > - Search
> > - Show
> > - Send
> > - Crypto
> > - Hooks
> > - Appearance
> > - External Commands
> 
> I didn't investigate too closely, but I noticed when I customize-group
> emacs, each subgroup has some explanatory text beside it. Did you omit
> that on purpose?

That should be a requirement, I think.
-- 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/20120113/ebde048e/attachment.pgp>


[PATCH] emacs: globally replace non-branching "(if (not ..." with "(unless ..."

2012-01-13 Thread David Edmondson
On Thu, 12 Jan 2012 18:33:06 +0100, Pieter Praet  wrote:
> Less code, same results, without sacrificing readability.

Does this change correctly re-indent the line following the if/unless?
-- 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/20120113/b825295a/attachment.pgp>


[PATCH] emacs: globally replace non-branching "(if (not ..." with "(unless ..."

2012-01-13 Thread Tomi Ollila
On Fri, 13 Jan 2012 13:42:55 +0100, Xavier Maillard  
wrote:
> 
> On Fri, 13 Jan 2012 08:23:55 +, David Edmondson  wrote:
> > On Thu, 12 Jan 2012 18:33:06 +0100, Pieter Praet  
> > wrote:
> > > Less code, same results, without sacrificing readability.
> > 
> > +1, but why not replace non-branching `if' with `when' as well?
> 
> I tend to use WHEN for case I need to execute multiple
> statements. For the rest, IF is ok.

Same here, (when ...) is (if (progn ...)) for me.

> 
> /Xavier

Tomi


[PATCH] test: make (kill-emacs) from emacsclient work with emacs 23.(1|2)

2012-01-13 Thread Austin Clements
LGTM.

Quoth Tomi Ollila on Jan 13 at 10:17 am:
> emacsclient --eval '(kill-emacs)' makes emacs versions 23.1
> and 23.2 ask user input from running emacs. Redefining
> yes-or-no-p function when kill-emacs is executed for these
> emacs versions in test-lib.el avoids this test problem.
> ---
> Thanks Austin for your comments. Including 'activate' into defadvice
> made it possible to use if (well, without progn...) instead of when
> which makes this also marginally faster (as we're not byte-compiling
> this).
> 
>  test/test-lib.el |7 +++
>  1 files changed, 7 insertions(+), 0 deletions(-)
> 
> diff --git a/test/test-lib.el b/test/test-lib.el
> index 3b817c3..59c5868 100644
> --- a/test/test-lib.el
> +++ b/test/test-lib.el
> @@ -26,6 +26,13 @@
>  ;; `read' call.
>  (setq read-file-name-function (lambda ( _) (read)))
>  
> +;; Work around a bug in emacs 23.1 and emacs 23.2 which prevents
> +;; noninteractive (kill-emacs) from emacsclient.
> +(if (and (= emacs-major-version 23) (< emacs-minor-version 3))
> +  (defadvice kill-emacs (before disable-yes-or-no-p activate)
> +"Disable yes-or-no-p before executing kill-emacs"
> +(defun yes-or-no-p (prompt) t)))
> +
>  (defun notmuch-test-wait ()
>"Wait for process completion."
>(while (get-buffer-process (current-buffer))


[PATCH] emacs: globally replace non-branching "(if (not ..." with "(unless ..."

2012-01-13 Thread Xavier Maillard

On Fri, 13 Jan 2012 08:23:55 +, David Edmondson  wrote:
> On Thu, 12 Jan 2012 18:33:06 +0100, Pieter Praet  wrote:
> > Less code, same results, without sacrificing readability.
> 
> +1, but why not replace non-branching `if' with `when' as well?

I tend to use WHEN for case I need to execute multiple
statements. For the rest, IF is ok.

/Xavier


[PATCH] Set fill column to 70 in .dir-locals.el.

2012-01-13 Thread Xavier Maillard

On Thu, 12 Jan 2012 18:17:23 -0500, Austin Clements  wrote:
> This controls where comments and other text wraps.  70 is the default
> value, so this simply returns it to the default for people who have
> overridden it.  Most notmuch code already adheres to this.

+1

/Xavier


[PATCH 2/2] notmuch-dev: Update the master branch when requested.

2012-01-13 Thread David Edmondson
If `notmuch-dev-show-review-patch' is called with a prefix argument,
pull updates for the 'master' branch of the temporary repository.
---
 emacs/notmuch-dev.el |8 +++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/emacs/notmuch-dev.el b/emacs/notmuch-dev.el
index 465846f..3a15bf4 100644
--- a/emacs/notmuch-dev.el
+++ b/emacs/notmuch-dev.el
@@ -61,7 +61,12 @@
   (error "git clone failed."

 (defun notmuch-dev-checkout-master ()
-  (magit-checkout "master"))
+  (magit-checkout "master")
+  (when current-prefix-arg
+(message "Updating master...")
+;; Don't use `magit-pull' because it runs asynchronously.
+(magit-run-git "pull" "-v")
+(message "Updating master...done.")))

 (defun notmuch-dev-delete-branch (name)
   ;; `magit-delete-branch' uses "-d", which is not sufficiently
@@ -108,6 +113,7 @@
 (let ((default-directory notmuch-dev-temporary-repository-path))

   (notmuch-dev-checkout-master)
+
   ;; Delete the branch if it exists.
   (condition-case nil
  (notmuch-dev-delete-branch patch-name)
-- 
1.7.7.3



[PATCH 1/2] notmuch-dev: Remove more characters from branch names.

2012-01-13 Thread David Edmondson
Remove {, } and ,.
---
 emacs/notmuch-dev.el |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/emacs/notmuch-dev.el b/emacs/notmuch-dev.el
index 871ce3b..465846f 100644
--- a/emacs/notmuch-dev.el
+++ b/emacs/notmuch-dev.el
@@ -75,7 +75,7 @@
 (defun notmuch-dev-flatten-title (title)
   (let* ((s (downcase title))
 (s (replace-regexp-in-string "[ \t/]+" "-" s))
-(s (replace-regexp-in-string "[\]\[\":]" "" s))
+(s (replace-regexp-in-string "[\]\[\"{}:,]" "" s))
 (s (replace-regexp-in-string "\\.$" "" s))
 )
 s))
-- 
1.7.7.3



[PATCH] emacs: globally replace non-branching "(if (not ..." with "(unless ..."

2012-01-13 Thread David Edmondson
On Fri, 13 Jan 2012 13:42:55 +0100, Xavier Maillard  
wrote:
> On Fri, 13 Jan 2012 08:23:55 +, David Edmondson  wrote:
> > On Thu, 12 Jan 2012 18:33:06 +0100, Pieter Praet  
> > wrote:
> > > Less code, same results, without sacrificing readability.
> > 
> > +1, but why not replace non-branching `if' with `when' as well?
> 
> I tend to use WHEN for case I need to execute multiple
> statements. For the rest, IF is ok.

Understood.
-- 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/20120113/37c845e4/attachment.pgp>


[PATCH v2] emacs: logically group def{custom,face}s

2012-01-13 Thread Jameson Graef Rollins
On Thu, 12 Jan 2012 18:12:16 +0100, Pieter Praet  wrote:
> To allow for expansion whilst keeping everything tidy and organized,
> move all defcustom/defface variables to the following subgroups,
> defined in notmuch-lib.el:

Baring the issue that the Davids brought up about the sub group
descriptions, I think this would be a nice cleanup.  +1.

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/20120113/4f59733a/attachment.pgp>


revised patch for gmime init, with test.

2012-01-13 Thread Jameson Graef Rollins
On Fri, 13 Jan 2012 05:05:35 -0400, David Bremner  wrote:
> I thought about this a bit more, and I agree that at least the release
> candidates (basically anything tagged on branch release) ought to be
> merged back to master. Since any series of bugfix patches seems to be
> cause for a new release candidate, this should avoid the need to have
> doubly applied patches.
> 
> I'm less convinced about the need to merge every little doc change and
> debian packaging change back to master right away. This might be a
> purely aesthetic objection; I'm not sure if the extra merge commits
> cause any problems for e.g. bisection.

Doesn't everything need to be merged into master eventually anyway?  It
seems to me that unless it's a change that very narrowly targeting an
issue in a release branch that is not an issue in master, every patch
will ultimately need to be applied to both.  It doesn't really make
sense to me to apply a change to one branch and not the other, if they
will eventually need to be applied to both anyway.

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/20120113/e293101b/attachment.pgp>


[PATCH v3] notmuch/emacs: Observe the charset of text/html parts, where known.

2012-01-13 Thread Tomi Ollila
On Fri, 13 Jan 2012 09:44:46 +, David Edmondson  wrote:
> Add the charset of text/html parts to the JSON output of 'notmuch
> -show' when it is known. Observe the encoding when rendering such
> parts in emacs.
> ---
> 
> Commentary added.

+1

Tomi


[PATCH] emacs: whitespace-cleanup for emacs/*.el files

2012-01-13 Thread Tomi Ollila
On Fri, 13 Jan 2012 08:22:49 +, David Edmondson  wrote:
> On Thu, 12 Jan 2012 23:07:03 +0100, Xavier Maillard  
> wrote:
> > On Wed, 11 Jan 2012 17:13:35 +0200, Tomi Ollila  
> > wrote:
> > > Executed
> > > for f in emacs/*.el
> > > do emacs -q --batch --eval \
> > > "(progn (find-file \"$f\") (whitespace-cleanup) (save-buffer))"
> > > done
> > > 
> > > which
> > > removed trailing whitespace and empty lines at the end of file
> > > removed spaces before tab (if any)
> > > converted 8 spaces to tabs in the beginning of line
> > 
> > +1
> > 
> > Maybe we should note something about this as a /coding style/ rule ?
> 
> How about "Running `indent-region' over the file should produce no
> changes" as well?

So, In addition to 'uncrustify.cfg' we need emacs reformatter along lines:

(defun reformat-elisp-buffer ()
  (interactice)
  (emacs-lisp-mode)
  (whitespace-cleanup)
  (indent-region (point-min) (point-max)))

And this located in same directory as 'uncrustify.cfg', wherever
that ends up.

Tomi


[PATCH] notmuch-dev: Forcibly delete branches.

2012-01-13 Thread David Edmondson
`magit-delete-branch' runs "git branch -d ", which refuses to
delete branches that are not fully merged. Given that we don't care
and don't want to be stalled, use "git branch -D " directly.
---

This should address the problems removing un-merged branches.

 emacs/notmuch-dev.el |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/emacs/notmuch-dev.el b/emacs/notmuch-dev.el
index ac427ec..871ce3b 100644
--- a/emacs/notmuch-dev.el
+++ b/emacs/notmuch-dev.el
@@ -64,7 +64,9 @@
   (magit-checkout "master"))

 (defun notmuch-dev-delete-branch (name)
-  (magit-delete-branch name))
+  ;; `magit-delete-branch' uses "-d", which is not sufficiently
+  ;; aggressive for us.
+  (magit-run-git "branch" "-D" name))

 (defun notmuch-dev-create-branch (name)
   ;; Switches to the new branch automatically.
-- 
1.7.7.3



[PATCH] test: make (kill-emacs) from emacsclient work with emacs 23.(1|2)

2012-01-13 Thread Tomi Ollila
emacsclient --eval '(kill-emacs)' makes emacs versions 23.1
and 23.2 ask user input from running emacs. Redefining
yes-or-no-p function when kill-emacs is executed for these
emacs versions in test-lib.el avoids this test problem.
---
Thanks Austin for your comments. Including 'activate' into defadvice
made it possible to use if (well, without progn...) instead of when
which makes this also marginally faster (as we're not byte-compiling
this).

 test/test-lib.el |7 +++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/test/test-lib.el b/test/test-lib.el
index 3b817c3..59c5868 100644
--- a/test/test-lib.el
+++ b/test/test-lib.el
@@ -26,6 +26,13 @@
 ;; `read' call.
 (setq read-file-name-function (lambda ( _) (read)))

+;; Work around a bug in emacs 23.1 and emacs 23.2 which prevents
+;; noninteractive (kill-emacs) from emacsclient.
+(if (and (= emacs-major-version 23) (< emacs-minor-version 3))
+  (defadvice kill-emacs (before disable-yes-or-no-p activate)
+"Disable yes-or-no-p before executing kill-emacs"
+(defun yes-or-no-p (prompt) t)))
+
 (defun notmuch-test-wait ()
   "Wait for process completion."
   (while (get-buffer-process (current-buffer))
-- 
1.7.7.3



[PATCH] Set fill column to 70 in .dir-locals.el.

2012-01-13 Thread David Edmondson
On Thu, 12 Jan 2012 18:17:23 -0500, Austin Clements  wrote:
> This controls where comments and other text wraps.  70 is the default
> value, so this simply returns it to the default for people who have
> overridden it.  Most notmuch code already adheres to this.

Makes sense.
-- 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/20120113/7e11ae22/attachment.pgp>


[PATCH v3] notmuch/emacs: Observe the charset of text/html parts, where known.

2012-01-13 Thread David Edmondson
Add the charset of text/html parts to the JSON output of 'notmuch
-show' when it is known. Observe the encoding when rendering such
parts in emacs.
---

Commentary added.

 emacs/notmuch-show.el |3 ++-
 notmuch-show.c|   28 +++-
 2 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 5502efd..0354a8e 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -328,7 +328,8 @@ message at DEPTH in the current thread."
 current buffer, if possible."
   (let ((display-buffer (current-buffer)))
 (with-temp-buffer
-  (let ((handle (mm-make-handle (current-buffer) (list content-type
+  (let* ((charset (plist-get part :content-charset))
+(handle (mm-make-handle (current-buffer) `(,content-type (charset 
. ,charset)
(if (and (mm-inlinable-p handle)
 (mm-inlined-p handle))
(let ((content (notmuch-show-get-bodypart-content msg part nth)))
diff --git a/notmuch-show.c b/notmuch-show.c
index 0200b9c..87a1c90 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -675,13 +675,31 @@ format_part_content_json (GMimeObject *part)
printf (", \"filename\": %s", json_quote_str (ctx, filename));
 }

-if (g_mime_content_type_is_type (content_type, "text", "*") &&
-   !g_mime_content_type_is_type (content_type, "text", "html"))
+if (g_mime_content_type_is_type (content_type, "text", "*"))
 {
-   show_text_part_content (part, stream_memory);
-   part_content = g_mime_stream_mem_get_byte_array (GMIME_STREAM_MEM 
(stream_memory));
+   /* For non-HTML text/* parts, we include the content in the
+* JSON. Since JSON must be Unicode, we handle charset
+* decoding here and do not report a charset to the caller.
+* For text/html parts, we do not include the content. If a
+* caller is interested in text/html parts, it should retrieve
+* them separately and they will not be decoded. Since this
+* makes charset decoding the responsibility on the caller, we
+* report the charset for text/html parts.
+*/
+   if (g_mime_content_type_is_type (content_type, "text", "html"))
+   {
+   const char *content_charset = 
g_mime_object_get_content_type_parameter (GMIME_OBJECT (part), "charset");
+
+   if (content_charset != NULL)
+   printf (", \"content-charset\": %s", json_quote_str (ctx, 
content_charset));
+   }
+   else
+   {
+   show_text_part_content (part, stream_memory);
+   part_content = g_mime_stream_mem_get_byte_array (GMIME_STREAM_MEM 
(stream_memory));

-   printf (", \"content\": %s", json_quote_chararray (ctx, (char *) 
part_content->data, part_content->len));
+   printf (", \"content\": %s", json_quote_chararray (ctx, (char *) 
part_content->data, part_content->len));
+   }
 }
 else if (g_mime_content_type_is_type (content_type, "multipart", "*"))
 {
-- 
1.7.7.3



[PATCH] Set fill column to 70 in .dir-locals.el.

2012-01-13 Thread Tomi Ollila
On Thu, 12 Jan 2012 18:17:23 -0500, Austin Clements  wrote:
> This controls where comments and other text wraps.  70 is the default
> value, so this simply returns it to the default for people who have
> overridden it.  Most notmuch code already adheres to this.
> ---

+1

Tomi

>  .dir-locals.el |2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/.dir-locals.el b/.dir-locals.el
> index aea630b..044c214 100644
> --- a/.dir-locals.el
> +++ b/.dir-locals.el
> @@ -20,4 +20,6 @@
>(tab-width . 8)
>(sh-basic-offset . 4)
>(sh-indentation . 4))
> + (nil
> +  (fill-column . 70))
>   )
> -- 
> 1.7.7.3


[PATCH] notmuch-dev: Forcibly delete branches.

2012-01-13 Thread David Bremner
On Fri, 13 Jan 2012 10:25:29 +, David Edmondson  wrote:
> `magit-delete-branch' runs "git branch -d ", which refuses to
> delete branches that are not fully merged. Given that we don't care
> and don't want to be stalled, use "git branch -D " directly.
> ---

Yes, that seems to fix it. 

Two more questions/comments.

- Should n-d-s-review-patch update to current master? perhaps with
  prefix?

- I think more escaping of branch names is needed. In particular, branch
  names with {} in them get created ok, but then don't work very well in
  magit.  E.g. running log I get "Args out of range: "face}s", 5, 10"
  with the branch name

   review/patch-v2-emacs-logically-group-def{custom,face}s

d


[PATCH] emacs: globally replace non-branching "(if (not ..." with "(unless ..."

2012-01-13 Thread David Edmondson
On Thu, 12 Jan 2012 18:33:06 +0100, Pieter Praet  wrote:
> Less code, same results, without sacrificing readability.

+1, but why not replace non-branching `if' with `when' as well?
-- 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/20120113/5c61402f/attachment-0001.pgp>


[PATCH] emacs: whitespace-cleanup for emacs/*.el files

2012-01-13 Thread David Edmondson
On Thu, 12 Jan 2012 23:07:03 +0100, Xavier Maillard  
wrote:
> On Wed, 11 Jan 2012 17:13:35 +0200, Tomi Ollila  wrote:
> > Executed
> > for f in emacs/*.el
> > do emacs -q --batch --eval \
> > "(progn (find-file \"$f\") (whitespace-cleanup) (save-buffer))"
> > done
> > 
> > which
> > removed trailing whitespace and empty lines at the end of file
> > removed spaces before tab (if any)
> > converted 8 spaces to tabs in the beginning of line
> 
> +1
> 
> Maybe we should note something about this as a /coding style/ rule ?

How about "Running `indent-region' over the file should produce no
changes" as well?
-- 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/20120113/55dace0c/attachment.pgp>


revised patch for gmime init, with test.

2012-01-13 Thread David Bremner
On Thu, 12 Jan 2012 23:46:46 -0400, David Bremner  wrote:
> On Thu, 12 Jan 2012 18:25:38 +0100, Pieter Praet  wrote:
> > On Sat, 31 Dec 2011 23:22:46 -0400, David Bremner  
> > wrote:
> 
> > with differing hashes), this has the potential of causing confusion
> > and/or quite some extra work when debugging using git-bisect(1), so
> > I'd like to propose that bugfixes for (to-be-)released code are only
> > applied on the 'maint' branch ('release' in the case of Notmuch),
> > and then immediately merged back into 'master'.  In fact, this would
> > preferrably happen after *every* (series of) commit(s) on the 'maint'
> > branch, to prevent issues like [1].
> 
> There is some merit it to this. On the other hand, it makes the history
> messier.  [1] would have also been prevented by making the patch against
> the right branch.

I thought about this a bit more, and I agree that at least the release
candidates (basically anything tagged on branch release) ought to be
merged back to master. Since any series of bugfix patches seems to be
cause for a new release candidate, this should avoid the need to have
doubly applied patches.

I'm less convinced about the need to merge every little doc change and
debian packaging change back to master right away. This might be a
purely aesthetic objection; I'm not sure if the extra merge commits
cause any problems for e.g. bisection.

d


[PATCH] test: make (kill-emacs) from emacsclient work with emacs 23.(1|2)

2012-01-13 Thread Tomi Ollila
emacsclient --eval '(kill-emacs)' makes emacs versions 23.1
and 23.2 ask user input from running emacs. Redefining
yes-or-no-p function when kill-emacs is executed for these
emacs versions in test-lib.el avoids this test problem.
---
Thanks Austin for your comments. Including 'activate' into defadvice
made it possible to use if (well, without progn...) instead of when
which makes this also marginally faster (as we're not byte-compiling
this).

 test/test-lib.el |7 +++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/test/test-lib.el b/test/test-lib.el
index 3b817c3..59c5868 100644
--- a/test/test-lib.el
+++ b/test/test-lib.el
@@ -26,6 +26,13 @@
 ;; `read' call.
 (setq read-file-name-function (lambda (rest _) (read)))
 
+;; Work around a bug in emacs 23.1 and emacs 23.2 which prevents
+;; noninteractive (kill-emacs) from emacsclient.
+(if (and (= emacs-major-version 23) ( emacs-minor-version 3))
+  (defadvice kill-emacs (before disable-yes-or-no-p activate)
+Disable yes-or-no-p before executing kill-emacs
+(defun yes-or-no-p (prompt) t)))
+
 (defun notmuch-test-wait ()
   Wait for process completion.
   (while (get-buffer-process (current-buffer))
-- 
1.7.7.3

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


Re: [PATCH] emacs: whitespace-cleanup for emacs/*.el files

2012-01-13 Thread David Edmondson
On Thu, 12 Jan 2012 23:07:03 +0100, Xavier Maillard xav...@maillard.im wrote:
 On Wed, 11 Jan 2012 17:13:35 +0200, Tomi Ollila tomi.oll...@iki.fi wrote:
  Executed
  for f in emacs/*.el
  do emacs -q --batch --eval \
  (progn (find-file \$f\) (whitespace-cleanup) (save-buffer))
  done
  
  which
  removed trailing whitespace and empty lines at the end of file
  removed spaces before tab (if any)
  converted 8 spaces to tabs in the beginning of line
 
 +1
 
 Maybe we should note something about this as a /coding style/ rule ?

How about Running `indent-region' over the file should produce no
changes as well?


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


Re: [PATCH] emacs: globally replace non-branching (if (not ... with (unless ...

2012-01-13 Thread David Edmondson
On Thu, 12 Jan 2012 18:33:06 +0100, Pieter Praet pie...@praet.org wrote:
 Less code, same results, without sacrificing readability.

+1, but why not replace non-branching `if' with `when' as well?


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


Re: revised patch for gmime init, with test.

2012-01-13 Thread David Bremner
On Thu, 12 Jan 2012 23:46:46 -0400, David Bremner da...@tethera.net wrote:
 On Thu, 12 Jan 2012 18:25:38 +0100, Pieter Praet pie...@praet.org wrote:
  On Sat, 31 Dec 2011 23:22:46 -0400, David Bremner da...@tethera.net wrote:
 
  with differing hashes), this has the potential of causing confusion
  and/or quite some extra work when debugging using git-bisect(1), so
  I'd like to propose that bugfixes for (to-be-)released code are only
  applied on the 'maint' branch ('release' in the case of Notmuch),
  and then immediately merged back into 'master'.  In fact, this would
  preferrably happen after *every* (series of) commit(s) on the 'maint'
  branch, to prevent issues like [1].
 
 There is some merit it to this. On the other hand, it makes the history
 messier.  [1] would have also been prevented by making the patch against
 the right branch.

I thought about this a bit more, and I agree that at least the release
candidates (basically anything tagged on branch release) ought to be
merged back to master. Since any series of bugfix patches seems to be
cause for a new release candidate, this should avoid the need to have
doubly applied patches.

I'm less convinced about the need to merge every little doc change and
debian packaging change back to master right away. This might be a
purely aesthetic objection; I'm not sure if the extra merge commits
cause any problems for e.g. bisection.

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


[PATCH v3] notmuch/emacs: Observe the charset of text/html parts, where known.

2012-01-13 Thread David Edmondson
Add the charset of text/html parts to the JSON output of 'notmuch
-show' when it is known. Observe the encoding when rendering such
parts in emacs.
---

Commentary added.

 emacs/notmuch-show.el |3 ++-
 notmuch-show.c|   28 +++-
 2 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 5502efd..0354a8e 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -328,7 +328,8 @@ message at DEPTH in the current thread.
 current buffer, if possible.
   (let ((display-buffer (current-buffer)))
 (with-temp-buffer
-  (let ((handle (mm-make-handle (current-buffer) (list content-type
+  (let* ((charset (plist-get part :content-charset))
+(handle (mm-make-handle (current-buffer) `(,content-type (charset 
. ,charset)
(if (and (mm-inlinable-p handle)
 (mm-inlined-p handle))
(let ((content (notmuch-show-get-bodypart-content msg part nth)))
diff --git a/notmuch-show.c b/notmuch-show.c
index 0200b9c..87a1c90 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -675,13 +675,31 @@ format_part_content_json (GMimeObject *part)
printf (, \filename\: %s, json_quote_str (ctx, filename));
 }
 
-if (g_mime_content_type_is_type (content_type, text, *) 
-   !g_mime_content_type_is_type (content_type, text, html))
+if (g_mime_content_type_is_type (content_type, text, *))
 {
-   show_text_part_content (part, stream_memory);
-   part_content = g_mime_stream_mem_get_byte_array (GMIME_STREAM_MEM 
(stream_memory));
+   /* For non-HTML text/* parts, we include the content in the
+* JSON. Since JSON must be Unicode, we handle charset
+* decoding here and do not report a charset to the caller.
+* For text/html parts, we do not include the content. If a
+* caller is interested in text/html parts, it should retrieve
+* them separately and they will not be decoded. Since this
+* makes charset decoding the responsibility on the caller, we
+* report the charset for text/html parts.
+*/
+   if (g_mime_content_type_is_type (content_type, text, html))
+   {
+   const char *content_charset = 
g_mime_object_get_content_type_parameter (GMIME_OBJECT (part), charset);
+
+   if (content_charset != NULL)
+   printf (, \content-charset\: %s, json_quote_str (ctx, 
content_charset));
+   }
+   else
+   {
+   show_text_part_content (part, stream_memory);
+   part_content = g_mime_stream_mem_get_byte_array (GMIME_STREAM_MEM 
(stream_memory));
 
-   printf (, \content\: %s, json_quote_chararray (ctx, (char *) 
part_content-data, part_content-len));
+   printf (, \content\: %s, json_quote_chararray (ctx, (char *) 
part_content-data, part_content-len));
+   }
 }
 else if (g_mime_content_type_is_type (content_type, multipart, *))
 {
-- 
1.7.7.3

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


Re: [PATCH] Set fill column to 70 in .dir-locals.el.

2012-01-13 Thread David Edmondson
On Thu, 12 Jan 2012 18:17:23 -0500, Austin Clements amdra...@mit.edu wrote:
 This controls where comments and other text wraps.  70 is the default
 value, so this simply returns it to the default for people who have
 overridden it.  Most notmuch code already adheres to this.

Makes sense.


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


Re: [PATCH] emacs: whitespace-cleanup for emacs/*.el files

2012-01-13 Thread Tomi Ollila
On Fri, 13 Jan 2012 08:22:49 +, David Edmondson d...@dme.org wrote:
 On Thu, 12 Jan 2012 23:07:03 +0100, Xavier Maillard xav...@maillard.im 
 wrote:
  On Wed, 11 Jan 2012 17:13:35 +0200, Tomi Ollila tomi.oll...@iki.fi wrote:
   Executed
   for f in emacs/*.el
   do emacs -q --batch --eval \
   (progn (find-file \$f\) (whitespace-cleanup) (save-buffer))
   done
   
   which
   removed trailing whitespace and empty lines at the end of file
   removed spaces before tab (if any)
   converted 8 spaces to tabs in the beginning of line
  
  +1
  
  Maybe we should note something about this as a /coding style/ rule ?
 
 How about Running `indent-region' over the file should produce no
 changes as well?

So, In addition to 'uncrustify.cfg' we need emacs reformatter along lines:

(defun reformat-elisp-buffer ()
  (interactice)
  (emacs-lisp-mode)
  (whitespace-cleanup)
  (indent-region (point-min) (point-max)))

And this located in same directory as 'uncrustify.cfg', wherever
that ends up.

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


Re: [PATCH v3] notmuch/emacs: Observe the charset of text/html parts, where known.

2012-01-13 Thread Tomi Ollila
On Fri, 13 Jan 2012 09:44:46 +, David Edmondson d...@dme.org wrote:
 Add the charset of text/html parts to the JSON output of 'notmuch
 -show' when it is known. Observe the encoding when rendering such
 parts in emacs.
 ---
 
 Commentary added.

+1

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


[PATCH] notmuch-dev: Forcibly delete branches.

2012-01-13 Thread David Edmondson
`magit-delete-branch' runs git branch -d branch, which refuses to
delete branches that are not fully merged. Given that we don't care
and don't want to be stalled, use git branch -D branch directly.
---

This should address the problems removing un-merged branches.

 emacs/notmuch-dev.el |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/emacs/notmuch-dev.el b/emacs/notmuch-dev.el
index ac427ec..871ce3b 100644
--- a/emacs/notmuch-dev.el
+++ b/emacs/notmuch-dev.el
@@ -64,7 +64,9 @@
   (magit-checkout master))
 
 (defun notmuch-dev-delete-branch (name)
-  (magit-delete-branch name))
+  ;; `magit-delete-branch' uses -d, which is not sufficiently
+  ;; aggressive for us.
+  (magit-run-git branch -D name))
 
 (defun notmuch-dev-create-branch (name)
   ;; Switches to the new branch automatically.
-- 
1.7.7.3

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


Re: [PATCH] Set fill column to 70 in .dir-locals.el.

2012-01-13 Thread Xavier Maillard

On Thu, 12 Jan 2012 18:17:23 -0500, Austin Clements amdra...@mit.edu wrote:
 This controls where comments and other text wraps.  70 is the default
 value, so this simply returns it to the default for people who have
 overridden it.  Most notmuch code already adheres to this.

+1

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


Re: [PATCH] emacs: globally replace non-branching (if (not ... with (unless ...

2012-01-13 Thread Xavier Maillard

On Fri, 13 Jan 2012 08:23:55 +, David Edmondson d...@dme.org wrote:
 On Thu, 12 Jan 2012 18:33:06 +0100, Pieter Praet pie...@praet.org wrote:
  Less code, same results, without sacrificing readability.
 
 +1, but why not replace non-branching `if' with `when' as well?

I tend to use WHEN for case I need to execute multiple
statements. For the rest, IF is ok.

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


Re: [PATCH] emacs: globally replace non-branching (if (not ... with (unless ...

2012-01-13 Thread Tomi Ollila
On Fri, 13 Jan 2012 13:42:55 +0100, Xavier Maillard xav...@maillard.im wrote:
 
 On Fri, 13 Jan 2012 08:23:55 +, David Edmondson d...@dme.org wrote:
  On Thu, 12 Jan 2012 18:33:06 +0100, Pieter Praet pie...@praet.org wrote:
   Less code, same results, without sacrificing readability.
  
  +1, but why not replace non-branching `if' with `when' as well?
 
 I tend to use WHEN for case I need to execute multiple
 statements. For the rest, IF is ok.

Same here, (when ...) is (if (progn ...)) for me.

 
 /Xavier

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


Re: [PATCH] emacs: globally replace non-branching (if (not ... with (unless ...

2012-01-13 Thread David Edmondson
On Fri, 13 Jan 2012 13:42:55 +0100, Xavier Maillard xav...@maillard.im wrote:
 On Fri, 13 Jan 2012 08:23:55 +, David Edmondson d...@dme.org wrote:
  On Thu, 12 Jan 2012 18:33:06 +0100, Pieter Praet pie...@praet.org wrote:
   Less code, same results, without sacrificing readability.
  
  +1, but why not replace non-branching `if' with `when' as well?
 
 I tend to use WHEN for case I need to execute multiple
 statements. For the rest, IF is ok.

Understood.


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


[PATCH 2/2] notmuch-dev: Update the master branch when requested.

2012-01-13 Thread David Edmondson
If `notmuch-dev-show-review-patch' is called with a prefix argument,
pull updates for the 'master' branch of the temporary repository.
---
 emacs/notmuch-dev.el |8 +++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/emacs/notmuch-dev.el b/emacs/notmuch-dev.el
index 465846f..3a15bf4 100644
--- a/emacs/notmuch-dev.el
+++ b/emacs/notmuch-dev.el
@@ -61,7 +61,12 @@
   (error git clone failed.
 
 (defun notmuch-dev-checkout-master ()
-  (magit-checkout master))
+  (magit-checkout master)
+  (when current-prefix-arg
+(message Updating master...)
+;; Don't use `magit-pull' because it runs asynchronously.
+(magit-run-git pull -v)
+(message Updating master...done.)))
 
 (defun notmuch-dev-delete-branch (name)
   ;; `magit-delete-branch' uses -d, which is not sufficiently
@@ -108,6 +113,7 @@
 (let ((default-directory notmuch-dev-temporary-repository-path))
 
   (notmuch-dev-checkout-master)
+
   ;; Delete the branch if it exists.
   (condition-case nil
  (notmuch-dev-delete-branch patch-name)
-- 
1.7.7.3

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


Re: [PATCH] emacs: globally replace non-branching (if (not ... with (unless ...

2012-01-13 Thread David Edmondson
On Thu, 12 Jan 2012 18:33:06 +0100, Pieter Praet pie...@praet.org wrote:
 Less code, same results, without sacrificing readability.

Does this change correctly re-indent the line following the if/unless?


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


Re: [PATCH v2] emacs: logically group def{custom,face}s

2012-01-13 Thread David Edmondson
On Thu, 12 Jan 2012 23:31:34 -0400, David Bremner da...@tethera.net wrote:
 On Thu, 12 Jan 2012 18:12:16 +0100, Pieter Praet pie...@praet.org wrote:
  To allow for expansion whilst keeping everything tidy and organized,
  move all defcustom/defface variables to the following subgroups,
  defined in notmuch-lib.el:
  
  - Hello
  - Search
  - Show
  - Send
  - Crypto
  - Hooks
  - Appearance
  - External Commands
 
 I didn't investigate too closely, but I noticed when I customize-group
 emacs, each subgroup has some explanatory text beside it. Did you omit
 that on purpose?

That should be a requirement, I think.


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


Re: [PATCH] emacs: whitespace-cleanup for emacs/*.el files

2012-01-13 Thread David Edmondson
On Fri, 13 Jan 2012 11:50:52 +0200, Tomi Ollila tomi.oll...@iki.fi wrote:
 So, In addition to 'uncrustify.cfg' we need emacs reformatter along lines:
 
 (defun reformat-elisp-buffer ()
   (interactice)
   (emacs-lisp-mode)
   (whitespace-cleanup)
   (indent-region (point-min) (point-max)))
 
 And this located in same directory as 'uncrustify.cfg', wherever
 that ends up.

I'd be happy with that. Note that doing it initially will require a
bunch of fixes - using a single ';' as a comment leader doesn't produce
the desired result, and notmuch.el is full of it...


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


Re: revised patch for gmime init, with test.

2012-01-13 Thread Jameson Graef Rollins
On Fri, 13 Jan 2012 05:05:35 -0400, David Bremner da...@tethera.net wrote:
 I thought about this a bit more, and I agree that at least the release
 candidates (basically anything tagged on branch release) ought to be
 merged back to master. Since any series of bugfix patches seems to be
 cause for a new release candidate, this should avoid the need to have
 doubly applied patches.
 
 I'm less convinced about the need to merge every little doc change and
 debian packaging change back to master right away. This might be a
 purely aesthetic objection; I'm not sure if the extra merge commits
 cause any problems for e.g. bisection.

Doesn't everything need to be merged into master eventually anyway?  It
seems to me that unless it's a change that very narrowly targeting an
issue in a release branch that is not an issue in master, every patch
will ultimately need to be applied to both.  It doesn't really make
sense to me to apply a change to one branch and not the other, if they
will eventually need to be applied to both anyway.

jamie.


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


Re: [PATCH v2] emacs: logically group def{custom,face}s

2012-01-13 Thread Jameson Graef Rollins
On Thu, 12 Jan 2012 18:12:16 +0100, Pieter Praet pie...@praet.org wrote:
 To allow for expansion whilst keeping everything tidy and organized,
 move all defcustom/defface variables to the following subgroups,
 defined in notmuch-lib.el:

Baring the issue that the Davids brought up about the sub group
descriptions, I think this would be a nice cleanup.  +1.

jamie.


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


Re: [PATCH] emacs: whitespace-cleanup for emacs/*.el files

2012-01-13 Thread Xavier Maillard
On Fri, 13 Jan 2012 11:50:52 +0200, Tomi Ollila tomi.oll...@iki.fi wrote:
 On Fri, 13 Jan 2012 08:22:49 +, David Edmondson d...@dme.org wrote:
  On Thu, 12 Jan 2012 23:07:03 +0100, Xavier Maillard xav...@maillard.im 
  wrote:
   On Wed, 11 Jan 2012 17:13:35 +0200, Tomi Ollila tomi.oll...@iki.fi 
   wrote:
Executed
for f in emacs/*.el
do emacs -q --batch --eval \
(progn (find-file \$f\) (whitespace-cleanup) (save-buffer))
done

which
removed trailing whitespace and empty lines at the end of file
removed spaces before tab (if any)
converted 8 spaces to tabs in the beginning of line
   
   +1
   
   Maybe we should note something about this as a /coding style/ rule ?
  
  How about Running `indent-region' over the file should produce no
  changes as well?
 
 So, In addition to 'uncrustify.cfg' we need emacs reformatter along lines:

What about doing all of this directly in .dir-locals.el (could be
considered unsafe though to add an EVAL block).

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


Re: [PATCH] Set fill column to 70 in .dir-locals.el.

2012-01-13 Thread Xavier Maillard
Sorry if it is not correct to act like this (did I ever tell how n00b I
am when it comes to git ?).

So I wanted to /amend/ your patch to add some refactoring to it.

I hope this will not hurt :/


/Xavier

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


[PATCH] Set fill column to 70 in .dir-locals.el and refactor other settings.

2012-01-13 Thread Xavier Maillard

This controls where comments and other text wraps.  70 is the default
value, so this simply returns it to the default for people who have
overridden it.  Most notmuch code already adheres to this.
---
SO here is the patch (still sorry if I did it wrongly and very badly).

 .dir-locals.el |   19 ++-
 1 files changed, 6 insertions(+), 13 deletions(-)

diff --git a/.dir-locals.el b/.dir-locals.el
index aea630b..27f01c0 100644
--- a/.dir-locals.el
+++ b/.dir-locals.el
@@ -1,23 +1,16 @@
-; emacs local configuration settings for notmuch source
-; surmised by dkg on 2010-11-23 13:43:18-0500
-; amended by amdragon on 2011-06-06
+;; emacs local configuration settings for notmuch source
+;; surmised by dkg on 2010-11-23 13:43:18-0500
+;; amended by amdragon on 2011-06-06
 
-((c-mode
+((nil
   (indent-tabs-mode . t)
   (tab-width . 8)
   (c-basic-offset . 4)
+  (fill-column . 70))
+ (c-mode
   (c-file-style . linux))
  (c++-mode
-  (indent-tabs-mode . t)
-  (tab-width . 8)
-  (c-basic-offset . 4)
   (c-file-style . linux))
- (emacs-lisp-mode
-  (indent-tabs-mode . t)
-  (tab-width . 8))
  (shell-mode
-  (indent-tabs-mode . t)
-  (tab-width . 8)
-  (sh-basic-offset . 4)
   (sh-indentation . 4))
  )
-- 
1.7.1

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


[PATCH v2 0/3]

2012-01-13 Thread Austin Clements
This addresses Jani's comments and improves some of the text and code
comments.

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


[PATCH v2 2/3] lib: Add support for automatically excluding tags from queries

2012-01-13 Thread Austin Clements
This is useful for tags like deleted and spam that people
generally want to exclude from query results.  These exclusions will
be overridden if a tag is explicitly mentioned in a query.
---
 lib/notmuch.h |6 ++
 lib/query.cc  |   35 +++
 2 files changed, 41 insertions(+), 0 deletions(-)

diff --git a/lib/notmuch.h b/lib/notmuch.h
index 9f23a10..7929fe7 100644
--- a/lib/notmuch.h
+++ b/lib/notmuch.h
@@ -457,6 +457,12 @@ notmuch_query_set_sort (notmuch_query_t *query, 
notmuch_sort_t sort);
 notmuch_sort_t
 notmuch_query_get_sort (notmuch_query_t *query);
 
+/* Add a tag that will be excluded from the query results by default.
+ * This exclusion will be overridden if this tag appears explicitly in
+ * the query. */
+void
+notmuch_query_add_tag_exclude (notmuch_query_t *query, const char *tag);
+
 /* Execute a query for threads, returning a notmuch_threads_t object
  * which can be used to iterate over the results. The returned threads
  * object is owned by the query and as such, will only be valid until
diff --git a/lib/query.cc b/lib/query.cc
index b6c0f12..0b36602 100644
--- a/lib/query.cc
+++ b/lib/query.cc
@@ -27,6 +27,7 @@ struct _notmuch_query {
 notmuch_database_t *notmuch;
 const char *query_string;
 notmuch_sort_t sort;
+notmuch_string_list_t *exclude_terms;
 };
 
 typedef struct _notmuch_mset_messages {
@@ -76,6 +77,8 @@ notmuch_query_create (notmuch_database_t *notmuch,
 
 query-sort = NOTMUCH_SORT_NEWEST_FIRST;
 
+query-exclude_terms = _notmuch_string_list_create (query);
+
 return query;
 }
 
@@ -97,6 +100,13 @@ notmuch_query_get_sort (notmuch_query_t *query)
 return query-sort;
 }
 
+void
+notmuch_query_add_tag_exclude (notmuch_query_t *query, const char *tag)
+{
+char *term = talloc_asprintf (query, %s%s, _find_prefix (tag), tag);
+_notmuch_string_list_append (query-exclude_terms, term);
+}
+
 /* We end up having to call the destructors explicitly because we had
  * to use placement new in order to initialize C++ objects within a
  * block that we allocated with talloc. So C++ is making talloc
@@ -112,6 +122,27 @@ _notmuch_messages_destructor (notmuch_mset_messages_t 
*messages)
 return 0;
 }
 
+/* Return a query that does not match messages with the excluded tags
+ * registered with the query.  Any tags that explicitly appear in
+ * xquery will not be excluded. */
+static Xapian::Query
+_notmuch_exclude_tags (notmuch_query_t *query, Xapian::Query xquery)
+{
+for (notmuch_string_node_t *term = query-exclude_terms-head; term;
+term = term-next) {
+   Xapian::TermIterator it = xquery.get_terms_begin ();
+   Xapian::TermIterator end = xquery.get_terms_end ();
+   for (; it != end; it++) {
+   if ((*it).compare (term-string) == 0)
+   break;
+   }
+   if (it == end)
+   xquery = Xapian::Query (Xapian::Query::OP_AND_NOT,
+   xquery, Xapian::Query (term-string));
+}
+return xquery;
+}
+
 notmuch_messages_t *
 notmuch_query_search_messages (notmuch_query_t *query)
 {
@@ -157,6 +188,8 @@ notmuch_query_search_messages (notmuch_query_t *query)
 mail_query, string_query);
}
 
+   final_query = _notmuch_exclude_tags (query, final_query);
+
enquire.set_weighting_scheme (Xapian::BoolWeight());
 
switch (query-sort) {
@@ -436,6 +469,8 @@ notmuch_query_count_messages (notmuch_query_t *query)
 mail_query, string_query);
}
 
+   final_query = _notmuch_exclude_tags (query, final_query);
+
enquire.set_weighting_scheme(Xapian::BoolWeight());
enquire.set_docid_order(Xapian::Enquire::ASCENDING);
 
-- 
1.7.7.3

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


[PATCH v2 3/3] search: Support automatic tag exclusions

2012-01-13 Thread Austin Clements
This adds a search section to the config file and an
auto_tag_exclusions setting in that section.  The search and count
commands pass tag tags from the configuration to the library.
---
 notmuch-client.h |8 
 notmuch-config.c |   42 ++
 notmuch-count.c  |8 
 notmuch-search.c |8 
 test/search  |   18 ++
 5 files changed, 84 insertions(+), 0 deletions(-)

diff --git a/notmuch-client.h b/notmuch-client.h
index 517c010..62ede28 100644
--- a/notmuch-client.h
+++ b/notmuch-client.h
@@ -235,6 +235,14 @@ void
 notmuch_config_set_maildir_synchronize_flags (notmuch_config_t *config,
  notmuch_bool_t synchronize_flags);
 
+const char **
+notmuch_config_get_auto_exclude_tags (notmuch_config_t *config, size_t 
*length);
+
+void
+notmuch_config_set_auto_exclude_tags (notmuch_config_t *config,
+ const char *list[],
+ size_t length);
+
 int
 notmuch_run_hook (const char *db_path, const char *hook);
 
diff --git a/notmuch-config.c b/notmuch-config.c
index d697138..3d4d5b9 100644
--- a/notmuch-config.c
+++ b/notmuch-config.c
@@ -84,6 +84,15 @@ static const char maildir_config_comment[] =
 \tand update tags, while the \notmuch tag\ and \notmuch restore\\n
 \tcommands will notice tag changes and update flags in filenames\n;
 
+static const char search_config_comment[] =
+ Search configuration\n
+\n
+ The following option is supported here:\n
+\n
+\tauto_exclude_tags  A ;-separated list of tags that will be\n
+\t excluded from search results by default.  Using an excluded tag\n
+\t in a query will override that exclusion.\n;
+
 struct _notmuch_config {
 char *filename;
 GKeyFile *key_file;
@@ -96,6 +105,8 @@ struct _notmuch_config {
 const char **new_tags;
 size_t new_tags_length;
 notmuch_bool_t maildir_synchronize_flags;
+const char **auto_exclude_tags;
+size_t auto_exclude_tags_length;
 };
 
 static int
@@ -221,6 +232,7 @@ notmuch_config_open (void *ctx,
 int file_had_new_group;
 int file_had_user_group;
 int file_had_maildir_group;
+int file_had_search_group;
 
 if (is_new_ret)
*is_new_ret = 0;
@@ -252,6 +264,8 @@ notmuch_config_open (void *ctx,
 config-new_tags = NULL;
 config-new_tags_length = 0;
 config-maildir_synchronize_flags = TRUE;
+config-auto_exclude_tags = NULL;
+config-auto_exclude_tags_length = 0;
 
 if (! g_key_file_load_from_file (config-key_file,
 config-filename,
@@ -295,6 +309,7 @@ notmuch_config_open (void *ctx,
 file_had_new_group = g_key_file_has_group (config-key_file, new);
 file_had_user_group = g_key_file_has_group (config-key_file, user);
 file_had_maildir_group = g_key_file_has_group (config-key_file, 
maildir);
+file_had_search_group = g_key_file_has_group (config-key_file, search);
 
 
 if (notmuch_config_get_database_path (config) == NULL) {
@@ -345,6 +360,11 @@ notmuch_config_open (void *ctx,
notmuch_config_set_new_tags (config, tags, 2);
 }
 
+if (notmuch_config_get_auto_exclude_tags (config, tmp) == NULL) {
+   const char *tags[] = { deleted, spam };
+   notmuch_config_set_auto_exclude_tags (config, tags, 2);
+}
+
 error = NULL;
 config-maildir_synchronize_flags =
g_key_file_get_boolean (config-key_file,
@@ -387,6 +407,11 @@ notmuch_config_open (void *ctx,
maildir_config_comment, NULL);
 }
 
+if (! file_had_search_group) {
+   g_key_file_set_comment (config-key_file, search, NULL,
+   search_config_comment, NULL);
+}
+
 if (is_new_ret)
*is_new_ret = is_new;
 
@@ -597,6 +622,23 @@ notmuch_config_set_new_tags (notmuch_config_t *config,
 (config-new_tags));
 }
 
+const char **
+notmuch_config_get_auto_exclude_tags (notmuch_config_t *config, size_t *length)
+{
+return _config_get_list (config, search, auto_exclude_tags,
+(config-auto_exclude_tags),
+(config-auto_exclude_tags_length), length);
+}
+
+void
+notmuch_config_set_auto_exclude_tags (notmuch_config_t *config,
+ const char *list[],
+ size_t length)
+{
+_config_set_list (config, search, auto_exclude_tags, list, length,
+ (config-auto_exclude_tags));
+}
+
 /* Given a configuration item of the form group.key return the
  * component group and key. If any error occurs, print a message on
  * stderr and return 1. Otherwise, return 0.
diff --git a/notmuch-count.c b/notmuch-count.c
index 0982f99..f77861e 100644
--- a/notmuch-count.c
+++ b/notmuch-count.c
@@ -35,6 +35,9 @@ notmuch_count_command (void *ctx, int argc, char *argv[])
 char *query_str;
 int 

Re: [PATCH v3] notmuch/emacs: Observe the charset of text/html parts, where known.

2012-01-13 Thread Austin Clements
Quoth David Edmondson on Jan 13 at  9:44 am:
 Add the charset of text/html parts to the JSON output of 'notmuch
 -show' when it is known. Observe the encoding when rendering such
 parts in emacs.
 ---
 
 Commentary added.
 
  emacs/notmuch-show.el |3 ++-
  notmuch-show.c|   28 +++-
  2 files changed, 25 insertions(+), 6 deletions(-)

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


notmuch release 0.11 now available

2012-01-13 Thread David Bremner

Where to obtain notmuch 0.11
===
  http://notmuchmail.org/releases/notmuch-0.11.tar.gz

Which can be verified with:

  http://notmuchmail.org/releases/notmuch-0.11.tar.gz.sha1
  11eb1d967af089ed36f6816f61ebae308bc19339  notmuch-0.11.tar.gz

  http://notmuchmail.org/releases/notmuch-0.11.tar.gz.sha1.asc
  (signed by David Bremner)

What's new in notmuch 0.11
=

Command-Line Interface
--

Hooks

  Hooks have been introduced to notmuch. Hooks are scripts that notmuch
  invokes before and after certain actions. Initially, notmuch new
  supports pre-new and post-new hooks that are run before and after
  importing new messages into the database.

notmuch reply --decrypt bugfix

  The notmuch reply command with --decrypt argument had a rarely
  occurring bug that caused an encrypted message not to be decrypted
  sometimes. This is now fixed.

Performance
---

Automatic tag query optimization

  notmuch tag now automatically optimizes the user's query to
  exclude messages whose tags won't change.  In the past, we've
  suggested that people do this by hand; this is no longer necessary.

Don't sort messages when creating a dump file

  This speeds up tag dumps considerably, without any loss of
  information. To replicate the old behavior of sorted output (for
  example to compare two dump files), one can use e.g. sort(1).

Memory Management
-

Reduction of memory leaks

  Two memory leaks when searching and showing messages were identified
  and fixed in this release.

Emacs Interface
---

Bug fixes

  notmuch-show-advance (bound to the spacebar in notmuch-show-mode) had
  a bug that caused it to always jump to the next message, even if it
  should have scrolled down to show more of the current message instead.
  This is now fixed.

Support notmuch new as a notmuch-poll-script

  It's now possible to use notmuch new as a notmuch-poll-script
  directly. This is also the new default. This allows taking better
  advantage of the notmuch new hooks from emacs without intermediate
  scripts.

Improvements in saved search management

  New saved searches are now appended to the list of saved searches,
  not inserted in front. It's also possible to define a sort function
  for displaying saved searches; alphabetical sort is provided.

Hooks for notmuch-hello

  Two new hooks have been added: notmuch-hello-mode-hook (called after
  entering notmuch-hello-mode) and notmuch-hello-refresh-hook (called
  after updating a notmuch-hello buffer).

New face for crypto parts headers

  Crypto parts used to be displayed with a hardcoded color. A new face
  has been introduced to fix this: notmuch-crypto-part-header. It
  defaults to the same value as before, but can be customized to match
  other color themes.

Use space as default thousands separator

  Large numbers in notmuch-hello are now displayed using a space as
  thousands separator (e.g. 123 456 instead of 123,456). This can be
  changed by customizing notmuch-hello-thousands-separator.

Call notmuch-show instead of notmuch-search when clicking on
buttonized id: links.

New function notmuch-show-advance

  This new function advances through just the current thread, and is
  less invasive than notmuch-show-advance-and-archive.  It can easily
  be bound to SPC with:

  (define-key notmuch-show-mode-map   'notmuch-show-advance)

Various performance improvements.

New add-on tool
---

The tool contrib/notmuch-deliver helps with initial delivery and
tagging of mail (replacing running notmuch new).


What is notmuch
===
Notmuch is a system for indexing, searching, reading, and tagging
large collections of email messages in maildir or mh format. It uses
the Xapian library to provide fast, full-text search with a convenient
search syntax.

For more about notmuch, see http://notmuchmail.org



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


Re: [PATCH] emacs: whitespace-cleanup for emacs/*.el files

2012-01-13 Thread David Bremner
On Fri, 13 Jan 2012 23:27:11 +0100, Xavier Maillard x...@gnu.org wrote:
 
 What about doing all of this directly in .dir-locals.el (could be
 considered unsafe though to add an EVAL block).
 

I'm not crazy about this ideas, it sounds like it has the potential to
mix whitespace changes in with out changes in a commit. It also seems a
bit rude to do that to people, but maybe the latter is just conservatism.

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


Re: revised patch for gmime init, with test.

2012-01-13 Thread David Bremner
On Fri, 13 Jan 2012 12:52:48 -0800, Jameson Graef Rollins 
jroll...@finestructure.net wrote:
 
 Doesn't everything need to be merged into master eventually anyway?  It
 seems to me that unless it's a change that very narrowly targeting an
 issue in a release branch that is not an issue in master, every patch
 will ultimately need to be applied to both.  It doesn't really make
 sense to me to apply a change to one branch and not the other, if they
 will eventually need to be applied to both anyway.

The following two sequences of commands apply the same changes, but
result in a different history graph.

1) notmuch checkout release  git am patch   \
   notmuch checkout master  git cherry-pick release

2) notmuch checkout release  git am patch   \
   notmuch checkout master  git merge release

well, they apply the same changes if release was an ancestor of master
when the they both began.

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


Re: [PATCH v2 1/3] count: Convert to new-style argument parsing

2012-01-13 Thread David Bremner
On Fri, 13 Jan 2012 18:07:02 -0500, Austin Clements amdra...@mit.edu wrote:
 ---
  notmuch-count.c |   53 +
  1 files changed, 25 insertions(+), 28 deletions(-)

This seems independent of the rest of the series, and kindof obvious by
this point, so I pushed it.

d

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


Re: [PATCH v3] notmuch/emacs: Observe the charset of text/html parts, where known.

2012-01-13 Thread David Bremner
On Fri, 13 Jan 2012 09:44:46 +, David Edmondson d...@dme.org wrote:
 Add the charset of text/html parts to the JSON output of 'notmuch
 -show' when it is known. Observe the encoding when rendering such
 parts in emacs.
 ---

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


Re: [PATCH] Set fill column to 70 in .dir-locals.el.

2012-01-13 Thread David Bremner
On Thu, 12 Jan 2012 18:17:23 -0500, Austin Clements amdra...@mit.edu wrote:
 This controls where comments and other text wraps.  70 is the default
 value, so this simply returns it to the default for people who have
 overridden it.  Most notmuch code already adheres to this.
 ---

pushed.

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


[PATCH] Fix build warning: /* within comment

2012-01-13 Thread Austin Clements
---
 notmuch-show.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/notmuch-show.c b/notmuch-show.c
index 87a1c90..d14dac9 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -677,7 +677,7 @@ format_part_content_json (GMimeObject *part)
 
 if (g_mime_content_type_is_type (content_type, text, *))
 {
-   /* For non-HTML text/* parts, we include the content in the
+   /* For non-HTML text parts, we include the content in the
 * JSON. Since JSON must be Unicode, we handle charset
 * decoding here and do not report a charset to the caller.
 * For text/html parts, we do not include the content. If a
-- 
1.7.7.3

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