[PATCH 2/2] emacs: prefer notmuch-emacs-version in User-Agent: header

2015-08-02 Thread Tomi Ollila
Now that we have `notmuch-emacs-version' defined in notmuch emacs MUA
use that as a part of User-Agent: header to provide more accurate
version information when sending emails.

In case some incomplete installation of notmuch emacs MUA is used and
`notmuch-emacs-version' is defined as "unknown" then fall back to ask
version info from cli (as it used to be before this commit).

Requiring notmuch-version[.elc] and if that is missing setting
"fallback" notmuch-emacs-version (to "unknown") was moved from
notmuch.el to notmuch-lib.el as notmuch-mua.el (which provides
User-Agent: information) require's the latter.
---

Note that I did not create notmuch-guess-emacs-version (or something)
function. The idea is good but there is one HARD problem: naming it.
Also, I personally suspect that no-one is going to need that function in
coming years...

 emacs/notmuch-lib.el | 4 
 emacs/notmuch-mua.el | 5 -
 emacs/notmuch.el | 4 
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index e16a1b9..201d7ec 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -25,6 +25,10 @@
 (require 'mm-decode)
 (require 'cl)

+(unless (require 'notmuch-version nil t)
+  (defconst notmuch-emacs-version "unknown"
+"Placeholder variable when notmuch-version.el[c] is not available."))
+
 (autoload 'notmuch-jump-search "notmuch-jump"
   "Jump to a saved search by shortcut key." t)

diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
index 934f6c9..3e52d5e 100644
--- a/emacs/notmuch-mua.el
+++ b/emacs/notmuch-mua.el
@@ -118,7 +118,10 @@ (defun notmuch-mua-user-agent-full ()

 (defun notmuch-mua-user-agent-notmuch ()
   "Generate a `User-Agent:' string suitable for notmuch."
-  (concat "Notmuch/" (notmuch-cli-version) " (http://notmuchmail.org)"))
+  (let ((notmuch-version (if (string= notmuch-emacs-version "unknown")
+(notmuch-cli-version)
+  notmuch-emacs-version)))
+(concat "Notmuch/" notmuch-version " (http://notmuchmail.org)")))

 (defun notmuch-mua-user-agent-emacs ()
   "Generate a `User-Agent:' string suitable for notmuch."
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 6564816..5284e77 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -61,10 +61,6 @@
 (require 'notmuch-message)
 (require 'notmuch-parser)

-(unless (require 'notmuch-version nil t)
-  (defconst notmuch-emacs-version "unknown"
-"Placeholder variable when notmuch-version.el[c] is not available."))
-
 (defcustom notmuch-search-result-format
   `(("date" . "%12s ")
 ("count" . "%-7s ")
-- 
1.9.3



[PATCH 1/2] emacs: renamed function notmuch-version to notmuch-cli-version

2015-08-02 Thread Tomi Ollila
As it asks `notmuch` binary for its version number.
---

This is 3rd revision, previous in 
id:1426932955-23174-1-git-send-email-tomi.ollila at iki.fi

 emacs/notmuch-hello.el | 2 +-
 emacs/notmuch-lib.el   | 4 ++--
 emacs/notmuch-mua.el   | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 65d0627..7bfa752 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -628,7 +628,7 @@ (defvar notmuch-emacs-version)
 (defun notmuch-hello-versions ()
   "Display the notmuch version(s)"
   (interactive)
-  (let ((notmuch-cli-version (notmuch-version)))
+  (let ((notmuch-cli-version (notmuch-cli-version)))
 (message "notmuch version %s"
 (if (string= notmuch-emacs-version notmuch-cli-version)
 notmuch-cli-version
diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index f8e5165..e16a1b9 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -192,8 +192,8 @@ (defun notmuch-assert-cli-sane ()
 "Perhaps you haven't run \"notmuch setup\" yet? Try running this
 on the command line, and then retry your notmuch command")))

-(defun notmuch-version ()
-  "Return a string with the notmuch version number."
+(defun notmuch-cli-version ()
+  "Return a string with the notmuch cli command version number."
   (let ((long-string
 ;; Trim off the trailing newline.
 (substring (notmuch-command-to-string "--version") 0 -1)))
diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
index 33f1399..934f6c9 100644
--- a/emacs/notmuch-mua.el
+++ b/emacs/notmuch-mua.el
@@ -118,7 +118,7 @@ (defun notmuch-mua-user-agent-full ()

 (defun notmuch-mua-user-agent-notmuch ()
   "Generate a `User-Agent:' string suitable for notmuch."
-  (concat "Notmuch/" (notmuch-version) " (http://notmuchmail.org)"))
+  (concat "Notmuch/" (notmuch-cli-version) " (http://notmuchmail.org)"))

 (defun notmuch-mua-user-agent-emacs ()
   "Generate a `User-Agent:' string suitable for notmuch."
-- 
1.9.3



[PATCH] devel/release-checks: added checking of copyright year in documentation

2015-08-02 Thread Tomi Ollila
Check that copyright year will be current year in generated documentation.

The checking is done my matching that copyright line contains current
year as a substring which is good enough "approximation" in this context.
---
 devel/release-checks.sh | 12 
 1 file changed, 12 insertions(+)

diff --git a/devel/release-checks.sh b/devel/release-checks.sh
index bf0d68a444b6..b655a5089e12 100755
--- a/devel/release-checks.sh
+++ b/devel/release-checks.sh
@@ -207,6 +207,18 @@ case $news_date in
append_emsg "Date '$news_date' in NEWS file is not in format 
(-mm-dd)"
 esac

+year=`exec date +%Y`
+echo -n "Checking that copyright line in documentation contains $year... "
+copyrightline=`exec python -c "__file__ = 'command-line'
+with open('doc/conf.py') as cf: exec(cf.read()); print(copyright)"`
+case $copyrightline in
+   *$year*)
+   echo Yes. ;;
+   *)
+   echo No.
+   append_emsg "The copyright in doc/conf.py line '$copyrightline' 
does not contain '$year'"
+esac
+
 if [ -n "$emsgs" ]
 then
echo
-- 
2.0.0



[PATCH] devel/release-checks.sh: made python version check work with python 3

2015-08-02 Thread Tomi Ollila
This trivial change consists of just putting print() argument in
parentheses.
---
 devel/release-checks.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/devel/release-checks.sh b/devel/release-checks.sh
index efd0b3441f2e..bf0d68a444b6 100755
--- a/devel/release-checks.sh
+++ b/devel/release-checks.sh
@@ -141,7 +141,7 @@ else
 fi

 echo -n "Checking that python bindings version is $VERSION... "
-py_version=`python -c "with open('$PV_FILE') as vf: exec(vf.read()); print 
__VERSION__"`
+py_version=`python -c "with open('$PV_FILE') as vf: exec(vf.read()); 
print(__VERSION__)"`
 if [ "$py_version" = "$VERSION" ]
 then
echo Yes.
-- 
2.0.0



[PATCH] custom search prefix

2015-08-02 Thread David Bremner

Hi Sebastian;

Sorry this sat so long in the queue.

I agree it doesn't cost much to add it, but offhand I'm not sure what
the use case is. It would be be good to (briefly) mention this in the
commit message and also expand the docstring for the variable a bit,
since this is currently our only documentation.

> +(defcustom notmuch-query-prefix nil
> +  "Add a prefix to the standard query."
> +  :type 'string
> +  :group 'notmuch-search)
> +

In addition to general comments about, I'd say that "standard query" is
a bit ambigious for me. It sounds like it would be added e.g. to
saved-searches.  Maybe "default" search, with some discussion of where
it is used (so people don't have to read the source to figure it out).

d


[PATCH] notmuch-emacs-mua: do not start emacs daemon w/o --create-frame

2015-08-02 Thread David Bremner
Tomi Ollila  writes:

> notmuch-emacs-mua --client used to start daemon process if it was
> not running -- just that no emacs mail window of any kind from
> that is visible to the user.
>
> When not starting emacs server in this case notmuch-emacs-mua
> user will get the same message as would emacsclient user
> have, which should be enough for such user to understand how
> to proceed starting emacs server in a way that it is useable
> for this purpose.

I'm not a big fan of overloading arguments, i.e. if the daemon isn't
automatically started for all uses of --client, I'd rather there was
another argument like --auto-daemon so that there are at least 4 ways of
invoking

| n-e-m   | start a new emacs instance, and 
kill it after |
| n-e-m --client  | like emacsclient
  |
| n-e-m --client --create-frame   | like emacsclient -c, destroy 
after send   |
| n-e-m --client --create-frame --auto-daemon | like emacsclient -c -a, destroy 
after send|

Since there are probably only 3 users, this should be sufficient ;).


[PATCH v2] cli/new: add more debugging output

2015-08-02 Thread Tomi Ollila
On Sun, Aug 02 2015, David Bremner  wrote:

> Try to narrow down what part of the code adds files and directories to
> the queue(s) to be deleted.
> ---

Looks trivial enough to me. +1

Tomi


>
>  - print slightly less scary messages
>  - use git-send-email to send
>
>  notmuch-new.c | 14 ++
>  1 file changed, 14 insertions(+)
>
> diff --git a/notmuch-new.c b/notmuch-new.c
> index 8ff1ade..ee786a3 100644
> --- a/notmuch-new.c
> +++ b/notmuch-new.c
> @@ -528,6 +528,10 @@ add_files (notmuch_database_t *notmuch,
> "%s/%s", path,
> notmuch_filenames_get (db_files));
>  
> + if (state->debug)
> + printf ("(D) add_files_recursive, pass 2: queuing passed file 
> %s for deletion from database\n",
> + absolute);
> +
>   _filename_list_add (state->removed_files, absolute);
>  
>   notmuch_filenames_move_to_next (db_files);
> @@ -542,6 +546,9 @@ add_files (notmuch_database_t *notmuch,
>   {
>   char *absolute = talloc_asprintf (state->removed_directories,
> "%s/%s", path, filename);
> + if (state->debug)
> + printf ("(D) add_files_recursive, pass 2: queuing passed 
> directory %s for deletion from database\n",
> + absolute);
>  
>   _filename_list_add (state->removed_directories, absolute);
>   }
> @@ -610,6 +617,9 @@ add_files (notmuch_database_t *notmuch,
>   char *absolute = talloc_asprintf (state->removed_files,
> "%s/%s", path,
> notmuch_filenames_get (db_files));
> + if (state->debug)
> + printf ("(D) add_files_recursive, pass 3: queuing leftover file %s 
> for deletion from database\n",
> + absolute);
>  
>   _filename_list_add (state->removed_files, absolute);
>  
> @@ -622,6 +632,10 @@ add_files (notmuch_database_t *notmuch,
> "%s/%s", path,
> notmuch_filenames_get (db_subdirs));
>  
> + if (state->debug)
> + printf ("(D) add_files_recursive, pass 3: queuing leftover 
> directory %s for deletion from database\n",
> + absolute);
> +
>   _filename_list_add (state->removed_directories, absolute);
>  
>   notmuch_filenames_move_to_next (db_subdirs);
> -- 
> 2.1.4
>
> ___
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] test: use the python interpreter in sh.config

2015-08-02 Thread Tomi Ollila
On Sun, Aug 02 2015, David Bremner  wrote:

> The configure script chooses "python" if both python and python{2,3}
> exist exists, so this could change the version of python used to run
> the test suite.

LGTM. tests pass. 

>
> The checking for ${NOTMUCH_PYTHON} in the test suite is arguably
> over-engineering, since the configure step will fail if it can't find
> it.

Unless we accidentally edit NOTMUCH_PYTHON (away) in configure...
(i.e. I parsonally think this comment part is unnecessary, but i'm not
against having it)

Tomi

> ---
>
> Here is an updated version which fixes the subject typo, and actually
> tests for the python binary read from sh.config. I'll probably merge this 
> version unless there are objections
>
>  configure   |  2 ++
>  test/T390-python.sh |  2 ++
>  test/test-lib.sh| 15 ---
>  3 files changed, 8 insertions(+), 11 deletions(-)
>
> diff --git a/configure b/configure
> index 56f550b..20fbed6 100755
> --- a/configure
> +++ b/configure
> @@ -114,6 +114,8 @@ Other environment variables can be used to control 
> configure itself,
>   XAPIAN_CONFIG   The program to use to determine flags for
>   compiling and linking against the Xapian
>   library. [$XAPIAN_CONFIG]
> + PYTHON  Name of python command to use in
> + configure and the test suite.
>  
>  Additionally, various options can be specified on the configure
>  command line.
> diff --git a/test/T390-python.sh b/test/T390-python.sh
> index 26d0b97..c3f24f7 100755
> --- a/test/T390-python.sh
> +++ b/test/T390-python.sh
> @@ -2,6 +2,8 @@
>  test_description="python bindings"
>  . ./test-lib.sh
>  
> +test_require_external_prereq ${NOTMUCH_PYTHON}
> +
>  add_email_corpus
>  
>  test_begin_subtest "compare thread ids"
> diff --git a/test/test-lib.sh b/test/test-lib.sh
> index 3466e9c..db3b6aa 100644
> --- a/test/test-lib.sh
> +++ b/test/test-lib.sh
> @@ -621,9 +621,9 @@ test_expect_equal_json () {
>  # The test suite forces LC_ALL=C, but this causes Python 3 to
>  # decode stdin as ASCII.  We need to read JSON in UTF-8, so
>  # override Python's stdio encoding defaults.
> -output=$(echo "$1" | PYTHONIOENCODING=utf-8 python -mjson.tool \
> +output=$(echo "$1" | PYTHONIOENCODING=utf-8 $NOTMUCH_PYTHON -mjson.tool \
>  || echo "$1")
> -expected=$(echo "$2" | PYTHONIOENCODING=utf-8 python -mjson.tool \
> +expected=$(echo "$2" | PYTHONIOENCODING=utf-8 $NOTMUCH_PYTHON 
> -mjson.tool \
>  || echo "$2")
>  shift 2
>  test_expect_equal "$output" "$expected" "$@"
> @@ -1153,14 +1153,8 @@ test_python() {
>   export LD_LIBRARY_PATH=$TEST_DIRECTORY/../lib
>   export PYTHONPATH=$TEST_DIRECTORY/../bindings/python
>  
> - # Some distros (e.g. Arch Linux) ship Python 2.* as /usr/bin/python2,
> - # most others as /usr/bin/python. So first try python2, and fallback to
> - # python if python2 doesn't exist.
> - cmd=python2
> - [[ ${test_missing_external_prereq_[python2]} == t ]] && cmd=python
> -
>   (echo "import sys; _orig_stdout=sys.stdout; sys.stdout=open('OUTPUT', 
> 'w')"; cat) \
> - | $cmd -
> + | $NOTMUCH_PYTHON -
>  }
>  
>  test_ruby() {
> @@ -1325,5 +1319,4 @@ test_declare_external_prereq emacs
>  test_declare_external_prereq ${TEST_EMACSCLIENT}
>  test_declare_external_prereq gdb
>  test_declare_external_prereq gpg
> -test_declare_external_prereq python
> -test_declare_external_prereq python2
> +test_declare_external_prereq ${NOTMUCH_PYTHON}
> -- 
> 2.1.4
>
> ___
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH v2] cli/new: add more debugging output

2015-08-02 Thread David Bremner
Try to narrow down what part of the code adds files and directories to
the queue(s) to be deleted.
---

 - print slightly less scary messages
 - use git-send-email to send

 notmuch-new.c | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/notmuch-new.c b/notmuch-new.c
index 8ff1ade..ee786a3 100644
--- a/notmuch-new.c
+++ b/notmuch-new.c
@@ -528,6 +528,10 @@ add_files (notmuch_database_t *notmuch,
  "%s/%s", path,
  notmuch_filenames_get (db_files));

+   if (state->debug)
+   printf ("(D) add_files_recursive, pass 2: queuing passed file 
%s for deletion from database\n",
+   absolute);
+
_filename_list_add (state->removed_files, absolute);

notmuch_filenames_move_to_next (db_files);
@@ -542,6 +546,9 @@ add_files (notmuch_database_t *notmuch,
{
char *absolute = talloc_asprintf (state->removed_directories,
  "%s/%s", path, filename);
+   if (state->debug)
+   printf ("(D) add_files_recursive, pass 2: queuing passed 
directory %s for deletion from database\n",
+   absolute);

_filename_list_add (state->removed_directories, absolute);
}
@@ -610,6 +617,9 @@ add_files (notmuch_database_t *notmuch,
char *absolute = talloc_asprintf (state->removed_files,
  "%s/%s", path,
  notmuch_filenames_get (db_files));
+   if (state->debug)
+   printf ("(D) add_files_recursive, pass 3: queuing leftover file %s 
for deletion from database\n",
+   absolute);

_filename_list_add (state->removed_files, absolute);

@@ -622,6 +632,10 @@ add_files (notmuch_database_t *notmuch,
  "%s/%s", path,
  notmuch_filenames_get (db_subdirs));

+   if (state->debug)
+   printf ("(D) add_files_recursive, pass 3: queuing leftover 
directory %s for deletion from database\n",
+   absolute);
+
_filename_list_add (state->removed_directories, absolute);

notmuch_filenames_move_to_next (db_subdirs);
-- 
2.1.4



[PATCH] test: use the python interpreter in sh.config

2015-08-02 Thread David Bremner
The configure script chooses "python" if both python and python{2,3}
exist exists, so this could change the version of python used to run
the test suite.

The checking for ${NOTMUCH_PYTHON} in the test suite is arguably
over-engineering, since the configure step will fail if it can't find
it.
---

Here is an updated version which fixes the subject typo, and actually
tests for the python binary read from sh.config. I'll probably merge this 
version unless there are objections

 configure   |  2 ++
 test/T390-python.sh |  2 ++
 test/test-lib.sh| 15 ---
 3 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/configure b/configure
index 56f550b..20fbed6 100755
--- a/configure
+++ b/configure
@@ -114,6 +114,8 @@ Other environment variables can be used to control 
configure itself,
XAPIAN_CONFIG   The program to use to determine flags for
compiling and linking against the Xapian
library. [$XAPIAN_CONFIG]
+   PYTHON  Name of python command to use in
+   configure and the test suite.

 Additionally, various options can be specified on the configure
 command line.
diff --git a/test/T390-python.sh b/test/T390-python.sh
index 26d0b97..c3f24f7 100755
--- a/test/T390-python.sh
+++ b/test/T390-python.sh
@@ -2,6 +2,8 @@
 test_description="python bindings"
 . ./test-lib.sh

+test_require_external_prereq ${NOTMUCH_PYTHON}
+
 add_email_corpus

 test_begin_subtest "compare thread ids"
diff --git a/test/test-lib.sh b/test/test-lib.sh
index 3466e9c..db3b6aa 100644
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -621,9 +621,9 @@ test_expect_equal_json () {
 # The test suite forces LC_ALL=C, but this causes Python 3 to
 # decode stdin as ASCII.  We need to read JSON in UTF-8, so
 # override Python's stdio encoding defaults.
-output=$(echo "$1" | PYTHONIOENCODING=utf-8 python -mjson.tool \
+output=$(echo "$1" | PYTHONIOENCODING=utf-8 $NOTMUCH_PYTHON -mjson.tool \
 || echo "$1")
-expected=$(echo "$2" | PYTHONIOENCODING=utf-8 python -mjson.tool \
+expected=$(echo "$2" | PYTHONIOENCODING=utf-8 $NOTMUCH_PYTHON -mjson.tool \
 || echo "$2")
 shift 2
 test_expect_equal "$output" "$expected" "$@"
@@ -1153,14 +1153,8 @@ test_python() {
export LD_LIBRARY_PATH=$TEST_DIRECTORY/../lib
export PYTHONPATH=$TEST_DIRECTORY/../bindings/python

-   # Some distros (e.g. Arch Linux) ship Python 2.* as /usr/bin/python2,
-   # most others as /usr/bin/python. So first try python2, and fallback to
-   # python if python2 doesn't exist.
-   cmd=python2
-   [[ ${test_missing_external_prereq_[python2]} == t ]] && cmd=python
-
(echo "import sys; _orig_stdout=sys.stdout; sys.stdout=open('OUTPUT', 
'w')"; cat) \
-   | $cmd -
+   | $NOTMUCH_PYTHON -
 }

 test_ruby() {
@@ -1325,5 +1319,4 @@ test_declare_external_prereq emacs
 test_declare_external_prereq ${TEST_EMACSCLIENT}
 test_declare_external_prereq gdb
 test_declare_external_prereq gpg
-test_declare_external_prereq python
-test_declare_external_prereq python2
+test_declare_external_prereq ${NOTMUCH_PYTHON}
-- 
2.1.4



[PATCH v2] cli/new: add more debugging output

2015-08-02 Thread David Bremner
Try to narrow down what part of the code adds files and directories to
the queue(s) to be deleted.
---

 - print slightly less scary messages
 - use git-send-email to send

 notmuch-new.c | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/notmuch-new.c b/notmuch-new.c
index 8ff1ade..ee786a3 100644
--- a/notmuch-new.c
+++ b/notmuch-new.c
@@ -528,6 +528,10 @@ add_files (notmuch_database_t *notmuch,
  %s/%s, path,
  notmuch_filenames_get (db_files));
 
+   if (state-debug)
+   printf ((D) add_files_recursive, pass 2: queuing passed file 
%s for deletion from database\n,
+   absolute);
+
_filename_list_add (state-removed_files, absolute);
 
notmuch_filenames_move_to_next (db_files);
@@ -542,6 +546,9 @@ add_files (notmuch_database_t *notmuch,
{
char *absolute = talloc_asprintf (state-removed_directories,
  %s/%s, path, filename);
+   if (state-debug)
+   printf ((D) add_files_recursive, pass 2: queuing passed 
directory %s for deletion from database\n,
+   absolute);
 
_filename_list_add (state-removed_directories, absolute);
}
@@ -610,6 +617,9 @@ add_files (notmuch_database_t *notmuch,
char *absolute = talloc_asprintf (state-removed_files,
  %s/%s, path,
  notmuch_filenames_get (db_files));
+   if (state-debug)
+   printf ((D) add_files_recursive, pass 3: queuing leftover file %s 
for deletion from database\n,
+   absolute);
 
_filename_list_add (state-removed_files, absolute);
 
@@ -622,6 +632,10 @@ add_files (notmuch_database_t *notmuch,
  %s/%s, path,
  notmuch_filenames_get (db_subdirs));
 
+   if (state-debug)
+   printf ((D) add_files_recursive, pass 3: queuing leftover 
directory %s for deletion from database\n,
+   absolute);
+
_filename_list_add (state-removed_directories, absolute);
 
notmuch_filenames_move_to_next (db_subdirs);
-- 
2.1.4

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


Re: [PATCH v2] cli/new: add more debugging output

2015-08-02 Thread Tomi Ollila
On Sun, Aug 02 2015, David Bremner da...@tethera.net wrote:

 Try to narrow down what part of the code adds files and directories to
 the queue(s) to be deleted.
 ---

Looks trivial enough to me. +1

Tomi



  - print slightly less scary messages
  - use git-send-email to send

  notmuch-new.c | 14 ++
  1 file changed, 14 insertions(+)

 diff --git a/notmuch-new.c b/notmuch-new.c
 index 8ff1ade..ee786a3 100644
 --- a/notmuch-new.c
 +++ b/notmuch-new.c
 @@ -528,6 +528,10 @@ add_files (notmuch_database_t *notmuch,
 %s/%s, path,
 notmuch_filenames_get (db_files));
  
 + if (state-debug)
 + printf ((D) add_files_recursive, pass 2: queuing passed file 
 %s for deletion from database\n,
 + absolute);
 +
   _filename_list_add (state-removed_files, absolute);
  
   notmuch_filenames_move_to_next (db_files);
 @@ -542,6 +546,9 @@ add_files (notmuch_database_t *notmuch,
   {
   char *absolute = talloc_asprintf (state-removed_directories,
 %s/%s, path, filename);
 + if (state-debug)
 + printf ((D) add_files_recursive, pass 2: queuing passed 
 directory %s for deletion from database\n,
 + absolute);
  
   _filename_list_add (state-removed_directories, absolute);
   }
 @@ -610,6 +617,9 @@ add_files (notmuch_database_t *notmuch,
   char *absolute = talloc_asprintf (state-removed_files,
 %s/%s, path,
 notmuch_filenames_get (db_files));
 + if (state-debug)
 + printf ((D) add_files_recursive, pass 3: queuing leftover file %s 
 for deletion from database\n,
 + absolute);
  
   _filename_list_add (state-removed_files, absolute);
  
 @@ -622,6 +632,10 @@ add_files (notmuch_database_t *notmuch,
 %s/%s, path,
 notmuch_filenames_get (db_subdirs));
  
 + if (state-debug)
 + printf ((D) add_files_recursive, pass 3: queuing leftover 
 directory %s for deletion from database\n,
 + absolute);
 +
   _filename_list_add (state-removed_directories, absolute);
  
   notmuch_filenames_move_to_next (db_subdirs);
 -- 
 2.1.4

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


[PATCH] test: use the python interpreter in sh.config

2015-08-02 Thread David Bremner
The configure script chooses python if both python and python{2,3}
exist exists, so this could change the version of python used to run
the test suite.

The checking for ${NOTMUCH_PYTHON} in the test suite is arguably
over-engineering, since the configure step will fail if it can't find
it.
---

Here is an updated version which fixes the subject typo, and actually
tests for the python binary read from sh.config. I'll probably merge this 
version unless there are objections

 configure   |  2 ++
 test/T390-python.sh |  2 ++
 test/test-lib.sh| 15 ---
 3 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/configure b/configure
index 56f550b..20fbed6 100755
--- a/configure
+++ b/configure
@@ -114,6 +114,8 @@ Other environment variables can be used to control 
configure itself,
XAPIAN_CONFIG   The program to use to determine flags for
compiling and linking against the Xapian
library. [$XAPIAN_CONFIG]
+   PYTHON  Name of python command to use in
+   configure and the test suite.
 
 Additionally, various options can be specified on the configure
 command line.
diff --git a/test/T390-python.sh b/test/T390-python.sh
index 26d0b97..c3f24f7 100755
--- a/test/T390-python.sh
+++ b/test/T390-python.sh
@@ -2,6 +2,8 @@
 test_description=python bindings
 . ./test-lib.sh
 
+test_require_external_prereq ${NOTMUCH_PYTHON}
+
 add_email_corpus
 
 test_begin_subtest compare thread ids
diff --git a/test/test-lib.sh b/test/test-lib.sh
index 3466e9c..db3b6aa 100644
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -621,9 +621,9 @@ test_expect_equal_json () {
 # The test suite forces LC_ALL=C, but this causes Python 3 to
 # decode stdin as ASCII.  We need to read JSON in UTF-8, so
 # override Python's stdio encoding defaults.
-output=$(echo $1 | PYTHONIOENCODING=utf-8 python -mjson.tool \
+output=$(echo $1 | PYTHONIOENCODING=utf-8 $NOTMUCH_PYTHON -mjson.tool \
 || echo $1)
-expected=$(echo $2 | PYTHONIOENCODING=utf-8 python -mjson.tool \
+expected=$(echo $2 | PYTHONIOENCODING=utf-8 $NOTMUCH_PYTHON -mjson.tool \
 || echo $2)
 shift 2
 test_expect_equal $output $expected $@
@@ -1153,14 +1153,8 @@ test_python() {
export LD_LIBRARY_PATH=$TEST_DIRECTORY/../lib
export PYTHONPATH=$TEST_DIRECTORY/../bindings/python
 
-   # Some distros (e.g. Arch Linux) ship Python 2.* as /usr/bin/python2,
-   # most others as /usr/bin/python. So first try python2, and fallback to
-   # python if python2 doesn't exist.
-   cmd=python2
-   [[ ${test_missing_external_prereq_[python2]} == t ]]  cmd=python
-
(echo import sys; _orig_stdout=sys.stdout; sys.stdout=open('OUTPUT', 
'w'); cat) \
-   | $cmd -
+   | $NOTMUCH_PYTHON -
 }
 
 test_ruby() {
@@ -1325,5 +1319,4 @@ test_declare_external_prereq emacs
 test_declare_external_prereq ${TEST_EMACSCLIENT}
 test_declare_external_prereq gdb
 test_declare_external_prereq gpg
-test_declare_external_prereq python
-test_declare_external_prereq python2
+test_declare_external_prereq ${NOTMUCH_PYTHON}
-- 
2.1.4

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


Re: [PATCH] test: use the python interpreter in sh.config

2015-08-02 Thread Tomi Ollila
On Sun, Aug 02 2015, David Bremner da...@tethera.net wrote:

 The configure script chooses python if both python and python{2,3}
 exist exists, so this could change the version of python used to run
 the test suite.

LGTM. tests pass. 


 The checking for ${NOTMUCH_PYTHON} in the test suite is arguably
 over-engineering, since the configure step will fail if it can't find
 it.

Unless we accidentally edit NOTMUCH_PYTHON (away) in configure...
(i.e. I parsonally think this comment part is unnecessary, but i'm not
against having it)

Tomi

 ---

 Here is an updated version which fixes the subject typo, and actually
 tests for the python binary read from sh.config. I'll probably merge this 
 version unless there are objections

  configure   |  2 ++
  test/T390-python.sh |  2 ++
  test/test-lib.sh| 15 ---
  3 files changed, 8 insertions(+), 11 deletions(-)

 diff --git a/configure b/configure
 index 56f550b..20fbed6 100755
 --- a/configure
 +++ b/configure
 @@ -114,6 +114,8 @@ Other environment variables can be used to control 
 configure itself,
   XAPIAN_CONFIG   The program to use to determine flags for
   compiling and linking against the Xapian
   library. [$XAPIAN_CONFIG]
 + PYTHON  Name of python command to use in
 + configure and the test suite.
  
  Additionally, various options can be specified on the configure
  command line.
 diff --git a/test/T390-python.sh b/test/T390-python.sh
 index 26d0b97..c3f24f7 100755
 --- a/test/T390-python.sh
 +++ b/test/T390-python.sh
 @@ -2,6 +2,8 @@
  test_description=python bindings
  . ./test-lib.sh
  
 +test_require_external_prereq ${NOTMUCH_PYTHON}
 +
  add_email_corpus
  
  test_begin_subtest compare thread ids
 diff --git a/test/test-lib.sh b/test/test-lib.sh
 index 3466e9c..db3b6aa 100644
 --- a/test/test-lib.sh
 +++ b/test/test-lib.sh
 @@ -621,9 +621,9 @@ test_expect_equal_json () {
  # The test suite forces LC_ALL=C, but this causes Python 3 to
  # decode stdin as ASCII.  We need to read JSON in UTF-8, so
  # override Python's stdio encoding defaults.
 -output=$(echo $1 | PYTHONIOENCODING=utf-8 python -mjson.tool \
 +output=$(echo $1 | PYTHONIOENCODING=utf-8 $NOTMUCH_PYTHON -mjson.tool \
  || echo $1)
 -expected=$(echo $2 | PYTHONIOENCODING=utf-8 python -mjson.tool \
 +expected=$(echo $2 | PYTHONIOENCODING=utf-8 $NOTMUCH_PYTHON 
 -mjson.tool \
  || echo $2)
  shift 2
  test_expect_equal $output $expected $@
 @@ -1153,14 +1153,8 @@ test_python() {
   export LD_LIBRARY_PATH=$TEST_DIRECTORY/../lib
   export PYTHONPATH=$TEST_DIRECTORY/../bindings/python
  
 - # Some distros (e.g. Arch Linux) ship Python 2.* as /usr/bin/python2,
 - # most others as /usr/bin/python. So first try python2, and fallback to
 - # python if python2 doesn't exist.
 - cmd=python2
 - [[ ${test_missing_external_prereq_[python2]} == t ]]  cmd=python
 -
   (echo import sys; _orig_stdout=sys.stdout; sys.stdout=open('OUTPUT', 
 'w'); cat) \
 - | $cmd -
 + | $NOTMUCH_PYTHON -
  }
  
  test_ruby() {
 @@ -1325,5 +1319,4 @@ test_declare_external_prereq emacs
  test_declare_external_prereq ${TEST_EMACSCLIENT}
  test_declare_external_prereq gdb
  test_declare_external_prereq gpg
 -test_declare_external_prereq python
 -test_declare_external_prereq python2
 +test_declare_external_prereq ${NOTMUCH_PYTHON}
 -- 
 2.1.4

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


[PATCH] devel/release-checks: added checking of copyright year in documentation

2015-08-02 Thread Tomi Ollila
Check that copyright year will be current year in generated documentation.

The checking is done my matching that copyright line contains current
year as a substring which is good enough approximation in this context.
---
 devel/release-checks.sh | 12 
 1 file changed, 12 insertions(+)

diff --git a/devel/release-checks.sh b/devel/release-checks.sh
index bf0d68a444b6..b655a5089e12 100755
--- a/devel/release-checks.sh
+++ b/devel/release-checks.sh
@@ -207,6 +207,18 @@ case $news_date in
append_emsg Date '$news_date' in NEWS file is not in format 
(-mm-dd)
 esac
 
+year=`exec date +%Y`
+echo -n Checking that copyright line in documentation contains $year... 
+copyrightline=`exec python -c __file__ = 'command-line'
+with open('doc/conf.py') as cf: exec(cf.read()); print(copyright)`
+case $copyrightline in
+   *$year*)
+   echo Yes. ;;
+   *)
+   echo No.
+   append_emsg The copyright in doc/conf.py line '$copyrightline' 
does not contain '$year'
+esac
+
 if [ -n $emsgs ]
 then
echo
-- 
2.0.0

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


Re: [PATCH] custom search prefix

2015-08-02 Thread David Bremner

Hi Sebastian;

Sorry this sat so long in the queue.

I agree it doesn't cost much to add it, but offhand I'm not sure what
the use case is. It would be be good to (briefly) mention this in the
commit message and also expand the docstring for the variable a bit,
since this is currently our only documentation.

 +(defcustom notmuch-query-prefix nil
 +  Add a prefix to the standard query.
 +  :type 'string
 +  :group 'notmuch-search)
 +

In addition to general comments about, I'd say that standard query is
a bit ambigious for me. It sounds like it would be added e.g. to
saved-searches.  Maybe default search, with some discussion of where
it is used (so people don't have to read the source to figure it out).

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


[PATCH 1/2] emacs: renamed function notmuch-version to notmuch-cli-version

2015-08-02 Thread Tomi Ollila
As it asks `notmuch` binary for its version number.
---

This is 3rd revision, previous in 
id:1426932955-23174-1-git-send-email-tomi.oll...@iki.fi

 emacs/notmuch-hello.el | 2 +-
 emacs/notmuch-lib.el   | 4 ++--
 emacs/notmuch-mua.el   | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 65d0627..7bfa752 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -628,7 +628,7 @@ (defvar notmuch-emacs-version)
 (defun notmuch-hello-versions ()
   Display the notmuch version(s)
   (interactive)
-  (let ((notmuch-cli-version (notmuch-version)))
+  (let ((notmuch-cli-version (notmuch-cli-version)))
 (message notmuch version %s
 (if (string= notmuch-emacs-version notmuch-cli-version)
 notmuch-cli-version
diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index f8e5165..e16a1b9 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -192,8 +192,8 @@ (defun notmuch-assert-cli-sane ()
 Perhaps you haven't run \notmuch setup\ yet? Try running this
 on the command line, and then retry your notmuch command)))
 
-(defun notmuch-version ()
-  Return a string with the notmuch version number.
+(defun notmuch-cli-version ()
+  Return a string with the notmuch cli command version number.
   (let ((long-string
 ;; Trim off the trailing newline.
 (substring (notmuch-command-to-string --version) 0 -1)))
diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
index 33f1399..934f6c9 100644
--- a/emacs/notmuch-mua.el
+++ b/emacs/notmuch-mua.el
@@ -118,7 +118,7 @@ (defun notmuch-mua-user-agent-full ()
 
 (defun notmuch-mua-user-agent-notmuch ()
   Generate a `User-Agent:' string suitable for notmuch.
-  (concat Notmuch/ (notmuch-version)  (http://notmuchmail.org)))
+  (concat Notmuch/ (notmuch-cli-version)  (http://notmuchmail.org)))
 
 (defun notmuch-mua-user-agent-emacs ()
   Generate a `User-Agent:' string suitable for notmuch.
-- 
1.9.3

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


[PATCH 2/2] emacs: prefer notmuch-emacs-version in User-Agent: header

2015-08-02 Thread Tomi Ollila
Now that we have `notmuch-emacs-version' defined in notmuch emacs MUA
use that as a part of User-Agent: header to provide more accurate
version information when sending emails.

In case some incomplete installation of notmuch emacs MUA is used and
`notmuch-emacs-version' is defined as unknown then fall back to ask
version info from cli (as it used to be before this commit).

Requiring notmuch-version[.elc] and if that is missing setting
fallback notmuch-emacs-version (to unknown) was moved from
notmuch.el to notmuch-lib.el as notmuch-mua.el (which provides
User-Agent: information) require's the latter.
---

Note that I did not create notmuch-guess-emacs-version (or something)
function. The idea is good but there is one HARD problem: naming it.
Also, I personally suspect that no-one is going to need that function in
coming years...

 emacs/notmuch-lib.el | 4 
 emacs/notmuch-mua.el | 5 -
 emacs/notmuch.el | 4 
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index e16a1b9..201d7ec 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -25,6 +25,10 @@
 (require 'mm-decode)
 (require 'cl)
 
+(unless (require 'notmuch-version nil t)
+  (defconst notmuch-emacs-version unknown
+Placeholder variable when notmuch-version.el[c] is not available.))
+
 (autoload 'notmuch-jump-search notmuch-jump
   Jump to a saved search by shortcut key. t)
 
diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
index 934f6c9..3e52d5e 100644
--- a/emacs/notmuch-mua.el
+++ b/emacs/notmuch-mua.el
@@ -118,7 +118,10 @@ (defun notmuch-mua-user-agent-full ()
 
 (defun notmuch-mua-user-agent-notmuch ()
   Generate a `User-Agent:' string suitable for notmuch.
-  (concat Notmuch/ (notmuch-cli-version)  (http://notmuchmail.org)))
+  (let ((notmuch-version (if (string= notmuch-emacs-version unknown)
+(notmuch-cli-version)
+  notmuch-emacs-version)))
+(concat Notmuch/ notmuch-version  (http://notmuchmail.org
 
 (defun notmuch-mua-user-agent-emacs ()
   Generate a `User-Agent:' string suitable for notmuch.
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 6564816..5284e77 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -61,10 +61,6 @@
 (require 'notmuch-message)
 (require 'notmuch-parser)
 
-(unless (require 'notmuch-version nil t)
-  (defconst notmuch-emacs-version unknown
-Placeholder variable when notmuch-version.el[c] is not available.))
-
 (defcustom notmuch-search-result-format
   `((date . %12s )
 (count . %-7s )
-- 
1.9.3

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


Re: [PATCH] notmuch-emacs-mua: do not start emacs daemon w/o --create-frame

2015-08-02 Thread David Bremner
Tomi Ollila tomi.oll...@iki.fi writes:

 notmuch-emacs-mua --client used to start daemon process if it was
 not running -- just that no emacs mail window of any kind from
 that is visible to the user.

 When not starting emacs server in this case notmuch-emacs-mua
 user will get the same message as would emacsclient user
 have, which should be enough for such user to understand how
 to proceed starting emacs server in a way that it is useable
 for this purpose.

I'm not a big fan of overloading arguments, i.e. if the daemon isn't
automatically started for all uses of --client, I'd rather there was
another argument like --auto-daemon so that there are at least 4 ways of
invoking

| n-e-m   | start a new emacs instance, and 
kill it after |
| n-e-m --client  | like emacsclient
  |
| n-e-m --client --create-frame   | like emacsclient -c, destroy 
after send   |
| n-e-m --client --create-frame --auto-daemon | like emacsclient -c -a, destroy 
after send|

Since there are probably only 3 users, this should be sufficient ;).
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch