[PATCH] doc: whitespace cleanup

2016-11-26 Thread Tomi Ollila
In most part, our .rst documents are indented with 8 spaces instead
of tabs. Bring the rest of the lines to the same format.
Also, on one (supposedly empty) line, trailing spaces were removed.
---

This set is something that does not collide with anything that is
currently in the review queue -- and, currently, the 2 doc files
in review queue (notmuch-new.rst & notmuch-search-terms.rst) don't
contain dirty whitespace.

 doc/man1/notmuch-address.rst | 10 +-
 doc/man1/notmuch-config.rst  |  8 
 doc/man1/notmuch-count.rst   |  6 +++---
 doc/man1/notmuch-dump.rst| 18 +-
 doc/man1/notmuch-restore.rst | 24 
 5 files changed, 33 insertions(+), 33 deletions(-)

diff --git a/doc/man1/notmuch-address.rst b/doc/man1/notmuch-address.rst
index 7f7214b..446cefb 100644
--- a/doc/man1/notmuch-address.rst
+++ b/doc/man1/notmuch-address.rst
@@ -64,11 +64,11 @@ Supported options for **address** include
 messages. This is not applicable with --output=count.
 
 **mailbox**
-   Deduplicate addresses based on the full, case sensitive
-   name and email address, or mailbox. This is effectively
-   the same as piping the --deduplicate=no output to **sort |
-   uniq**, except for the order of results. This is the
-   default.
+Deduplicate addresses based on the full, case sensitive
+name and email address, or mailbox. This is effectively
+the same as piping the --deduplicate=no output to **sort |
+uniq**, except for the order of results. This is the
+default.
 
 **address**
 Deduplicate addresses based on the case insensitive
diff --git a/doc/man1/notmuch-config.rst b/doc/man1/notmuch-config.rst
index 5a517eb..7483b75 100644
--- a/doc/man1/notmuch-config.rst
+++ b/doc/man1/notmuch-config.rst
@@ -129,14 +129,14 @@ The available configuration items are described below.
 
 Name (or full path) of gpg binary to use in verification and
 decryption of PGP/MIME messages.
-
+
 Default: ``gpg``.
 
 **built_with.**
 
-   Compile time feature . Current possibilities include
-   "compact" (see **notmuch-compact(1)**)
-   and "field_processor" (see **notmuch-search-terms(7)**).
+Compile time feature . Current possibilities include
+"compact" (see **notmuch-compact(1)**)
+and "field_processor" (see **notmuch-search-terms(7)**).
 
 **query.**
 
diff --git a/doc/man1/notmuch-count.rst b/doc/man1/notmuch-count.rst
index 99de13a..90d852a 100644
--- a/doc/man1/notmuch-count.rst
+++ b/doc/man1/notmuch-count.rst
@@ -48,9 +48,9 @@ Supported options for **count** include
 compatible with specifying search terms on the command line.
 
 ``--lastmod``
-   Append lastmod (counter for number of database updates) and UUID
-   to the output. lastmod values are only comparable between databases
-   with the same UUID.
+Append lastmod (counter for number of database updates) and UUID
+to the output. lastmod values are only comparable between databases
+with the same UUID.
 
 ``--input=``\ 
 Read input from given file, instead of from stdin. Implies
diff --git a/doc/man1/notmuch-dump.rst b/doc/man1/notmuch-dump.rst
index 5857027..ca048ae 100644
--- a/doc/man1/notmuch-dump.rst
+++ b/doc/man1/notmuch-dump.rst
@@ -77,21 +77,21 @@ Supported options for **dump** include
 
   **config**
 
-   Output configuration data stored in the database. Each line
-   starts with "#@ ", followed by a space separated key-value
-   pair.  Both key and value are hex encoded if needed.
+Output configuration data stored in the database. Each line
+starts with "#@ ", followed by a space separated key-value
+pair.  Both key and value are hex encoded if needed.
 
   **properties**
 
-   Output per-message (key,value) metadata.  Each line starts
-   with "#= ", followed by a message id, and a space separated
-   list of key=value pairs.  pair.  Ids, keys and values are hex
-   encoded if needed.
+Output per-message (key,value) metadata.  Each line starts
+with "#= ", followed by a message id, and a space separated
+list of key=value pairs.  pair.  Ids, keys and values are hex
+encoded if needed.
 
   **tags**
 
-   Output per-message boolean metadata, namely tags. See *format* above
-   for description of the output.
+Output per-message boolean metadata, namely tags. See *format* above
+for description of the output.
 
   The default is to include all available types of data.  The
   option can be specified multiple times to select some subset. As
