[PATCH] doc: unify definition list usage across man pages

2017-11-02 Thread Jani Nikula
Make all parameter descriptions etc. use reStructuredText definition
lists with uniform style and indentation. Remove redundant indentation
from around the lists. Remove blank lines between term lines and
definition blocks. Use four spaces for indentation.

This is almost completely whitespace and paragraph reflow changes.
---
 doc/man1/notmuch-address.rst| 160 -
 doc/man1/notmuch-compact.rst|  16 +--
 doc/man1/notmuch-config.rst | 256 +++-
 doc/man1/notmuch-count.rst  |  65 +-
 doc/man1/notmuch-dump.rst   | 116 +-
 doc/man1/notmuch-emacs-mua.rst  |  64 +-
 doc/man1/notmuch-insert.rst |  62 +-
 doc/man1/notmuch-new.rst|  33 +++---
 doc/man1/notmuch-reindex.rst|  21 ++--
 doc/man1/notmuch-reply.rst  |  94 ---
 doc/man1/notmuch-restore.rst| 118 +-
 doc/man1/notmuch-search.rst | 220 +-
 doc/man1/notmuch-show.rst   | 256 
 doc/man1/notmuch-tag.rst|  33 +++---
 doc/man1/notmuch.rst|  33 +++---
 doc/man5/notmuch-hooks.rst  |  55 +
 doc/man7/notmuch-properties.rst |   1 -
 17 files changed, 778 insertions(+), 825 deletions(-)

diff --git a/doc/man1/notmuch-address.rst b/doc/man1/notmuch-address.rst
index dbac20f7b012..00cb554523e7 100644
--- a/doc/man1/notmuch-address.rst
+++ b/doc/man1/notmuch-address.rst
@@ -18,88 +18,84 @@ See **notmuch-search-terms(7)** for details of the 
supported syntax for
 
 Supported options for **address** include
 
-``--format=``\ (**json**\ \|\ **sexp**\ \|\ **text**\ \|\ **text0**)
-Presents the results in either JSON, S-Expressions, newline
-character separated plain-text (default), or null character
-separated plain-text (compatible with **xargs(1)** -0 option
-where available).
-
-``--format-version=N``
-Use the specified structured output format version. This is
-intended for programs that invoke **notmuch(1)** internally. If
-omitted, the latest supported version will be used.
-
-``--output=(sender|recipients|count)``
-
-Controls which information appears in the output. This option
-can be given multiple times to combine different outputs.
-When neither --output=sender nor --output=recipients is
-given, --output=sender is implied.
-
-**sender**
-Output all addresses from the *From* header.
-
-Note: Searching for **sender** should be much faster than
-searching for **recipients**, because sender addresses are
-cached directly in the database whereas other addresses
-need to be fetched from message files.
-
-**recipients**
-Output all addresses from the *To*, *Cc* and *Bcc*
-headers.
-
-**count**
-Print the count of how many times was the address
-encountered during search.
-
-Note: With this option, addresses are printed only after
-the whole search is finished. This may take long time.
-
-``--deduplicate=(no|mailbox|address)``
-
-Control the deduplication of results.
-
-**no**
-Output all occurrences of addresses in the matching
-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.
-
-**address**
-Deduplicate addresses based on the case insensitive
-address part of the mailbox. Of all the variants (with
-different name or case), print the one occurring most
-frequently among the matching messages. If --output=count
-is specified, include all variants in the count.
-
-``--sort=``\ (**newest-first**\ \|\ **oldest-first**)
-This option can be used to present results in either
-chronological order (**oldest-first**) or reverse chronological
-order (**newest-first**).
-
-By default, results will be displayed in reverse chronological
-order, (that is, the newest results will be displayed first).
-
-However, if either --output=count or --deduplicate=address is
-specified, this option is ignored and the order of the results
-is unspecified.
-
-``--exclude=(true|false)``
-A message is called "excluded" if it matches at least one tag in
-search.tag\_exclude that does not appear explicitly in the
-search terms. This option specifies whether to omit excluded
-messages in the search process.
-
-The default value, **true**, pr

Re: [PATCH] test: test notmuch insert --folder=""

2017-11-02 Thread Tomi Ollila
On Thu, Nov 02 2017, Jani Nikula wrote:

I just wonder why our examples always use the format that is hardest to
write (these 3 being equivalent):

--folder=""  requires shift-2:s pressed twice on my keyboard
--folder=''  requires press '-key (w/o shift) (twice) on my keyboard
--folder=requires neither

  
That said, this change LGTM.

Tomi


> Test insert into top level folder.
> ---
>  test/T070-insert.sh | 7 +++
>  1 file changed, 7 insertions(+)
>
> diff --git a/test/T070-insert.sh b/test/T070-insert.sh
> index f1650e623e35..40519bb2f217 100755
> --- a/test/T070-insert.sh
> +++ b/test/T070-insert.sh
> @@ -132,6 +132,13 @@ output=$(notmuch search --output=files path:Drafts/new)
>  dirname=$(dirname "$output")
>  test_expect_equal "$dirname" "$MAIL_DIR/Drafts/new"
>  
> +test_begin_subtest "Insert message into top level folder"
> +gen_insert_msg
> +notmuch insert --folder="" < "$gen_msg_filename"
> +output=$(notmuch search --output=files id:${gen_msg_id})
> +dirname=$(dirname "$output")
> +test_expect_equal "$dirname" "$MAIL_DIR/new"
> +
>  test_begin_subtest "Insert message into folder with trailing /"
>  gen_insert_msg
>  notmuch insert --folder=Drafts/ < "$gen_msg_filename"
> -- 
> 2.11.0
>
> ___
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] test: test notmuch insert --folder=""

