Re: [RFC PATCH] rfc: make 'make distclean' always use current Makefile.config

2017-01-07 Thread David Bremner
Tomi Ollila  writes:

I like the idea here; it's an annoying wait. Could we do something
similar for make clean?

> ... and not recreate it (slowly) if 'configure' changed, just to
> be deleteted later during 'make distclean'.
spellink

> +# In case of 'make distclean' have configure as order-only prerequisite so
> +# that Makefile.config is not recreated when configure is newer than it is.
> +ifeq ($(MAKECMDGOALS),distclean)

Two comments

- do we want to check for exactly distclean, or distclean one of the
  goals?

- it turns out that specifying e.g. "make distclean all" is currently
  broken (before your patch)
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] emacs: show: stop display of appliaction/* parts

2017-01-07 Thread Tomas Nordin
Good evening

> emacs/notmuch-show.el | 10 +-
>  1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index 364004b..42734ac 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -1227,7 +1227,15 @@ matched."
>(interactive "sNotmuch show: \nP")
>(let ((buffer-name (generate-new-buffer-name
> (or buffer-name
> -   (concat "*notmuch-" thread-id "*")
> +   (concat "*notmuch-" thread-id "*"
> + ;; We override mm-inline-override-types to stop appliacation/*
> + ;; parts from being displayed unless the user has customized
> + ;; it themselves.
> + (mm-inline-override-types
> +  (if (equal (list mm-inline-override-types)
> + (get 'mm-inline-override-types 'standard-value))
> +  (cons "application/*" mm-inline-override-types)
> +mm-inline-override-types)))
>  (switch-to-buffer (get-buffer-create buffer-name))
>  ;; No need to track undo information for this buffer.
>  (setq buffer-undo-list t)
> -- 
> 2.1.4

I applied this to a local copy of notmuch-show.el (notmuch is installed
on debian via apt here) and then eval-defun:ed the function. After that
no inline default display. Seems to work nicely. notmuch version 0.23.1.

By chance it can be easily answered, if I want to use the latest notmuch
installed from source, does it seem like a suitable procedure to do
this;

sudo apt-get remove notmuch
... do the source install and re-run notmuch new. It will probably work
smoothly with the setup I have?
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] emacs: show: stop display of appliaction/* parts

2017-01-07 Thread Mark Walters
Gnus seems to display application/zip and application/tar by
default. This doesn't seem desirable so we override it.

We only override ifthe user has not customized
mm-inline-override-types themselves.
---

This was mentioned on irc today and this might be a reasonable way of
doing this.

It does mean that if a user adds, for example, image/* to
mm-inline-override-types then application/* will be displayed again.

It also makes it slightly awkward to allow all types (eg setting
mm-inline-override-types to non/existent would do).

Also I feel there ought to be a better way to tell if a variable has
been customized (or otherwise set), but I didn't find one.

Best wishes

Mark


emacs/notmuch-show.el | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 364004b..42734ac 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1227,7 +1227,15 @@ matched."
   (interactive "sNotmuch show: \nP")
   (let ((buffer-name (generate-new-buffer-name
  (or buffer-name
- (concat "*notmuch-" thread-id "*")
+ (concat "*notmuch-" thread-id "*"
+   ;; We override mm-inline-override-types to stop appliacation/*
+   ;; parts from being displayed unless the user has customized
+   ;; it themselves.
+   (mm-inline-override-types
+(if (equal (list mm-inline-override-types)
+   (get 'mm-inline-override-types 'standard-value))
+(cons "application/*" mm-inline-override-types)
+  mm-inline-override-types)))
 (switch-to-buffer (get-buffer-create buffer-name))
 ;; No need to track undo information for this buffer.
 (setq buffer-undo-list t)
-- 
2.1.4

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


Re: archives and pictures display by default

2017-01-07 Thread David Bremner
David Bremner  writes:

> Tomas Nordin  writes:
>
>> Hello Notmuchers
>>
>> When I get zip files as attachment with pictures, they all expand for
>> viewing. Can I turn this off?
>>
>> Best regards
>> -- 
>
> I agree this a bad default. I haven't had a chance to investigate much,
> but it seems like the place we can control this is by setting
> mm-inline-media-tests. IIUC, the third element of the alist element is a
> function to test if the part should be inlined. By default this is
> #'identity, which unconditionally inlines zip archives.


The following should override it globally. (e.g. added to .emacs)

(setcdr
 (assoc-default "application/zip" mm-inline-media-tests #'string-match nil)
 (list #'mm-archive-dissect-and-inline (lambda (handle) nil)))

I only tested with "application/zip" replaced by
"application/x-tar-archive", but the principle should be the same.

I'm not really sure the right way of handling this as a default. It's
always a bit tricky with configuration shared with gnus.



signature.asc
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: archives and pictures display by default

2017-01-07 Thread David Bremner
Tomas Nordin  writes:

> Hello Notmuchers
>
> When I get zip files as attachment with pictures, they all expand for
> viewing. Can I turn this off?
>
> Best regards
> -- 

I agree this a bad default. I haven't had a chance to investigate much,
but it seems like the place we can control this is by setting
mm-inline-media-tests. IIUC, the third element of the alist element is a
function to test if the part should be inlined. By default this is
#'identity, which unconditionally inlines zip archives.

d


signature.asc
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 1/2] cli/config: allocate config using talloc_zero

2017-01-07 Thread David Bremner
Jani Nikula  writes:

> Do not initialize each field separately. It's more robust to allocate
> the config with zero initialization, and only set the non-zero
> defaults individually.

Series pushed to master.
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] test: allow user to choose which gdb to run tests with

2017-01-07 Thread Tomi Ollila
The variable used for selecting gdb is TEST_GDB, consistent with
TEST_CC and TEST_EMACS{,CLIENT}.
---

I tested this on FreeBSD kvm virtual machine, changed

env PATH=/usr/local/bin:$PATH CPATH=/usr/local/include 
LIBRARY_PATH=/usr/local/lib script typescript gmake test

to

env TEST_GDB=/usr/local/bin/gdb CPATH=/usr/local/include 
LIBRARY_PATH=/usr/local/lib script typescript gmake test

and got same results.

 test/T050-new.sh   | 2 +-
 test/T060-count.sh | 2 +-
 test/T070-insert.sh| 8 
 test/T380-atomicity.sh | 2 +-
 test/test-lib.sh   | 3 ++-
 5 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/test/T050-new.sh b/test/T050-new.sh
index 2bc799d..9115de8 100755
--- a/test/T050-new.sh
+++ b/test/T050-new.sh
@@ -317,7 +317,7 @@ end
 run
 EOF
 
-gdb --batch-silent --return-child-result -x notmuch-new-vanish.gdb \
+${TEST_GDB} --batch-silent --return-child-result -x notmuch-new-vanish.gdb \
 --args notmuch new 2>OUTPUT 1>/dev/null
 echo "exit status: $?" >> OUTPUT
 
diff --git a/test/T060-count.sh b/test/T060-count.sh
index 69ab591..d27e1ba 100755
--- a/test/T060-count.sh
+++ b/test/T060-count.sh
@@ -115,7 +115,7 @@ EOF
 
 backup_database
 test_begin_subtest "error message from query_search_messages"
-gdb --batch-silent --return-child-result -x count-files.gdb \
+${TEST_GDB} --batch-silent --return-child-result -x count-files.gdb \
 --args notmuch count --output=files '*' 2>OUTPUT 1>/dev/null
 cat < EXPECTED
 notmuch count: A Xapian exception occurred
diff --git a/test/T070-insert.sh b/test/T070-insert.sh
index 57472b9..7e04a23 100755
--- a/test/T070-insert.sh
+++ b/test/T070-insert.sh
@@ -206,22 +206,22 @@ gen_insert_msg
 
 for code in  FILE_NOT_EMAIL READ_ONLY_DATABASE UPGRADE_REQUIRED PATH_ERROR; do
 test_expect_code 1 "EXIT_FAILURE when add_message returns $code" \
- "gdb --batch-silent --return-child-result \
+ "${TEST_GDB} --batch-silent --return-child-result \
 -ex 'set args insert < $gen_msg_filename' \
 -x index-file-$code.gdb notmuch"
 test_expect_code 0 "success exit with --keep when add_message returns 
$code" \
- "gdb --batch-silent --return-child-result \
+ "${TEST_GDB} --batch-silent --return-child-result \
 -ex 'set args insert --keep < $gen_msg_filename' \
 -x index-file-$code.gdb notmuch"
 done
 
 for code in OUT_OF_MEMORY XAPIAN_EXCEPTION ; do
 test_expect_code 75 "EX_TEMPFAIL when add_message returns $code" \
- "gdb --batch-silent --return-child-result \
+ "${TEST_GDB} --batch-silent --return-child-result \
 -ex 'set args insert < $gen_msg_filename' \
 -x index-file-$code.gdb notmuch"
 test_expect_code 0 "success exit with --keep when add_message returns 
$code" \
- "gdb --batch-silent --return-child-result \
+ "${TEST_GDB} --batch-silent --return-child-result \
 -ex 'set args insert --keep < $gen_msg_filename' \
 -x index-file-$code.gdb notmuch"
 done
diff --git a/test/T380-atomicity.sh b/test/T380-atomicity.sh
index 845dfde..c6a9fb9 100755
--- a/test/T380-atomicity.sh
+++ b/test/T380-atomicity.sh
@@ -64,7 +64,7 @@ if test_require_external_prereq gdb; then
 # -tty /dev/null works around a conflict between the 'timeout' wrapper
 # and gdb's attempt to control the TTY.
 export MAIL_DIR
-gdb -tty /dev/null -batch -x $TEST_DIRECTORY/atomicity.py notmuch 
1>gdb.out 2>&1
+${TEST_GDB} -tty /dev/null -batch -x $TEST_DIRECTORY/atomicity.py notmuch 
1>gdb.out 2>&1
 
 # Get the final, golden output
 notmuch search '*' > expected
diff --git a/test/test-lib.sh b/test/test-lib.sh
index f55d2c6..6f9468a 100644
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -80,6 +80,7 @@ if [[ ( -n "$TEST_EMACS" && -z "$TEST_EMACSCLIENT" ) || \
 fi
 TEST_EMACS=${TEST_EMACS:-${EMACS:-emacs}}
 TEST_EMACSCLIENT=${TEST_EMACSCLIENT:-emacsclient}
+TEST_GDB=${TEST_GDB:-gdb}
 TEST_CC=${TEST_CC:-cc}
 TEST_CFLAGS=${TEST_CFLAGS:-"-g -O0"}
 
@@ -1379,7 +1380,7 @@ esac
 test_declare_external_prereq dtach
 test_declare_external_prereq emacs
 test_declare_external_prereq ${TEST_EMACSCLIENT}
-test_declare_external_prereq gdb
+test_declare_external_prereq ${TEST_GDB}
 test_declare_external_prereq gpg
 test_declare_external_prereq openssl
 test_declare_external_prereq gpgsm
-- 
2.9.3

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


Re: [PATCH 1/2] lib: use glib for sha1 digests instead of embedding libsha1

2017-01-07 Thread Tomi Ollila
On Fri, Jan 06 2017, Jani Nikula  wrote:

> We already depend on glib both directly and indirectly (via gmime). We
> might as well make use of its facilities. Drop the embedded libsha1
> and use glib for sha1 digests.

Nice! tests pass. probably doesn't collide with anything in review queue.

+1

Tomi



> ---
>  lib/Makefile.local |   1 -
>  lib/libsha1.c  | 244 
> -
>  lib/libsha1.h  |  71 
>  lib/sha1.c |  69 ++-
>  4 files changed, 24 insertions(+), 361 deletions(-)
>  delete mode 100644 lib/libsha1.c
>  delete mode 100644 lib/libsha1.h
>
> diff --git a/lib/Makefile.local b/lib/Makefile.local
> index 3d1030a56740..b77e57803288 100644
> --- a/lib/Makefile.local
> +++ b/lib/Makefile.local
> @@ -35,7 +35,6 @@ libnotmuch_c_srcs = \
>   $(notmuch_compat_srcs)  \
>   $(dir)/filenames.c  \
>   $(dir)/string-list.c\
> - $(dir)/libsha1.c\
>   $(dir)/message-file.c   \
>   $(dir)/messages.c   \
>   $(dir)/sha1.c   \
> diff --git a/lib/libsha1.c b/lib/libsha1.c
> deleted file mode 100644
> index 4eb2fc14..
> --- a/lib/libsha1.c
> +++ /dev/null
> @@ -1,244 +0,0 @@
> -/*
> - ---
> - Copyright (c) 2002, Dr Brian Gladman, Worcester, UK.   All rights reserved.
> -
> - LICENSE TERMS
> -
> - The free distribution and use of this software in both source and binary
> - form is allowed (with or without changes) provided that:
> -
> -   1. distributions of this source code include the above copyright
> -  notice, this list of conditions and the following disclaimer;
> -
> -   2. distributions in binary form include the above copyright
> -  notice, this list of conditions and the following disclaimer
> -  in the documentation and/or other associated materials;
> -
> -   3. the copyright holder's name is not used to endorse products
> -  built using this software without specific written permission.
> -
> - ALTERNATIVELY, provided that this notice is retained in full, this product
> - may be distributed under the terms of the GNU General Public License (GPL),
> - in which case the provisions of the GPL apply INSTEAD OF those given above.
> -
> - DISCLAIMER
> -
> - This software is provided 'as is' with no explicit or implied warranties
> - in respect of its properties, including, but not limited to, correctness
> - and/or fitness for purpose.
> - ---
> - Issue Date: 01/08/2005
> -
> - This is a byte oriented version of SHA1 that operates on arrays of bytes
> - stored in memory.
> -*/
> -
> -#include  /* for memcpy() etc.*/
> -#include "endian-util.h"
> -#include "libsha1.h"
> -
> -#if defined(__cplusplus)
> -extern "C"
> -{
> -#endif
> -
> -#define SHA1_BLOCK_SIZE  64
> -
> -#define rotl32(x,n)   (((x) << n) | ((x) >> (32 - n)))
> -#define rotr32(x,n)   (((x) >> n) | ((x) << (32 - n)))
> -
> -#define bswap_32(x) ((rotr32((x), 24) & 0x00ff00ff) | (rotr32((x), 8) & 
> 0xff00ff00))
> -
> -#if (UTIL_BYTE_ORDER == UTIL_ORDER_LITTLE_ENDIAN)
> -#  define bsw_32(p,n) \
> - { int _i = (n); while(_i--) ((uint32_t*)p)[_i] = 
> bswap_32(((uint32_t*)p)[_i]); }
> -#elif (UTIL_BYTE_ORDER == UTIL_ORDER_BIG_ENDIAN)
> -#  define bsw_32(p,n)
> -#else
> -#  error "Unsupported byte order"
> -#endif
> -
> -#define SHA1_MASK   (SHA1_BLOCK_SIZE - 1)
> -
> -#if 0
> -
> -#define ch(x,y,z)   (((x) & (y)) ^ (~(x) & (z)))
> -#define parity(x,y,z)   ((x) ^ (y) ^ (z))
> -#define maj(x,y,z)  (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z)))
> -
> -#else   /* Discovered by Rich Schroeppel and Colin Plumb   */
> -
> -#define ch(x,y,z)   ((z) ^ ((x) & ((y) ^ (z
> -#define parity(x,y,z)   ((x) ^ (y) ^ (z))
> -#define maj(x,y,z)  (((x) & (y)) | ((z) & ((x) ^ (y
> -
> -#endif
> -
> -/* Compile 64 bytes of hash data into SHA1 context. Note*/
> -/* that this routine assumes that the byte order in the */
> -/* ctx->wbuf[] at this point is in such an order that low   */
> -/* address bytes in the ORIGINAL byte stream will go in */
> -/* this buffer to the high end of 32-bit words on BOTH big  */
> -/* and little endian systems*/
> -
> -#ifdef ARRAY
> -#define q(v,n)  v[n]
> -#else
> -#define q(v,n)  v##n
> -#endif
> -
> -#define one_cycle(v,a,b,c,d,e,f,k,h)\
> -q(v,e) += rotr32(q(v,a),27) +   \
> -  f(q(v,b),q(v,c),q(v,d)) + k + h;  \
> -q(v,b)  = rotr32(q(v,b), 2)
> -
> -#define five_cycle(v,f,k,i) \
> -one_cycle(v, 0,1,2,3,4, f,k,hf(i  ));   \
> -one_cycle(v, 4,0,1,2,3, f,k,hf(i+1));   \
> -one_cycle(v, 3,4,0,1,2, f,k,hf(i+2));   \
> -one_cycle(v, 2,3,4,0,1, f,k,hf(i+3));   \
> -one_cycle(v, 1,2,3,4,0, f,k,hf(i+4))
> -
> -static void sha1_compile(sha1_ctx ctx[1])
>