diff --git a/doc/man1/notmuch-restore.rst b/doc/man1/notmuch-restore.rst
index c681fa2..cb68bc8 100644
--- a/doc/man1/notmuch-restore.rst
+++ b/doc/man1/notmuch-restore.rst
@@ -54,23 +54,23 @@ 

Re: [PATCH v3] build: install notmuch-emacs-mua.desktop file with emacs

2016-11-26 Thread Tomi Ollila
On Sat, Nov 26 2016, Jani Nikula  wrote:

> There is really no need to have a separate install target for the
> desktop file. Just install the desktop file with emacs, with a
> configure option to opt out.
>
> ---
>
> v3: check for desktop-file-install in configure.

This and the next change LGTM.

>
> I don't see a reason to differentiate between "with desktop" and "have
> desktop-file-install", so I'm simply setting WITH_DESKTOP=0 if
> desktop-file-install is not available.
> ---
>  configure| 23 +++
>  emacs/Makefile.local |  5 ++---
>  2 files changed, 25 insertions(+), 3 deletions(-)
>
> diff --git a/configure b/configure
> index f0fc466eead5..72db26dfc52e 100755
> --- a/configure
> +++ b/configure
> @@ -70,6 +70,7 @@ LIBDIR=
>  WITH_DOCS=1
>  WITH_API_DOCS=1
>  WITH_EMACS=1
> +WITH_DESKTOP=1
>  WITH_BASH=1
>  WITH_RUBY=1
>  WITH_ZSH=1
> @@ -141,6 +142,7 @@ Some features can be disabled (--with-feature=no is 
> equivalent to
>   --without-docs  Do not install documentation
>   --without-api-docs  Do not install API man page
>   --without-emacs Do not install lisp file
> + --without-desktop   Do not install desktop file
>   --without-ruby  Do not install ruby bindings
>   --without-zsh-completionDo not install zsh completions files
>   --without-retry-lockDo not use blocking xapian opens, even 
> if available
> @@ -209,6 +211,14 @@ for option; do
>   fi
>  elif [ "${option}" = '--without-emacs' ] ; then
>   WITH_EMACS=0
> +elif [ "${option%%=*}" = '--with-desktop' ]; then
> + if [ "${option#*=}" = 'no' ]; then
> + WITH_DESKTOP=0
> + else
> + WITH_DESKTOP=1
> + fi
> +elif [ "${option}" = '--without-desktop' ] ; then
> + WITH_DESKTOP=0
>  elif [ "${option%%=*}" = '--with-bash-completion' ]; then
>   if [ "${option#*=}" = 'no' ]; then
>   WITH_BASH=0
> @@ -602,6 +612,16 @@ if [ $WITH_DOCS = "1" ] ; then
>  fi
>  fi
>  
> +if [ $WITH_DESKTOP = "1" ]; then
> +printf "Checking if desktop-file-install is available... "
> +if command -v desktop-file-install > /dev/null; then
> + printf "Yes.\n"
> +else
> + printf "No (so will not install .desktop file).\n"
> + WITH_DESKTOP=0
> +fi
> +fi
> +
>  libdir_in_ldconfig=0
>  
>  printf "Checking which platform we are on... "
> @@ -1123,6 +1143,9 @@ VALGRIND_CFLAGS = ${valgrind_cflags}
>  # Support for emacs
>  WITH_EMACS = ${WITH_EMACS}
>  
> +# Support for desktop file
> +WITH_DESKTOP = ${WITH_DESKTOP}
> +
>  # Support for bash completion
>  WITH_BASH = ${WITH_BASH}
>  
> diff --git a/emacs/Makefile.local b/emacs/Makefile.local
> index b47577ac1110..ffa8421ebd45 100644
> --- a/emacs/Makefile.local
> +++ b/emacs/Makefile.local
> @@ -96,10 +96,9 @@ endif
>   install -m0644 $(emacs_images) "$(DESTDIR)$(emacsetcdir)"
>   mkdir -p "$(DESTDIR)$(prefix)/bin/"
>   install $(emacs_mua) "$(DESTDIR)$(prefix)/bin"
> -
> -.PHONY: install-desktop
> -install-desktop:
> +ifeq ($(WITH_DESKTOP),1)
>   mkdir -p "$(DESTDIR)$(desktop_dir)"
>   desktop-file-install --mode 0644 --dir "$(DESTDIR)$(desktop_dir)" 
> $(emacs_mua_desktop)
> +endif
>  
>  CLEAN := $(CLEAN) $(emacs_bytecode) $(dir)/notmuch-version.el 
> $(dir)/notmuch-pkg.el
> -- 
> 2.1.4
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: provide elpa packages

2016-11-26 Thread Tomi Ollila
On Sat, Nov 26 2016, David Bremner  wrote:

> Tomi Ollila  writes:
>
>>
>> (you could amend copying Makefile.global for out of tree builds -- or use
>> include $(srcdir)/Makefile.global)
>>
>
> OK, I did that, and pushed to master and release. BTW, the next line
> still looks problematic for oot builds? Did not test...

oot builds (and tests) works fine with that and my patches applied.

Tomi

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


Re: [PATCH v2 6/9] notmuch.desktop: move under emacs as notmuch-emacs-mua.desktop

2016-11-26 Thread David Bremner
Jani Nikula  writes:

> The notmuch.desktop file is part of notmuch-emacs. Move it under
> emacs, and rename as notmuch-emacs-mua.desktop to reflect this.

Pushed patches 2-6 to master

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


Re: provide elpa packages

2016-11-26 Thread David Bremner
Tomi Ollila  writes:

>
> (you could amend copying Makefile.global for out of tree builds -- or use
> include $(srcdir)/Makefile.global)
>

OK, I did that, and pushed to master and release. BTW, the next line
still looks problematic for oot builds? Did not test...

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


[PATCH v3] build: update the desktop database after installing the desktop file

2016-11-26 Thread Jani Nikula
This makes the option to choose Notmuch as mailto: handler show up in
the desktop environment settings. Ignore errors.

---

v3: ignore errors on update-desktop-database. I don't want to skip
desktop-file-install if update-desktop-database is not available, and
if update fails, it's likely a transient error anyway.
---
 emacs/Makefile.local | 1 +
 1 file changed, 1 insertion(+)

diff --git a/emacs/Makefile.local b/emacs/Makefile.local
index ffa8421ebd45..5fff019da73d 100644
--- a/emacs/Makefile.local
+++ b/emacs/Makefile.local
@@ -99,6 +99,7 @@ endif
 ifeq ($(WITH_DESKTOP),1)
mkdir -p "$(DESTDIR)$(desktop_dir)"
desktop-file-install --mode 0644 --dir "$(DESTDIR)$(desktop_dir)" 
$(emacs_mua_desktop)
+   -update-desktop-database "$(DESTDIR)$(desktop_dir)"
 endif
 
 CLEAN := $(CLEAN) $(emacs_bytecode) $(dir)/notmuch-version.el 
$(dir)/notmuch-pkg.el
-- 
2.1.4

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


[PATCH v3] build: install notmuch-emacs-mua.desktop file with emacs

2016-11-26 Thread Jani Nikula
There is really no need to have a separate install target for the
desktop file. Just install the desktop file with emacs, with a
configure option to opt out.

---

v3: check for desktop-file-install in configure.

I don't see a reason to differentiate between "with desktop" and "have
desktop-file-install", so I'm simply setting WITH_DESKTOP=0 if
desktop-file-install is not available.
---
 configure| 23 +++
 emacs/Makefile.local |  5 ++---
 2 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/configure b/configure
index f0fc466eead5..72db26dfc52e 100755
--- a/configure
+++ b/configure
@@ -70,6 +70,7 @@ LIBDIR=
 WITH_DOCS=1
 WITH_API_DOCS=1
 WITH_EMACS=1
+WITH_DESKTOP=1
 WITH_BASH=1
 WITH_RUBY=1
 WITH_ZSH=1
@@ -141,6 +142,7 @@ Some features can be disabled (--with-feature=no is 
equivalent to
--without-docs  Do not install documentation
--without-api-docs  Do not install API man page
--without-emacs Do not install lisp file
+   --without-desktop   Do not install desktop file
--without-ruby  Do not install ruby bindings
--without-zsh-completionDo not install zsh completions files
--without-retry-lockDo not use blocking xapian opens, even 
if available
@@ -209,6 +211,14 @@ for option; do
fi
 elif [ "${option}" = '--without-emacs' ] ; then
WITH_EMACS=0
+elif [ "${option%%=*}" = '--with-desktop' ]; then
+   if [ "${option#*=}" = 'no' ]; then
+   WITH_DESKTOP=0
+   else
+   WITH_DESKTOP=1
+   fi
+elif [ "${option}" = '--without-desktop' ] ; then
+   WITH_DESKTOP=0
 elif [ "${option%%=*}" = '--with-bash-completion' ]; then
if [ "${option#*=}" = 'no' ]; then
WITH_BASH=0
@@ -602,6 +612,16 @@ if [ $WITH_DOCS = "1" ] ; then
 fi
 fi
 
+if [ $WITH_DESKTOP = "1" ]; then
+printf "Checking if desktop-file-install is available... "
+if command -v desktop-file-install > /dev/null; then
+   printf "Yes.\n"
+else
+   printf "No (so will not install .desktop file).\n"
+   WITH_DESKTOP=0
+fi
+fi
+
 libdir_in_ldconfig=0
 
 printf "Checking which platform we are on... "
@@ -1123,6 +1143,9 @@ VALGRIND_CFLAGS = ${valgrind_cflags}
 # Support for emacs
 WITH_EMACS = ${WITH_EMACS}
 
+# Support for desktop file
+WITH_DESKTOP = ${WITH_DESKTOP}
+
 # Support for bash completion
 WITH_BASH = ${WITH_BASH}
 
diff --git a/emacs/Makefile.local b/emacs/Makefile.local
index b47577ac1110..ffa8421ebd45 100644
--- a/emacs/Makefile.local
+++ b/emacs/Makefile.local
@@ -96,10 +96,9 @@ endif
install -m0644 $(emacs_images) "$(DESTDIR)$(emacsetcdir)"
mkdir -p "$(DESTDIR)$(prefix)/bin/"
install $(emacs_mua) "$(DESTDIR)$(prefix)/bin"
-
-.PHONY: install-desktop
-install-desktop:
+ifeq ($(WITH_DESKTOP),1)
mkdir -p "$(DESTDIR)$(desktop_dir)"
desktop-file-install --mode 0644 --dir "$(DESTDIR)$(desktop_dir)" 
$(emacs_mua_desktop)
+endif
 
 CLEAN := $(CLEAN) $(emacs_bytecode) $(dir)/notmuch-version.el 
$(dir)/notmuch-pkg.el
-- 
2.1.4

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


[PATCH] test: check the handling of files vanishing between scandir and indexing

2016-11-26 Thread Jani Nikula
Add a file for scandir to find, but use gdb to remove it before it
gets indexed.

---

The ugly part is that this should require gdb as external dep... but
we shouldn't skip all of T050-new.sh if gdb isn't there. I'm in a
hurry, any good ideas?
---
 test/T050-new.sh | 30 ++
 1 file changed, 30 insertions(+)

diff --git a/test/T050-new.sh b/test/T050-new.sh
index beeb574a3b30..072b63a148cc 100755
--- a/test/T050-new.sh
+++ b/test/T050-new.sh
@@ -298,4 +298,34 @@ output=$(NOTMUCH_NEW --debug 2>&1 | sed 's/: .*$//' )
 chmod u+w  ${MAIL_DIR}/.notmuch/xapian/*.${db_ending}
 test_expect_equal "$output" "A Xapian exception occurred opening database"
 
+
+test_begin_subtest "Handle files vanishing between scandir and add_file"
+
+# A file for scandir to find. It won't get indexed, so can be empty.
+touch ${MAIL_DIR}/vanish
+
+# Breakpoint to remove the file before indexing
+cat < notmuch-new-vanish.gdb
+set breakpoint pending on
+set logging file notmuch-new-vanish-gdb.log
+set logging on
+break add_file
+commands
+shell rm -f ${MAIL_DIR}/vanish
+continue
+end
+run
+EOF
+
+gdb --batch-silent --return-child-result -x notmuch-new-vanish.gdb \
+--args notmuch new 2>OUTPUT 1>/dev/null
+echo "exit status: $?" >> OUTPUT
+cat < EXPECTED
+Unexpected error with file ${MAIL_DIR}/vanish
+add_file: Something went wrong trying to read or write a file
+Error opening ${MAIL_DIR}/vanish: No such file or directory
+exit status: 75
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
 test_done
-- 
2.1.4

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


Re: [PATCH] cli/new: document new exit code

2016-11-26 Thread Jani Nikula
On Sat, 26 Nov 2016, David Bremner  wrote:
> It seems important to give the numeric return code for people writing
> scripts. Hopefully deviations from this convention are rare.

*blush*

As a token of my gratitude, a test for the change follows. I'm not sure
if it's quite ready for merging, but the ground work is there.

Thanks,
Jani.

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