2017-11-02 Thread Jani Nikula
Test insert into top level folder.
---
 test/T070-insert.sh | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/test/T070-insert.sh b/test/T070-insert.sh
index f1650e623e35..40519bb2f217 100755
--- a/test/T070-insert.sh
+++ b/test/T070-insert.sh
@@ -132,6 +132,13 @@ output=$(notmuch search --output=files path:Drafts/new)
 dirname=$(dirname "$output")
 test_expect_equal "$dirname" "$MAIL_DIR/Drafts/new"
 
+test_begin_subtest "Insert message into top level folder"
+gen_insert_msg
+notmuch insert --folder="" < "$gen_msg_filename"
+output=$(notmuch search --output=files id:${gen_msg_id})
+dirname=$(dirname "$output")
+test_expect_equal "$dirname" "$MAIL_DIR/new"
+
 test_begin_subtest "Insert message into folder with trailing /"
 gen_insert_msg
 notmuch insert --folder=Drafts/ < "$gen_msg_filename"
-- 
2.11.0

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


[PATCH] cli: add support for only printing the addresses in notmuch address

2017-11-02 Thread Jani Nikula
The notmuch address output is much more useful for scripts with just
the addresses printed. Support this using the --output=address option.
---
 completion/notmuch-completion.bash |  2 +-
 doc/man1/notmuch-address.rst   |  7 ++-
 notmuch-search.c   |  7 ++-
 test/T095-address.sh   | 36 
 4 files changed, 49 insertions(+), 3 deletions(-)

diff --git a/completion/notmuch-completion.bash 
b/completion/notmuch-completion.bash
index 7aae4297ae0e..4e94275e3193 100644
--- a/completion/notmuch-completion.bash
+++ b/completion/notmuch-completion.bash
@@ -468,7 +468,7 @@ _notmuch_address()
return
;;
--output)
-   COMPREPLY=( $( compgen -W "sender recipients count" -- "${cur}" ) )
+   COMPREPLY=( $( compgen -W "sender recipients count address" -- 
"${cur}" ) )
return
;;
--sort)
diff --git a/doc/man1/notmuch-address.rst b/doc/man1/notmuch-address.rst
index dbac20f7b012..68415d13c5b6 100644
--- a/doc/man1/notmuch-address.rst
+++ b/doc/man1/notmuch-address.rst
@@ -29,7 +29,7 @@ Supported options for **address** include
 intended for programs that invoke **notmuch(1)** internally. If
 omitted, the latest supported version will be used.
 
-``--output=(sender|recipients|count)``
+``--output=(sender|recipients|count|address)``
 
 Controls which information appears in the output. This option
 can be given multiple times to combine different outputs.
@@ -55,6 +55,11 @@ Supported options for **address** include
 Note: With this option, addresses are printed only after
 the whole search is finished. This may take long time.
 
+**address**
+Output only the email addresses instead of the full
+mailboxes with names and email addresses. This option has
+no effect on the JSON or S-Expression output formats.
+
 ``--deduplicate=(no|mailbox|address)``
 
 Control the deduplication of results.
diff --git a/notmuch-search.c b/notmuch-search.c
index 0abac08eb7ab..8f467db43cf0 100644
--- a/notmuch-search.c
+++ b/notmuch-search.c
@@ -34,6 +34,7 @@ typedef enum {
 OUTPUT_SENDER  = 1 << 5,
 OUTPUT_RECIPIENTS  = 1 << 6,
 OUTPUT_COUNT   = 1 << 7,
+OUTPUT_ADDRESS = 1 << 8,
 } output_t;
 
 typedef enum {
@@ -370,7 +371,10 @@ print_mailbox (const search_context_t *ctx, const 
mailbox_t *mailbox)
format->integer (format, count);
format->string (format, "\t");
}
-   format->string (format, name_addr);
+   if (ctx->output & OUTPUT_ADDRESS)
+   format->string (format, addr);
+   else
+   format->string (format, name_addr);
format->separator (format);
 } else {
format->begin_map (format);
@@ -877,6 +881,7 @@ notmuch_address_command (notmuch_config_t *config, int 
argc, char *argv[])
  (notmuch_keyword_t []){ { "sender", OUTPUT_SENDER },
  { "recipients", OUTPUT_RECIPIENTS },
  { "count", OUTPUT_COUNT },
+ { "address", OUTPUT_ADDRESS },
  { 0, 0 } } },
{ .opt_keyword = &ctx->exclude, .name = "exclude", .keywords =
  (notmuch_keyword_t []){ { "true", NOTMUCH_EXCLUDE_TRUE },
diff --git a/test/T095-address.sh b/test/T095-address.sh
index f0291d29ec43..817be5380a45 100755
--- a/test/T095-address.sh
+++ b/test/T095-address.sh
@@ -119,6 +119,42 @@ cat OUTPUT
+cat OUTPUT
+cat 

Re: web interface to notmuch

2017-11-02 Thread Matthew Lear
On Wed, 1 Nov 2017, 14:38 Brian Sniffen,  wrote:

> On Oct 31, 2017, at 5:32 PM, Matthew Lear  wrote
>
> I’ll push some fixes to encoding to github later today.
>

I've just tested with e3ba123 and there is a significant improvement. Also,
attachments can be accessed from html too. And it's even faster than
before! Sweet :-) I've still got a couple of mails which don't throw
exceptions but do have issues when rendered in the browser (encoding of the
body generates unreadable characters). I'll try to send you some examples
tomorrow.
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch