[PATCH 7/7] cli: uncrustify mime-node.c

2019-06-12 Thread David Bremner
Cuddle a few parens on function calls per Tomi's suggestion to make
uncrustify match emacs indentation.
---
 mime-node.c | 34 +-
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/mime-node.c b/mime-node.c
index a93cbb31..3133ca44 100644
--- a/mime-node.c
+++ b/mime-node.c
@@ -55,7 +55,7 @@ _mime_node_context_free (mime_node_context_t *res)
 return 0;
 }
 
-const _notmuch_message_crypto_t*
+const _notmuch_message_crypto_t *
 mime_node_get_message_crypto_status (mime_node_t *node)
 {
 return node->ctx->msg_crypto;
@@ -97,8 +97,7 @@ mime_node_open (const void *ctx, notmuch_message_t *message,
notmuch_filenames_t *filenames;
for (filenames = notmuch_message_get_filenames (message);
 notmuch_filenames_valid (filenames);
-notmuch_filenames_move_to_next (filenames))
-   {
+notmuch_filenames_move_to_next (filenames)) {
filename = notmuch_filenames_get (filenames);
fd = open (filename, O_RDONLY);
if (fd != -1)
@@ -109,27 +108,27 @@ mime_node_open (const void *ctx, notmuch_message_t 
*message,
if (fd == -1) {
/* Give up */
fprintf (stderr, "Error opening %s: %s\n", filename, strerror 
(errno));
-   status = NOTMUCH_STATUS_FILE_ERROR;
-   goto DONE;
-   }
+   status = NOTMUCH_STATUS_FILE_ERROR;
+   goto DONE;
}
+}
 
 mctx->stream = g_mime_stream_gzfile_new (fd);
-if (!mctx->stream) {
+if (! mctx->stream) {
fprintf (stderr, "Out of memory.\n");
status = NOTMUCH_STATUS_OUT_OF_MEMORY;
goto DONE;
 }
 
 mctx->parser = g_mime_parser_new_with_stream (mctx->stream);
-if (!mctx->parser) {
+if (! mctx->parser) {
fprintf (stderr, "Out of memory.\n");
status = NOTMUCH_STATUS_OUT_OF_MEMORY;
goto DONE;
 }
 
 mctx->mime_message = g_mime_parser_construct_message (mctx->parser, NULL);
-if (!mctx->mime_message) {
+if (! mctx->mime_message) {
fprintf (stderr, "Failed to parse %s\n", filename);
status = NOTMUCH_STATUS_FILE_ERROR;
goto DONE;
@@ -153,7 +152,7 @@ mime_node_open (const void *ctx, notmuch_message_t *message,
 *root_out = root;
 return NOTMUCH_STATUS_SUCCESS;
 
-DONE:
+  DONE:
 talloc_free (root);
 return status;
 }
@@ -171,6 +170,7 @@ static void
 set_signature_list_destructor (mime_node_t *node)
 {
 GMimeSignatureList **proxy = talloc (node, GMimeSignatureList *);
+
 if (proxy) {
*proxy = node->sig_list;
talloc_set_destructor (proxy, _signature_list_free);
@@ -185,8 +185,8 @@ node_verify (mime_node_t *node, GMimeObject *part)
 notmuch_status_t status;
 
 node->verify_attempted = true;
-node->sig_list = g_mime_multipart_signed_verify
-   (GMIME_MULTIPART_SIGNED (part), GMIME_ENCRYPT_NONE, );
+node->sig_list = g_mime_multipart_signed_verify (
+   GMIME_MULTIPART_SIGNED (part), GMIME_ENCRYPT_NONE, );
 
 if (node->sig_list)
set_signature_list_destructor (node);
@@ -259,7 +259,7 @@ node_decrypt_and_verify (mime_node_t *node, GMimeObject 
*part)
g_object_unref (decrypt_result);
 }
 
- DONE:
+  DONE:
 if (err)
g_error_free (err);
 }
@@ -273,7 +273,7 @@ _mime_node_create (mime_node_t *parent, GMimeObject *part, 
int numchild)
 /* Set basic node properties */
 node->part = part;
 node->ctx = parent->ctx;
-if (!talloc_reference (node, node->ctx)) {
+if (! talloc_reference (node, node->ctx)) {
fprintf (stderr, "Out of memory.\n");
talloc_free (node);
return NULL;
@@ -335,15 +335,15 @@ mime_node_child (mime_node_t *parent, int child)
 GMimeObject *sub;
 mime_node_t *node;
 
-if (!parent || !parent->part || child < 0 || child >= parent->nchildren)
+if (! parent || ! parent->part || child < 0 || child >= parent->nchildren)
return NULL;
 
 if (GMIME_IS_MULTIPART (parent->part)) {
if (child == GMIME_MULTIPART_ENCRYPTED_CONTENT && 
parent->decrypted_child)
sub = parent->decrypted_child;
else
-   sub = g_mime_multipart_get_part
-   (GMIME_MULTIPART (parent->part), child);
+   sub = g_mime_multipart_get_part (
+   GMIME_MULTIPART (parent->part), child);
 } else if (GMIME_IS_MESSAGE (parent->part)) {
sub = g_mime_message_get_mime_part (GMIME_MESSAGE (parent->part));
 } else {
-- 
2.20.1

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


[PATCH 2/7] devel: remove between ++ / -- and argument

2019-06-12 Thread David Bremner
Apparently we just missed the option to get "x++" while keeping "x + y".
---
 devel/uncrustify.cfg | 1 +
 1 file changed, 1 insertion(+)

diff --git a/devel/uncrustify.cfg b/devel/uncrustify.cfg
index 6a8769c6..b8e57324 100644
--- a/devel/uncrustify.cfg
+++ b/devel/uncrustify.cfg
@@ -71,6 +71,7 @@ type sprinter_t
 # inter-character spacing options
 #
 
+sp_incdec  = remove
 sp_before_ptr_star = force
 sp_between_ptr_star= remove
 sp_after_ptr_star  = remove
-- 
2.20.1

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


[PATCH 4/7] cli: uncrustify debugger.c

2019-06-12 Thread David Bremner
---
 debugger.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/debugger.c b/debugger.c
index 0febf170..5f47a1d7 100644
--- a/debugger.c
+++ b/debugger.c
@@ -39,8 +39,7 @@ debugger_is_active (void)
 
 sprintf (buf, "/proc/%d/exe", getppid ());
 if (readlink (buf, buf2, sizeof (buf2)) != -1 &&
-   strncmp (basename (buf2), "gdb", 3) == 0)
-{
+   strncmp (basename (buf2), "gdb", 3) == 0) {
return true;
 }
 
-- 
2.20.1

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


[PATCH 3/7] cli: uncrustify command-line-arguments.c

2019-06-12 Thread David Bremner
Ignore one exploding '!!' -> '! !' and add one pair of parens.
---
 command-line-arguments.c | 58 +++-
 1 file changed, 33 insertions(+), 25 deletions(-)

diff --git a/command-line-arguments.c b/command-line-arguments.c
index 5f0607be..a628929b 100644
--- a/command-line-arguments.c
+++ b/command-line-arguments.c
@@ -7,16 +7,16 @@
 #define TO_BOOL(thing) (!! thing)
 
 typedef enum {
-OPT_FAILED, /* false */
-OPT_OK, /* good */
-OPT_GIVEBACK, /* pop one of the arguments you thought you were getting off 
the stack */
+OPT_FAILED, /* false */
+OPT_OK, /* good */
+OPT_GIVEBACK,   /* pop one of the arguments you thought you were 
getting off the stack */
 } opt_handled;
 
 /*
-  Search the array of keywords for a given argument, assigning the
-  output variable to the corresponding value.  Return false if nothing
-  matches.
-*/
+ * Search the array of keywords for a given argument, assigning the
+ * output variable to the corresponding value.  Return false if nothing
+ * matches.
+ */
 
 static opt_handled
 _process_keyword_arg (const notmuch_opt_desc_t *arg_desc, char next,
@@ -80,15 +80,17 @@ _process_boolean_arg (const notmuch_opt_desc_t *arg_desc, 
char next,
return OPT_FAILED;
 }
 
-*arg_desc->opt_bool = negate ? !value : value;
+*arg_desc->opt_bool = negate ? (! value) : value;
 
 return OPT_OK;
 }
 
 static opt_handled
-_process_int_arg (const notmuch_opt_desc_t *arg_desc, char next, const char 
*arg_str) {
+_process_int_arg (const notmuch_opt_desc_t *arg_desc, char next, const char 
*arg_str)
+{
 
 char *endptr;
+
 if (next == '\0' || arg_str[0] == '\0') {
fprintf (stderr, "Option \"%s\" needs an integer argument.\n", 
arg_desc->name);
return OPT_FAILED;
@@ -104,7 +106,8 @@ _process_int_arg (const notmuch_opt_desc_t *arg_desc, char 
next, const char *arg
 }
 
 static opt_handled
-_process_string_arg (const notmuch_opt_desc_t *arg_desc, char next, const char 
*arg_str) {
+_process_string_arg (const notmuch_opt_desc_t *arg_desc, char next, const char 
*arg_str)
+{
 
 if (next == '\0') {
fprintf (stderr, "Option \"%s\" needs a string argument.\n", 
arg_desc->name);
@@ -119,7 +122,8 @@ _process_string_arg (const notmuch_opt_desc_t *arg_desc, 
char next, const char *
 }
 
 /* Return number of non-NULL opt_* fields in opt_desc. */
-static int _opt_set_count (const notmuch_opt_desc_t *opt_desc)
+static int
+_opt_set_count (const notmuch_opt_desc_t *opt_desc)
 {
 return
TO_BOOL (opt_desc->opt_inherit) +
@@ -132,7 +136,8 @@ static int _opt_set_count (const notmuch_opt_desc_t 
*opt_desc)
 }
 
 /* Return true if opt_desc is valid. */
-static bool _opt_valid (const notmuch_opt_desc_t *opt_desc)
+static bool
+_opt_valid (const notmuch_opt_desc_t *opt_desc)
 {
 int n = _opt_set_count (opt_desc);
 
@@ -144,15 +149,17 @@ static bool _opt_valid (const notmuch_opt_desc_t 
*opt_desc)
 }
 
 /*
-   Search for the {pos_arg_index}th position argument, return false if
-   that does not exist.
-*/
+ * Search for the {pos_arg_index}th position argument, return false if
+ * that does not exist.
+ */
 
 bool
 parse_position_arg (const char *arg_str, int pos_arg_index,
-   const notmuch_opt_desc_t *arg_desc) {
+   const notmuch_opt_desc_t *arg_desc)
+{
 
 int pos_arg_counter = 0;
+
 while (_opt_valid (arg_desc)) {
if (arg_desc->opt_position) {
if (pos_arg_counter == pos_arg_index) {
@@ -178,12 +185,12 @@ parse_position_arg (const char *arg_str, int 
pos_arg_index,
 int
 parse_option (int argc, char **argv, const notmuch_opt_desc_t *options, int 
opt_index)
 {
-assert(argv);
+assert (argv);
 
 const char *_arg = argv[opt_index];
 
-assert(_arg);
-assert(options);
+assert (_arg);
+assert (options);
 
 const char *arg = _arg + 2; /* _arg starts with -- */
 const char *negative_arg = NULL;
@@ -241,7 +248,7 @@ parse_option (int argc, char **argv, const 
notmuch_opt_desc_t *options, int opt_
if (lookahead) {
next = ' ';
value = next_arg;
-   opt_index ++;
+   opt_index++;
}
 
opt_handled opt_status = OPT_FAILED;
@@ -260,12 +267,12 @@ parse_option (int argc, char **argv, const 
notmuch_opt_desc_t *options, int opt_
return -1;
 
if (lookahead && opt_status == OPT_GIVEBACK)
-   opt_index --;
+   opt_index--;
 
if (try->present)
*try->present = true;
 
-   return opt_index+1;
+   return opt_index + 1;
 }
 return -1;
 }
@@ -273,13 +280,14 @@ parse_option (int argc, char **argv, const 
notmuch_opt_desc_t *options, int opt_
 /* See command-line-arguments.h for description */
 int
 parse_arguments (int argc, char **argv,
-const notmuch_opt_desc_t *options, int opt_index) {
+const notmuch_opt_desc_t *options, int opt_index)
+{
 
 

[PATCH 5/7] cli: uncrustify gmime-filter-reply.c

2019-06-12 Thread David Bremner
The previous indentation used pure tabs.
---
 gmime-filter-reply.c | 190 +--
 1 file changed, 95 insertions(+), 95 deletions(-)

diff --git a/gmime-filter-reply.c b/gmime-filter-reply.c
index 480d9381..2b067669 100644
--- a/gmime-filter-reply.c
+++ b/gmime-filter-reply.c
@@ -47,143 +47,143 @@ static GMimeFilterClass *parent_class = NULL;
 GType
 g_mime_filter_reply_get_type (void)
 {
-   static GType type = 0;
-
-   if (!type) {
-   static const GTypeInfo info = {
-   .class_size = sizeof (GMimeFilterReplyClass),
-   .base_init = NULL,
-   .base_finalize = NULL,
-   .class_init = (GClassInitFunc) 
g_mime_filter_reply_class_init,
-   .class_finalize = NULL,
-   .class_data = NULL,
-   .instance_size = sizeof (GMimeFilterReply),
-   .n_preallocs = 0,
-   .instance_init = (GInstanceInitFunc) 
g_mime_filter_reply_init,
-   .value_table = NULL,
-   };
-
-   type = g_type_register_static (GMIME_TYPE_FILTER, 
"GMimeFilterReply", , (GTypeFlags) 0);
-   }
-
-   return type;
+static GType type = 0;
+
+if (! type) {
+   static const GTypeInfo info = {
+   .class_size = sizeof (GMimeFilterReplyClass),
+   .base_init = NULL,
+   .base_finalize = NULL,
+   .class_init = (GClassInitFunc) g_mime_filter_reply_class_init,
+   .class_finalize = NULL,
+   .class_data = NULL,
+   .instance_size = sizeof (GMimeFilterReply),
+   .n_preallocs = 0,
+   .instance_init = (GInstanceInitFunc) g_mime_filter_reply_init,
+   .value_table = NULL,
+   };
+
+   type = g_type_register_static (GMIME_TYPE_FILTER, "GMimeFilterReply", 
, (GTypeFlags) 0);
+}
+
+return type;
 }
 
 
 static void
 g_mime_filter_reply_class_init (GMimeFilterReplyClass *klass, unused (void 
*class_data))
 {
-   GObjectClass *object_class = G_OBJECT_CLASS (klass);
-   GMimeFilterClass *filter_class = GMIME_FILTER_CLASS (klass);
+GObjectClass *object_class = G_OBJECT_CLASS (klass);
+GMimeFilterClass *filter_class = GMIME_FILTER_CLASS (klass);
 
-   parent_class = (GMimeFilterClass *) g_type_class_ref 
(GMIME_TYPE_FILTER);
+parent_class = (GMimeFilterClass *) g_type_class_ref (GMIME_TYPE_FILTER);
 
-   object_class->finalize = g_mime_filter_reply_finalize;
+object_class->finalize = g_mime_filter_reply_finalize;
 
-   filter_class->copy = filter_copy;
-   filter_class->filter = filter_filter;
-   filter_class->complete = filter_complete;
-   filter_class->reset = filter_reset;
+filter_class->copy = filter_copy;
+filter_class->filter = filter_filter;
+filter_class->complete = filter_complete;
+filter_class->reset = filter_reset;
 }
 
 static void
 g_mime_filter_reply_init (GMimeFilterReply *filter, GMimeFilterReplyClass 
*klass)
 {
-   (void) klass;
-   filter->saw_nl = true;
-   filter->saw_angle = false;
+(void) klass;
+filter->saw_nl = true;
+filter->saw_angle = false;
 }
 
 static void
 g_mime_filter_reply_finalize (GObject *object)
 {
-   G_OBJECT_CLASS (parent_class)->finalize (object);
+G_OBJECT_CLASS (parent_class)->finalize (object);
 }
 
 
 static GMimeFilter *
 filter_copy (GMimeFilter *filter)
 {
-   GMimeFilterReply *reply = (GMimeFilterReply *) filter;
+GMimeFilterReply *reply = (GMimeFilterReply *) filter;
 
-   return g_mime_filter_reply_new (reply->encode);
+return g_mime_filter_reply_new (reply->encode);
 }
 
 static void
 filter_filter (GMimeFilter *filter, char *inbuf, size_t inlen, size_t prespace,
   char **outbuf, size_t *outlen, size_t *outprespace)
 {
-   GMimeFilterReply *reply = (GMimeFilterReply *) filter;
-   const char *inptr = inbuf;
-   const char *inend = inbuf + inlen;
-   char *outptr;
-
-   (void) prespace;
-   if (reply->encode) {
-   g_mime_filter_set_size (filter, 3 * inlen, false);
-
-   outptr = filter->outbuf;
-   while (inptr < inend) {
-   if (reply->saw_nl) {
-   *outptr++ = '>';
-   *outptr++ = ' ';
-   reply->saw_nl = false;
-   }
-   if (*inptr == '\n')
-   reply->saw_nl = true;
-   else
-   reply->saw_nl = false;
-   if (*inptr != '\r')
-   *outptr++ = *inptr;
-   inptr++;
-   }
-   } else {
-   g_mime_filter_set_size (filter, inlen + 1, false);
-
-   outptr = filter->outbuf;
-   while (inptr < inend) {
-  

[PATCH 1/7] cli: replace use of !! with macro

2019-06-12 Thread David Bremner
The slightly annoying reason to do this is because uncrustify can't
handle '!! foo' sensibly. The less annoying reason is that it helps
understand what the code does.
---
 command-line-arguments.c | 16 +---
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/command-line-arguments.c b/command-line-arguments.c
index d64aa85b..5f0607be 100644
--- a/command-line-arguments.c
+++ b/command-line-arguments.c
@@ -4,6 +4,8 @@
 #include "error_util.h"
 #include "command-line-arguments.h"
 
+#define TO_BOOL(thing) (!! thing)
+
 typedef enum {
 OPT_FAILED, /* false */
 OPT_OK, /* good */
@@ -120,13 +122,13 @@ _process_string_arg (const notmuch_opt_desc_t *arg_desc, 
char next, const char *
 static int _opt_set_count (const notmuch_opt_desc_t *opt_desc)
 {
 return
-   !!opt_desc->opt_inherit +
-   !!opt_desc->opt_bool +
-   !!opt_desc->opt_int +
-   !!opt_desc->opt_keyword +
-   !!opt_desc->opt_flags +
-   !!opt_desc->opt_string +
-   !!opt_desc->opt_position;
+   TO_BOOL (opt_desc->opt_inherit) +
+   TO_BOOL (opt_desc->opt_bool) +
+   TO_BOOL (opt_desc->opt_int) +
+   TO_BOOL (opt_desc->opt_keyword) +
+   TO_BOOL (opt_desc->opt_flags) +
+   TO_BOOL (opt_desc->opt_string) +
+   TO_BOOL (opt_desc->opt_position);
 }
 
 /* Return true if opt_desc is valid. */
-- 
2.20.1

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


Trial run uncrustifying some of the CLI

2019-06-12 Thread David Bremner
I made a few (hopefully inoffensive) changes to accomodate the
enforced styling. What do people think? Assuming this series is OK, do
you want mega patches (~500 line diff) or more small patches for
semi-auto styling?


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


[PATCH 6/7] cli: uncrustify hooks.c

2019-06-12 Thread David Bremner
---
 hooks.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hooks.c b/hooks.c
index 7348d322..59c58070 100644
--- a/hooks.c
+++ b/hooks.c
@@ -53,7 +53,7 @@ notmuch_run_hook (const char *db_path, const char *hook)
 /* Flush any buffered output before forking. */
 fflush (stdout);
 
-pid = fork();
+pid = fork ();
 if (pid == -1) {
fprintf (stderr, "Error: %s hook fork failed: %s\n", hook,
 strerror (errno));
@@ -78,7 +78,7 @@ notmuch_run_hook (const char *db_path, const char *hook)
goto DONE;
 }
 
-if (!WIFEXITED (status) || WEXITSTATUS (status)) {
+if (! WIFEXITED (status) || WEXITSTATUS (status)) {
if (WIFEXITED (status)) {
fprintf (stderr, "Error: %s hook failed with status %d\n",
 hook, WEXITSTATUS (status));
-- 
2.20.1

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


Re: [PATCH 1/7] cli: replace use of !! with macro

2019-06-12 Thread Tomi Ollila
On Wed, Jun 12 2019, David Bremner wrote:

> The slightly annoying reason to do this is because uncrustify can't
> handle '!! foo' sensibly. The less annoying reason is that it helps
> understand what the code does.
> ---
>  command-line-arguments.c | 16 +---
>  1 file changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/command-line-arguments.c b/command-line-arguments.c
> index d64aa85b..5f0607be 100644
> --- a/command-line-arguments.c
> +++ b/command-line-arguments.c
> @@ -4,6 +4,8 @@
>  #include "error_util.h"
>  #include "command-line-arguments.h"
>  
> +#define TO_BOOL(thing) (!! thing)

If this is the way, then #define TO_BOOL(thing) (!! (thing))

(does uncrustify then change this to (! ! (thing)) ?

Alternative is to do (bool) cast -- i.e. return (bool)opt_desc->opt_inherit + 
(bool) ...

-- for the question in PATCH 0 -email:

I'd prefer just one commit doing all the uncrustify changes for now, and
preferably set 

GIT_AUTHOR_NAME=uncrustify

(GIT_AUTHOR_EMAIL not modified)

this way anyone who does git annotate can easily see who not to blame for
changes and notice what such style changes was done at the same time...

after first big bump in it is easier to fix some leftover smaller things
(if any) -- incrementally, as the effort required is significantly smaller...


I'm not sure whether TO_BOOL looks so good, but these changes LGTM. someone
more familiar seeing '!!' in other codebases could comment??


Tomi

> +
>  typedef enum {
>  OPT_FAILED, /* false */
>  OPT_OK, /* good */
> @@ -120,13 +122,13 @@ _process_string_arg (const notmuch_opt_desc_t 
> *arg_desc, char next, const char *
>  static int _opt_set_count (const notmuch_opt_desc_t *opt_desc)
>  {
>  return
> - !!opt_desc->opt_inherit +
> - !!opt_desc->opt_bool +
> - !!opt_desc->opt_int +
> - !!opt_desc->opt_keyword +
> - !!opt_desc->opt_flags +
> - !!opt_desc->opt_string +
> - !!opt_desc->opt_position;
> + TO_BOOL (opt_desc->opt_inherit) +
> + TO_BOOL (opt_desc->opt_bool) +
> + TO_BOOL (opt_desc->opt_int) +
> + TO_BOOL (opt_desc->opt_keyword) +
> + TO_BOOL (opt_desc->opt_flags) +
> + TO_BOOL (opt_desc->opt_string) +
> + TO_BOOL (opt_desc->opt_position);
>  }
>  
>  /* Return true if opt_desc is valid. */
> -- 
> 2.20.1
>
> ___
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] build: drop variable HAVE_EMACS. use WITH_EMACS instead

2019-06-12 Thread Tomi Ollila
On Tue, Jun 11 2019, David Bremner wrote:

> The extra flexibility of having both HAVE_EMACS (for yes, there is an
> emacs we can use) and WITH_EMACS (the user wants emacs support) lead
> to confusion and bugs. We now just force WITH_EMACS to 0 if no
> suitable emacs is detected.

LGTM.

Tomi

> ---
>  configure| 18 --
>  doc/Makefile.local   |  6 +++---
>  doc/conf.py  |  2 +-
>  emacs/Makefile.local | 10 --
>  4 files changed, 16 insertions(+), 20 deletions(-)
>
> diff --git a/configure b/configure
> index 8b80f0e0..554e10c9 100755
> --- a/configure
> +++ b/configure
> @@ -677,13 +677,14 @@ if [ -z "${EMACSETCDIR-}" ]; then
>  EMACSETCDIR="\$(prefix)/share/emacs/site-lisp"
>  fi
>  
> -printf "Checking if emacs (>= 24) is available... "
> -if emacs --quick --batch --eval '(if (< emacs-major-version 24) (kill-emacs 
> 1))' > /dev/null 2>&1; then
> -printf "Yes.\n"
> -have_emacs=1
> -else
> -printf "No (so will not byte-compile emacs code)\n"
> -have_emacs=0
> +if [ $WITH_EMACS = "1" ]; then
> +printf "Checking if emacs (>= 24) is available... "
> +if emacs --quick --batch --eval '(if (< emacs-major-version 24) 
> (kill-emacs 1))' > /dev/null 2>&1; then
> +printf "Yes.\n"
> +else
> +printf "No (disabling emacs related parts of build)\n"
> +WITH_EMACS=0
> +fi
>  fi
>  
>  have_doxygen=0
> @@ -1165,9 +1166,6 @@ BASH_ABSOLUTE = ${bash_absolute}
>  HAVE_PERL = ${have_perl}
>  PERL_ABSOLUTE = ${perl_absolute}
>  
> -# Whether there's an emacs binary available for byte-compiling
> -HAVE_EMACS = ${have_emacs}
> -
>  # Whether there's a sphinx-build binary available for building documentation
>  HAVE_SPHINX=${have_sphinx}
>  
> diff --git a/doc/Makefile.local b/doc/Makefile.local
> index d733b51e..b4e0c955 100644
> --- a/doc/Makefile.local
> +++ b/doc/Makefile.local
> @@ -4,7 +4,7 @@ dir := doc
>  
>  # You can set these variables from the command line.
>  SPHINXOPTS:= -q
> -SPHINXBUILD   = HAVE_EMACS=${HAVE_EMACS} WITH_EMACS=${WITH_EMACS} 
> sphinx-build
> +SPHINXBUILD   = WITH_EMACS=${WITH_EMACS} sphinx-build
>  DOCBUILDDIR  := $(dir)/_build
>  
>  # Internal variables.
> @@ -29,8 +29,8 @@ MAN1_TEXI := $(patsubst 
> $(srcdir)/doc/man1/%.rst,$(DOCBUILDDIR)/texinfo/%.texi,$
>  MAN5_TEXI := $(patsubst 
> $(srcdir)/doc/man5/%.rst,$(DOCBUILDDIR)/texinfo/%.texi,$(MAN5_RST))
>  MAN7_TEXI := $(patsubst 
> $(srcdir)/doc/man7/%.rst,$(DOCBUILDDIR)/texinfo/%.texi,$(MAN7_RST))
>  INFO_TEXI_FILES := $(MAN1_TEXI) $(MAN5_TEXI) $(MAN7_TEXI)
> -ifeq ($(HAVE_EMACS)$(WITH_EMACS),11)
> - INFO_TEXI_FILES := $(INFO_TEXI_FILES) 
> $(DOCBUILDDIR)/texinfo/notmuch-emacs.texi
> +ifeq ($(WITH_EMACS),1)
> + INFO_TEXI_FILES += $(DOCBUILDDIR)/texinfo/notmuch-emacs.texi
>  endif
>  
>  INFO_INFO_FILES := $(INFO_TEXI_FILES:.texi=.info)
> diff --git a/doc/conf.py b/doc/conf.py
> index 8afff929..fc9738ff 100644
> --- a/doc/conf.py
> +++ b/doc/conf.py
> @@ -32,7 +32,7 @@ exclude_patterns = ['_build']
>  # If we don't have emacs (or the user configured --without-emacs),
>  # don't build the notmuch-emacs docs, as they need emacs to generate
>  # the docstring include files
> -if os.environ.get('HAVE_EMACS') != '1' or os.environ.get('WITH_EMACS') != 
> '1':
> +if os.environ.get('WITH_EMACS') != '1':
>  exclude_patterns.append('notmuch-emacs.rst')
>  
>  # The name of the Pygments (syntax highlighting) style to use.
> diff --git a/emacs/Makefile.local b/emacs/Makefile.local
> index 40b7c14f..141f5868 100644
> --- a/emacs/Makefile.local
> +++ b/emacs/Makefile.local
> @@ -47,7 +47,7 @@ emacs_images := \
>  emacs_bytecode = $(emacs_sources:.el=.elc)
>  emacs_docstrings = $(emacs_sources:.el=.rsti)
>  
> -ifneq ($(HAVE_SPHINX)$(HAVE_EMACS),11)
> +ifneq ($(HAVE_SPHINX)$(WITH_EMACS),11)
>  docstring.stamp:
>   @echo "Missing prerequisites, not collecting docstrings"
>  else
> @@ -60,7 +60,7 @@ endif
>  # the byte compiler may load an old .elc file when processing a
>  # "require" or we may fail to rebuild a .elc that depended on a macro
>  # from an updated file.
> -ifeq ($(HAVE_EMACS),1)
> +ifeq ($(WITH_EMACS),1)
>  $(dir)/.eldeps: $(dir)/Makefile.local $(dir)/make-deps.el $(emacs_sources)
>   $(call quiet,EMACS) --directory emacs -batch -l make-deps.el \
>   -f batch-make-deps $(emacs_sources) > $@.tmp && \
> @@ -82,7 +82,7 @@ $(dir)/notmuch-lib.elc: $(dir)/notmuch-version.elc
>  endif
>  CLEAN+=$(dir)/.eldeps $(dir)/.eldeps.tmp $(dir)/.eldeps.x
>  
> -ifeq ($(HAVE_EMACS),1)
> +ifeq ($(WITH_EMACS),1)
>  %.elc: %.el $(global_deps)
>   $(call quiet,EMACS) --directory emacs -batch -f batch-byte-compile $<
>  %.rsti: %.el
> @@ -103,10 +103,8 @@ endif
>   rm -r .elpa-build
>  
>  ifeq ($(WITH_EMACS),1)
> -ifeq ($(HAVE_EMACS),1)
>  all: $(emacs_bytecode) $(emacs_docstrings)
>  install-emacs: $(emacs_bytecode)
> -endif
>  
>  install: install-emacs
>  endif
> @@ -115,7 +113,7 @@ endif
>  install-emacs: 

Re: [PATCH 1/7] cli: replace use of !! with macro

2019-06-12 Thread Jorge P . de Morais Neto
Hi.  Isn't it good practice to parenthesize the arguments of C macros?
So TO_BOOL would be defined as

#define TO_BOOL(thing) (!! (thing))

In fact, why not just cast to bool?

Regards

David Bremner  writes:

> The slightly annoying reason to do this is because uncrustify can't
> handle '!! foo' sensibly. The less annoying reason is that it helps
> understand what the code does.
> ---
>  command-line-arguments.c | 16 +---
>  1 file changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/command-line-arguments.c b/command-line-arguments.c
> index d64aa85b..5f0607be 100644
> --- a/command-line-arguments.c
> +++ b/command-line-arguments.c
> @@ -4,6 +4,8 @@
>  #include "error_util.h"
>  #include "command-line-arguments.h"
>  
> +#define TO_BOOL(thing) (!! thing)
> +
>  typedef enum {
>  OPT_FAILED, /* false */
>  OPT_OK, /* good */
> @@ -120,13 +122,13 @@ _process_string_arg (const notmuch_opt_desc_t 
> *arg_desc, char next, const char *
>  static int _opt_set_count (const notmuch_opt_desc_t *opt_desc)
>  {
>  return
> - !!opt_desc->opt_inherit +
> - !!opt_desc->opt_bool +
> - !!opt_desc->opt_int +
> - !!opt_desc->opt_keyword +
> - !!opt_desc->opt_flags +
> - !!opt_desc->opt_string +
> - !!opt_desc->opt_position;
> + TO_BOOL (opt_desc->opt_inherit) +
> + TO_BOOL (opt_desc->opt_bool) +
> + TO_BOOL (opt_desc->opt_int) +
> + TO_BOOL (opt_desc->opt_keyword) +
> + TO_BOOL (opt_desc->opt_flags) +
> + TO_BOOL (opt_desc->opt_string) +
> + TO_BOOL (opt_desc->opt_position);
>  }
>  
>  /* Return true if opt_desc is valid. */
> -- 
> 2.20.1
>
> ___
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch

-- 
- I am Brazilian.  I hope my English is correct and I welcome feedback
- Please adopt free formats like PDF, ODF, Org, LaTeX, Opus, WebM and 7z
- Free/libre software for Android: https://f-droid.org/
- [[https://www.gnu.org/philosophy/free-sw.html][What is free software?]]
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


HTML email in notmuch-el.

2019-06-12 Thread Dmitry M
Good afternoon everyone,

I've been struggling a bit customizing the reading view, particularly with
HTML emails. A lot of my mail comes from Outlook, JIRA and other
applications that generate HTML emails by default. In fact, now that I
think about it, most of it is HTML.

notmuch-el does an ok job of rendering this content but I'm wonder if it
the out of the box experience can be improved. I'm very new to emacs so I
may have missed something. In addition to notmuch, I'm also playing with
mu4e (thanks maildir) and mu4e seems to render these emails more like
Outlook for example, which makes them easier to read.

I'm very new to emacs so I may have missed something. I tried

  (setq mm-text-html-renderer 'shr)

but it wasn't very helpful.

I have the following questions:

1. Is there any documentation on how to improve notmuch-el's HTML
rendering? Partciularly around rendering various [miltipart/*] messages
inline and preserving some of the original layout?
2. Is there a way to integrate mu4e-view with notmuch?

I strongly prefer notmuch's approach to email but mu4e message view does a
better job of rendering emails that I recieve. I'd appreciate any advice.

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


Re: [PATCH] build: drop variable HAVE_EMACS. use WITH_EMACS instead

2019-06-12 Thread David Bremner
Tomi Ollila  writes:

> On Tue, Jun 11 2019, David Bremner wrote:
>
>> The extra flexibility of having both HAVE_EMACS (for yes, there is an
>> emacs we can use) and WITH_EMACS (the user wants emacs support) lead
>> to confusion and bugs. We now just force WITH_EMACS to 0 if no
>> suitable emacs is detected.
>
> LGTM.

pushed to master

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