revision tracking patches round 4

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

>
> Looked a bit to xapian documentation... it seems in case of compacting
> one should do the following:
>
> 1) see that current database uuid is the one expected (which is stored
> somewhere) 
> 2) compact database
> 3) read new uuid and store it to "somewhere"

right, I think this is basically right. It falls under the same general
lazy objections in id:87si7kx27c.fsf at maritornes.cs.unb.ca; I think
compact changing uuid is a short term problem.

d




[PATCH] lib: add support for date:..! to mean date:..

2015-08-15 Thread Jani Nikula
It doesn't seem likely we can support simple date: expanding to
date:.. any time soon. (This can be done with a future
version of Xapian, or with a custom query query parser.) In the mean
time, provide shorthand date:..! to mean the same. This is
useful, as the expansion takes place before interpetation, and we can
use, for example, date:yesterday..! to match from beginning of
yesterday to end of yesterday.

Idea from Mark Walters .
---
 doc/man7/notmuch-search-terms.rst | 12 +++-
 lib/parse-time-vrp.cc |  5 +
 test/T500-search-date.sh  |  4 
 3 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/doc/man7/notmuch-search-terms.rst 
b/doc/man7/notmuch-search-terms.rst
index 1d27ac1e6de5..3b35a32b7d23 100644
--- a/doc/man7/notmuch-search-terms.rst
+++ b/doc/man7/notmuch-search-terms.rst
@@ -270,6 +270,13 @@ In this case,  is taken as the earliest time it 
could describe
 could describe (the end of yesterday). Similarly, date:january..february
 matches from the beginning of January to the end of February.

+date:..! can be used as a shorthand for date:... The
+expansion takes place before interpretation, and thus, for example,
+date:monday..! matches from the beginning of Monday until the end of
+Monday. (Note that entering date: without "..", for example
+date:yesterday, won't work, as it's not interpreted as a range
+expression at all. Again, use date:yesterday..!)
+
 Currently, we do not support spaces in range expressions. You can
 replace the spaces with '\_', or (in most cases) '-', or (in some cases)
 leave the spaces out altogether. Examples in this man page use spaces
@@ -280,11 +287,6 @@ to specify date:.. or date:.. to not limit 
the start or
 end time, respectively. Pre-1.2.1 Xapian does not report an error on
 open ended ranges, but it does not work as expected either.

-Entering date:expr without ".." (for example date:yesterday) won't work,
-as it's not interpreted as a range expression at all. You can achieve
-the expected result by duplicating the expr both sides of ".." (for
-example date:yesterday..yesterday).
-
 Relative date and time
 --

diff --git a/lib/parse-time-vrp.cc b/lib/parse-time-vrp.cc
index 33f07db3410e..03804cf50fa8 100644
--- a/lib/parse-time-vrp.cc
+++ b/lib/parse-time-vrp.cc
@@ -31,6 +31,7 @@ Xapian::valueno
 ParseTimeValueRangeProcessor::operator() (std::string , std::string )
 {
 time_t t, now;
+std::string b;

 /* Require date: prefix in start of the range... */
 if (STRNCMP_LITERAL (begin.c_str (), PREFIX))
@@ -38,6 +39,7 @@ ParseTimeValueRangeProcessor::operator() (std::string , 
std::string )

 /* ...and remove it. */
 begin.erase (0, sizeof (PREFIX) - 1);
+b = begin;

 /* Use the same 'now' for begin and end. */
 if (time () == (time_t) -1)
@@ -51,6 +53,9 @@ ParseTimeValueRangeProcessor::operator() (std::string , 
std::string )
 }

 if (!end.empty ()) {
+   if (end == "!" && ! b.empty ())
+   end = b;
+
if (parse_time_string (end.c_str (), , , 
PARSE_TIME_ROUND_UP_INCLUSIVE))
return Xapian::BAD_VALUENO;

diff --git a/test/T500-search-date.sh b/test/T500-search-date.sh
index b28496b78e2e..f5cea421d785 100755
--- a/test/T500-search-date.sh
+++ b/test/T500-search-date.sh
@@ -8,6 +8,10 @@ test_begin_subtest "Absolute date range"
 output=$(notmuch search date:2010-12-16..12/16/2010 | notmuch_search_sanitize)
 test_expect_equal "$output" "thread:XXX   2010-12-16 [1/1] Olivier Berger; 
Essai accentué (inbox unread)"

+test_begin_subtest "Absolute date range with 'same' operator"
+output=$(notmuch search date:2010-12-16..! | notmuch_search_sanitize)
+test_expect_equal "$output" "thread:XXX   2010-12-16 [1/1] Olivier Berger; 
Essai accentué (inbox unread)"
+
 test_begin_subtest "Absolute time range with TZ"
 notmuch search date:18-Nov-2009_02:19:26-0800..2009-11-18_04:49:52-06:00 | 
notmuch_search_sanitize > OUTPUT
 cat 

[PATCH 3/5] cli/count: add --lastmod

2015-08-15 Thread David Bremner
Daniel Schoepe  writes:

> Sorry to keep harping on this, but I'm not entirely happy with the way
> we handle notmuch-compact here (and in the other commit that mentions
> compacting explicitly). Given that lastmod values (and pretty much
> everything else) aren't affected by compacting, would it perhaps make
> sense to copy the previous UUID to the newly compacted database?

We aren't currently maintaining a UUID for notmuch, but using
Xapian::database::get_uuid(). There is no way in Xapian to change the
UUID; even if there was, lying to Xapian probably would not be a good
idea.

We could maintain our own UUID, but I'm not sure it's worth the extra
code just to make compaction slightly nicer. 

For me compaction is a rare event, so having to take the fallback path
and do a full dump or whatever doesn't seem so bad. If you don't want to
have a fallback path, then I guess you need to guarantee externally that
no "bad changes" happen and either ignore the uuid's or copy them
forward in your external tool.

Mainly though I think this will be fixed in Xapian. As it happens Xapian
developer Olly Betts is here at DebConf, and I discussed this problem
with him. According to Olly, in-progress / future versions of compact
will function in place, and guarantee the UUID is preserved. I'm not
sure of the timeline here, but given our scarce developer resources, I
think I'd rather wait for Olly to fix this.

On the bright side, if in the future we decide that notmuch should have
it's own notion of UUID, then this would would not change the library
API or command line interface.  There is some argument here for giving
our name to the UUID, but "revision" turned out to be a terribly
confusing choice in previous rounds of patches.  The current transparent
naming has the advantage of matching the output.

d


[PATCH v4 5/5] notmuch-emacs-mua: do not create a frame by default with --client

2015-08-15 Thread Jani Nikula
Make the default behaviour for --client the same as emacsclient
default: do not create a new frame. Add a new option --create-frame,
passing the same option to emacsclient to create a frame.

---

v2: fix killing frame with --create-frame

v3: fix --create-frame w/o --client parameter check

v4: fix kill terminal logic, document behaviour with daemon mode
---
 doc/man1/notmuch-emacs-mua.rst |  6 ++
 notmuch-emacs-mua  | 14 ++
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/doc/man1/notmuch-emacs-mua.rst b/doc/man1/notmuch-emacs-mua.rst
index 89a2fead17b1..c3689eb82c8a 100644
--- a/doc/man1/notmuch-emacs-mua.rst
+++ b/doc/man1/notmuch-emacs-mua.rst
@@ -45,6 +45,12 @@ Supported options for **notmuch-emacs-mua** include
 Automatically start Emacs in daemon mode, if the Emacs server
 is not running. Applicable with ``--client``.

+``--create-frame``
+Create a new frame instead of trying to use the current Emacs
+frame. Applicable with ``--client``. This will be required
+when Emacs is running (or automatically started with
+``--auto-daemon``) in daemon mode.
+
 ``--print``
 Output the resulting elisp to stdout instead of evaluating it.

diff --git a/notmuch-emacs-mua b/notmuch-emacs-mua
index ac03a4a60d56..b51d8d0e2c5b 100755
--- a/notmuch-emacs-mua
+++ b/notmuch-emacs-mua
@@ -37,11 +37,10 @@ PRINT_ONLY=
 NO_WINDOW=
 USE_EMACSCLIENT=
 AUTO_DAEMON=
-CREATE_FRAME="-c"
+CREATE_FRAME=

 # The crux of it all: construct an elisp progn and eval it.
 ELISP="(prog1 'done (require 'notmuch) (notmuch-mua-new-mail)"
-ELISP="${ELISP} (setq message-exit-actions (list 
#'save-buffers-kill-terminal))"

 # Short options compatible with mutt(1).
 while getopts :s:c:b:i:h opt; do
@@ -65,7 +64,7 @@ while getopts :s:c:b:i:h opt; do
opt=${opt%%=*}
;;
# Long options without arguments.
-   --help|--print|--no-window-system|--client|--auto-daemon)
+   
--help|--print|--no-window-system|--client|--auto-daemon|--create-frame)
;;
*)
echo "$0: unknown long option ${opt}, or argument 
mismatch." >&2
@@ -103,7 +102,6 @@ while getopts :s:c:b:i:h opt; do
;;
--no-window-system)
NO_WINDOW="-nw"
-   CREATE_FRAME=
;;
--client)
USE_EMACSCLIENT="yes"
@@ -111,6 +109,9 @@ while getopts :s:c:b:i:h opt; do
--auto-daemon)
AUTO_DAEMON="--alternate-editor="
;;
+   --create-frame)
+   CREATE_FRAME="-c"
+   ;;
*)
# We should never end up here.
echo "$0: internal error (option ${opt})." >&2
@@ -128,6 +129,11 @@ for arg; do
 ELISP="${ELISP} (message-goto-to) (insert \"${arg}, \")"
 done

+# Kill the terminal/frame if we're creating one.
+if [ -z "$USE_EMACSCLIENT" -o -n "$CREATE_FRAME" -o -n "$NO_WINDOW" ]; then
+ELISP="${ELISP} (setq message-exit-actions (list 
#'save-buffers-kill-terminal))"
+fi
+
 # End progn.
 ELISP="${ELISP})"

-- 
2.1.4



[PATCH v4 4/5] notmuch-emacs-mua: add --auto-daemon option to start Emacs daemon as needed

2015-08-15 Thread Jani Nikula
Automatically starting Emacs in daemon mode if the Emacs server is not
running is a matter of preference better not hard coded in
notmuch-emacs-mua. Add an option to control the behaviour.
---
 doc/man1/notmuch-emacs-mua.rst | 9 +++--
 notmuch-emacs-mua  | 8 ++--
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/doc/man1/notmuch-emacs-mua.rst b/doc/man1/notmuch-emacs-mua.rst
index 7c2f5c24f1c0..89a2fead17b1 100644
--- a/doc/man1/notmuch-emacs-mua.rst
+++ b/doc/man1/notmuch-emacs-mua.rst
@@ -37,8 +37,13 @@ Supported options for **notmuch-emacs-mua** include
 Even if a window system is available, use the current terminal.

 ``--client``
-Use **emacsclient**, rather than **emacs**. This will start
-an Emacs daemon process if necessary.
+Use **emacsclient**, rather than **emacs**. For
+**emacsclient** to work, you need an already running Emacs
+with a server, or use ``--auto-daemon``.
+
+``--auto-daemon``
+Automatically start Emacs in daemon mode, if the Emacs server
+is not running. Applicable with ``--client``.

 ``--print``
 Output the resulting elisp to stdout instead of evaluating it.
diff --git a/notmuch-emacs-mua b/notmuch-emacs-mua
index 1f088c42feb9..ac03a4a60d56 100755
--- a/notmuch-emacs-mua
+++ b/notmuch-emacs-mua
@@ -36,6 +36,7 @@ EMACSCLIENT=${EMACSCLIENT-emacsclient}
 PRINT_ONLY=
 NO_WINDOW=
 USE_EMACSCLIENT=
+AUTO_DAEMON=
 CREATE_FRAME="-c"

 # The crux of it all: construct an elisp progn and eval it.
@@ -64,7 +65,7 @@ while getopts :s:c:b:i:h opt; do
opt=${opt%%=*}
;;
# Long options without arguments.
-   --help|--print|--no-window-system|--client)
+   --help|--print|--no-window-system|--client|--auto-daemon)
;;
*)
echo "$0: unknown long option ${opt}, or argument 
mismatch." >&2
@@ -107,6 +108,9 @@ while getopts :s:c:b:i:h opt; do
--client)
USE_EMACSCLIENT="yes"
;;
+   --auto-daemon)
+   AUTO_DAEMON="--alternate-editor="
+   ;;
*)
# We should never end up here.
echo "$0: internal error (option ${opt})." >&2
@@ -134,7 +138,7 @@ fi

 if [ -n "$USE_EMACSCLIENT" ]; then
 # Evaluate the progn.
-exec ${EMACSCLIENT} ${NO_WINDOW} ${CREATE_FRAME} -a '' --eval "${ELISP}"
+exec ${EMACSCLIENT} ${NO_WINDOW} ${CREATE_FRAME} ${AUTO_DAEMON} --eval 
"${ELISP}"
 else
 exec ${EMACS} ${NO_WINDOW} --eval "${ELISP}"
 fi
-- 
2.1.4



[PATCH v4 3/5] notmuch-emacs-mua: move --client option handling around

2015-08-15 Thread Jani Nikula
Move --client handling to a more suitable location. No functional
changes.
---
 notmuch-emacs-mua | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/notmuch-emacs-mua b/notmuch-emacs-mua
index e33aa955d6b5..1f088c42feb9 100755
--- a/notmuch-emacs-mua
+++ b/notmuch-emacs-mua
@@ -82,9 +82,6 @@ while getopts :s:c:b:i:h opt; do
--help|h)
exec man notmuch-emacs-mua
;;
-   --client)
-   USE_EMACSCLIENT="yes"
-   ;;
--subject|s)
ELISP="${ELISP} (message-goto-subject) (insert \"${OPTARG}\")"
;;
@@ -107,6 +104,9 @@ while getopts :s:c:b:i:h opt; do
NO_WINDOW="-nw"
CREATE_FRAME=
;;
+   --client)
+   USE_EMACSCLIENT="yes"
+   ;;
*)
# We should never end up here.
echo "$0: internal error (option ${opt})." >&2
-- 
2.1.4



[PATCH v4 2/5] notmuch-emacs-mua: support --no-window-system also for non-client

2015-08-15 Thread Jani Nikula
Clearly --no-window-system should be applicable without --client as
well. Prepare for future changes with the naming of the variables.
---
 notmuch-emacs-mua | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/notmuch-emacs-mua b/notmuch-emacs-mua
index 79714305b3e2..e33aa955d6b5 100755
--- a/notmuch-emacs-mua
+++ b/notmuch-emacs-mua
@@ -34,8 +34,9 @@ EMACS=${EMACS-emacs}
 EMACSCLIENT=${EMACSCLIENT-emacsclient}

 PRINT_ONLY=
+NO_WINDOW=
 USE_EMACSCLIENT=
-CLIENT_TYPE="-c"
+CREATE_FRAME="-c"

 # The crux of it all: construct an elisp progn and eval it.
 ELISP="(prog1 'done (require 'notmuch) (notmuch-mua-new-mail)"
@@ -103,7 +104,8 @@ while getopts :s:c:b:i:h opt; do
PRINT_ONLY=1
;;
--no-window-system)
-   CLIENT_TYPE="-t"
+   NO_WINDOW="-nw"
+   CREATE_FRAME=
;;
*)
# We should never end up here.
@@ -132,7 +134,7 @@ fi

 if [ -n "$USE_EMACSCLIENT" ]; then
 # Evaluate the progn.
-exec ${EMACSCLIENT} ${CLIENT_TYPE} -a '' --eval "${ELISP}"
+exec ${EMACSCLIENT} ${NO_WINDOW} ${CREATE_FRAME} -a '' --eval "${ELISP}"
 else
-exec ${EMACS} --eval "${ELISP}"
+exec ${EMACS} ${NO_WINDOW} --eval "${ELISP}"
 fi
-- 
2.1.4



[PATCH v4 1/5] man: clean up notmuch-emacs-mua man page

2015-08-15 Thread Jani Nikula
Move --client description to a more suitable location, stylistic
changes.
---
 doc/man1/notmuch-emacs-mua.rst | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/doc/man1/notmuch-emacs-mua.rst b/doc/man1/notmuch-emacs-mua.rst
index 36b51cdc3b18..7c2f5c24f1c0 100644
--- a/doc/man1/notmuch-emacs-mua.rst
+++ b/doc/man1/notmuch-emacs-mua.rst
@@ -18,10 +18,6 @@ Supported options for **notmuch-emacs-mua** include
 ``-h, --help``
 Display help.

-``--client``
-Use emacsclient, rather than emacs. This will start
-an emacs daemon process if necessary.
-
 ``-s, --subject=``\ 
 Specify the subject of the message.

@@ -38,7 +34,11 @@ Supported options for **notmuch-emacs-mua** include
 Specify a file to include into the body of the message.

 ``--no-window-system``
-Even if a window system is available, use the current terminal
+Even if a window system is available, use the current terminal.
+
+``--client``
+Use **emacsclient**, rather than **emacs**. This will start
+an Emacs daemon process if necessary.

 ``--print``
 Output the resulting elisp to stdout instead of evaluating it.
-- 
2.1.4



[PATCH v4 0/5] notmuch-emacs-mua updates

2015-08-15 Thread Jani Nikula
The main goal is to not force --create-frame on users who dislike
it. Split to some hopefully less controversial prep patches.

BR,
Jani.


Jani Nikula (5):
  man: clean up notmuch-emacs-mua man page
  notmuch-emacs-mua: support --no-window-system also for non-client
  notmuch-emacs-mua: move --client option handling around
  notmuch-emacs-mua: add --auto-daemon option to start Emacs daemon as
needed
  notmuch-emacs-mua: do not create a frame by default with --client

 doc/man1/notmuch-emacs-mua.rst | 21 -
 notmuch-emacs-mua  | 30 +-
 2 files changed, 37 insertions(+), 14 deletions(-)

-- 
2.1.4



revision tracking patches round 4

2015-08-15 Thread Tomi Ollila
On Fri, Aug 14 2015, David Bremner  wrote:

> This obsoletes
>
>  id:1439112285-6681-1-git-send-email-david at tethera.net
>
> The main differences since that series are in the command line syntax
> for notmuch-count.
>
> We also now consider passing --uuid to notmuch-compact an error, since
> the user might reasonably expect that to do something sensible, but we
> don't because of the existing API.

Series LGTM. Tests pass.

Looked a bit to xapian documentation... it seems in case of compacting
one should do the following:

1) see that current database uuid is the one expected (which is stored
somewhere) 
2) compact database
3) read new uuid and store it to "somewhere"

Tomi


[PATCH 3/5] cli/count: add --lastmod

2015-08-15 Thread Daniel Schoepe
On Fri, 14 Aug 2015 18:47 +0200, David Bremner wrote:
> +``--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.

Sorry to keep harping on this, but I'm not entirely happy with the way
we handle notmuch-compact here (and in the other commit that mentions
compacting explicitly). Given that lastmod values (and pretty much
everything else) aren't affected by compacting, would it perhaps make
sense to copy the previous UUID to the newly compacted database?

Given that a compacted database is "indistinguishable" from the previous
non-compacted database, we may want to signal that it's still the "same
database". Is there a case where compacting actually makes a difference
to anything making use of lastmod values?

Best regards,
Daniel


Announcing Astroid v0.4

2015-08-15 Thread Gaute Hope
Greetings,

Astroid (https://github.com/gauteh/astroid) v0.4 is now ready!

  Astroid is a graphical threads-with-tags mail user agent for notmuch.
  Written in C++ using GTK+, WebKit and gmime.

Astroid can be found at: https://github.com/gauteh/astroid :

 $ git clone https://github.com/gauteh/astroid.git


## README with screenshot and information on building and using

https://github.com/gauteh/astroid#astroid-mua

  once you get Astroid running press '?' to get a list of keybindings
  for the current context.

## Changes since v0.3

* Mark threads with 't' or 'T' and apply actions to all marked threads
  with '+'.
* Mark messages with 't' or 'T' in thread-view and apply actions to all
  marked messages with '+' (nice for patch saving).
* Show attached icon in thread-view.
* #18: Fix display of  and friends.
* Configurable quote string for replying and forwarding.
* Replying adds 'replied' tag to original.
* Forwarding adds 'passed' tag to original.
* Message is updated thread-index after being sent.
* Show spinner in main window when polling.
* Show status icon for message sending.
* Indent messages according to reply-level in thread (configurable).

Regards, Gaute



[PATCH] emacs: tree bugfix

2015-08-15 Thread Mark Walters
Formerly replying to an encrypted message in tree-view did not
work. This is a first attempt to make it work.
---

notmuch-mua-reply decides whether to process crypto based on the
buffer-local variable notmuch-show-process-crypto. This sets to its
default value (which is notmuch-crypto-process-mime) in tree-mode
buffers.

As I do not have any crypto setup please can someone test? You will
need to set notmuch-crypto-process-mime to t first: I have no idea if
that is a bad thing to do! Any comments on whether it is a bad thing
would be very useful as (assuming this bascically fixes the problem)
the easy actual fix is to do this and let the user toggle
process-crypto for the whole tree buffer.

Best wishes

Mark


emacs/notmuch-tree.el | 5 +
 1 file changed, 5 insertions(+)

diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
index 182235e..5695b68 100644
--- a/emacs/notmuch-tree.el
+++ b/emacs/notmuch-tree.el
@@ -867,6 +867,11 @@ (defun notmuch-tree-worker (basic-query  
query-context target open-targ
   (setq notmuch-tree-query-context query-context)
   (setq notmuch-tree-target-msg target)
   (setq notmuch-tree-open-target open-target)
+  ;; Set the default value for `notmuch-show-process-crypto' in this
+  ;; buffer. Although we don't use this some of the functions we call
+  ;; (such as reply) do. It is a buffer local variable so setting it
+  ;; will not affect genuine show buffers.
+  (setq notmuch-show-process-crypto notmuch-crypto-process-mime)

   (erase-buffer)
   (goto-char (point-min))
-- 
2.1.4



[PATCH] emacs: tree bugfix

2015-08-15 Thread Mark Walters
Formerly replying to an encrypted message in tree-view did not
work. This is a first attempt to make it work.
---

notmuch-mua-reply decides whether to process crypto based on the
buffer-local variable notmuch-show-process-crypto. This sets to its
default value (which is notmuch-crypto-process-mime) in tree-mode
buffers.

As I do not have any crypto setup please can someone test? You will
need to set notmuch-crypto-process-mime to t first: I have no idea if
that is a bad thing to do! Any comments on whether it is a bad thing
would be very useful as (assuming this bascically fixes the problem)
the easy actual fix is to do this and let the user toggle
process-crypto for the whole tree buffer.

Best wishes

Mark


emacs/notmuch-tree.el | 5 +
 1 file changed, 5 insertions(+)

diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
index 182235e..5695b68 100644
--- a/emacs/notmuch-tree.el
+++ b/emacs/notmuch-tree.el
@@ -867,6 +867,11 @@ (defun notmuch-tree-worker (basic-query optional 
query-context target open-targ
   (setq notmuch-tree-query-context query-context)
   (setq notmuch-tree-target-msg target)
   (setq notmuch-tree-open-target open-target)
+  ;; Set the default value for `notmuch-show-process-crypto' in this
+  ;; buffer. Although we don't use this some of the functions we call
+  ;; (such as reply) do. It is a buffer local variable so setting it
+  ;; will not affect genuine show buffers.
+  (setq notmuch-show-process-crypto notmuch-crypto-process-mime)
 
   (erase-buffer)
   (goto-char (point-min))
-- 
2.1.4

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


Re: [PATCH 3/5] cli/count: add --lastmod

2015-08-15 Thread Daniel Schoepe
On Fri, 14 Aug 2015 18:47 +0200, David Bremner wrote:
 +``--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.

Sorry to keep harping on this, but I'm not entirely happy with the way
we handle notmuch-compact here (and in the other commit that mentions
compacting explicitly). Given that lastmod values (and pretty much
everything else) aren't affected by compacting, would it perhaps make
sense to copy the previous UUID to the newly compacted database?

Given that a compacted database is indistinguishable from the previous
non-compacted database, we may want to signal that it's still the same
database. Is there a case where compacting actually makes a difference
to anything making use of lastmod values?

Best regards,
Daniel
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH v4 4/5] notmuch-emacs-mua: add --auto-daemon option to start Emacs daemon as needed

2015-08-15 Thread Jani Nikula
Automatically starting Emacs in daemon mode if the Emacs server is not
running is a matter of preference better not hard coded in
notmuch-emacs-mua. Add an option to control the behaviour.
---
 doc/man1/notmuch-emacs-mua.rst | 9 +++--
 notmuch-emacs-mua  | 8 ++--
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/doc/man1/notmuch-emacs-mua.rst b/doc/man1/notmuch-emacs-mua.rst
index 7c2f5c24f1c0..89a2fead17b1 100644
--- a/doc/man1/notmuch-emacs-mua.rst
+++ b/doc/man1/notmuch-emacs-mua.rst
@@ -37,8 +37,13 @@ Supported options for **notmuch-emacs-mua** include
 Even if a window system is available, use the current terminal.
 
 ``--client``
-Use **emacsclient**, rather than **emacs**. This will start
-an Emacs daemon process if necessary.
+Use **emacsclient**, rather than **emacs**. For
+**emacsclient** to work, you need an already running Emacs
+with a server, or use ``--auto-daemon``.
+
+``--auto-daemon``
+Automatically start Emacs in daemon mode, if the Emacs server
+is not running. Applicable with ``--client``.
 
 ``--print``
 Output the resulting elisp to stdout instead of evaluating it.
diff --git a/notmuch-emacs-mua b/notmuch-emacs-mua
index 1f088c42feb9..ac03a4a60d56 100755
--- a/notmuch-emacs-mua
+++ b/notmuch-emacs-mua
@@ -36,6 +36,7 @@ EMACSCLIENT=${EMACSCLIENT-emacsclient}
 PRINT_ONLY=
 NO_WINDOW=
 USE_EMACSCLIENT=
+AUTO_DAEMON=
 CREATE_FRAME=-c
 
 # The crux of it all: construct an elisp progn and eval it.
@@ -64,7 +65,7 @@ while getopts :s:c:b:i:h opt; do
opt=${opt%%=*}
;;
# Long options without arguments.
-   --help|--print|--no-window-system|--client)
+   --help|--print|--no-window-system|--client|--auto-daemon)
;;
*)
echo $0: unknown long option ${opt}, or argument 
mismatch. 2
@@ -107,6 +108,9 @@ while getopts :s:c:b:i:h opt; do
--client)
USE_EMACSCLIENT=yes
;;
+   --auto-daemon)
+   AUTO_DAEMON=--alternate-editor=
+   ;;
*)
# We should never end up here.
echo $0: internal error (option ${opt}). 2
@@ -134,7 +138,7 @@ fi
 
 if [ -n $USE_EMACSCLIENT ]; then
 # Evaluate the progn.
-exec ${EMACSCLIENT} ${NO_WINDOW} ${CREATE_FRAME} -a '' --eval ${ELISP}
+exec ${EMACSCLIENT} ${NO_WINDOW} ${CREATE_FRAME} ${AUTO_DAEMON} --eval 
${ELISP}
 else
 exec ${EMACS} ${NO_WINDOW} --eval ${ELISP}
 fi
-- 
2.1.4

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


[PATCH v4 5/5] notmuch-emacs-mua: do not create a frame by default with --client

2015-08-15 Thread Jani Nikula
Make the default behaviour for --client the same as emacsclient
default: do not create a new frame. Add a new option --create-frame,
passing the same option to emacsclient to create a frame.

---

v2: fix killing frame with --create-frame

v3: fix --create-frame w/o --client parameter check

v4: fix kill terminal logic, document behaviour with daemon mode
---
 doc/man1/notmuch-emacs-mua.rst |  6 ++
 notmuch-emacs-mua  | 14 ++
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/doc/man1/notmuch-emacs-mua.rst b/doc/man1/notmuch-emacs-mua.rst
index 89a2fead17b1..c3689eb82c8a 100644
--- a/doc/man1/notmuch-emacs-mua.rst
+++ b/doc/man1/notmuch-emacs-mua.rst
@@ -45,6 +45,12 @@ Supported options for **notmuch-emacs-mua** include
 Automatically start Emacs in daemon mode, if the Emacs server
 is not running. Applicable with ``--client``.
 
+``--create-frame``
+Create a new frame instead of trying to use the current Emacs
+frame. Applicable with ``--client``. This will be required
+when Emacs is running (or automatically started with
+``--auto-daemon``) in daemon mode.
+
 ``--print``
 Output the resulting elisp to stdout instead of evaluating it.
 
diff --git a/notmuch-emacs-mua b/notmuch-emacs-mua
index ac03a4a60d56..b51d8d0e2c5b 100755
--- a/notmuch-emacs-mua
+++ b/notmuch-emacs-mua
@@ -37,11 +37,10 @@ PRINT_ONLY=
 NO_WINDOW=
 USE_EMACSCLIENT=
 AUTO_DAEMON=
-CREATE_FRAME=-c
+CREATE_FRAME=
 
 # The crux of it all: construct an elisp progn and eval it.
 ELISP=(prog1 'done (require 'notmuch) (notmuch-mua-new-mail)
-ELISP=${ELISP} (setq message-exit-actions (list 
#'save-buffers-kill-terminal))
 
 # Short options compatible with mutt(1).
 while getopts :s:c:b:i:h opt; do
@@ -65,7 +64,7 @@ while getopts :s:c:b:i:h opt; do
opt=${opt%%=*}
;;
# Long options without arguments.
-   --help|--print|--no-window-system|--client|--auto-daemon)
+   
--help|--print|--no-window-system|--client|--auto-daemon|--create-frame)
;;
*)
echo $0: unknown long option ${opt}, or argument 
mismatch. 2
@@ -103,7 +102,6 @@ while getopts :s:c:b:i:h opt; do
;;
--no-window-system)
NO_WINDOW=-nw
-   CREATE_FRAME=
;;
--client)
USE_EMACSCLIENT=yes
@@ -111,6 +109,9 @@ while getopts :s:c:b:i:h opt; do
--auto-daemon)
AUTO_DAEMON=--alternate-editor=
;;
+   --create-frame)
+   CREATE_FRAME=-c
+   ;;
*)
# We should never end up here.
echo $0: internal error (option ${opt}). 2
@@ -128,6 +129,11 @@ for arg; do
 ELISP=${ELISP} (message-goto-to) (insert \${arg}, \)
 done
 
+# Kill the terminal/frame if we're creating one.
+if [ -z $USE_EMACSCLIENT -o -n $CREATE_FRAME -o -n $NO_WINDOW ]; then
+ELISP=${ELISP} (setq message-exit-actions (list 
#'save-buffers-kill-terminal))
+fi
+
 # End progn.
 ELISP=${ELISP})
 
-- 
2.1.4

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


[PATCH v4 3/5] notmuch-emacs-mua: move --client option handling around

2015-08-15 Thread Jani Nikula
Move --client handling to a more suitable location. No functional
changes.
---
 notmuch-emacs-mua | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/notmuch-emacs-mua b/notmuch-emacs-mua
index e33aa955d6b5..1f088c42feb9 100755
--- a/notmuch-emacs-mua
+++ b/notmuch-emacs-mua
@@ -82,9 +82,6 @@ while getopts :s:c:b:i:h opt; do
--help|h)
exec man notmuch-emacs-mua
;;
-   --client)
-   USE_EMACSCLIENT=yes
-   ;;
--subject|s)
ELISP=${ELISP} (message-goto-subject) (insert \${OPTARG}\)
;;
@@ -107,6 +104,9 @@ while getopts :s:c:b:i:h opt; do
NO_WINDOW=-nw
CREATE_FRAME=
;;
+   --client)
+   USE_EMACSCLIENT=yes
+   ;;
*)
# We should never end up here.
echo $0: internal error (option ${opt}). 2
-- 
2.1.4

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


[PATCH v4 1/5] man: clean up notmuch-emacs-mua man page

2015-08-15 Thread Jani Nikula
Move --client description to a more suitable location, stylistic
changes.
---
 doc/man1/notmuch-emacs-mua.rst | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/doc/man1/notmuch-emacs-mua.rst b/doc/man1/notmuch-emacs-mua.rst
index 36b51cdc3b18..7c2f5c24f1c0 100644
--- a/doc/man1/notmuch-emacs-mua.rst
+++ b/doc/man1/notmuch-emacs-mua.rst
@@ -18,10 +18,6 @@ Supported options for **notmuch-emacs-mua** include
 ``-h, --help``
 Display help.
 
-``--client``
-Use emacsclient, rather than emacs. This will start
-an emacs daemon process if necessary.
-
 ``-s, --subject=``\ subject
 Specify the subject of the message.
 
@@ -38,7 +34,11 @@ Supported options for **notmuch-emacs-mua** include
 Specify a file to include into the body of the message.
 
 ``--no-window-system``
-Even if a window system is available, use the current terminal
+Even if a window system is available, use the current terminal.
+
+``--client``
+Use **emacsclient**, rather than **emacs**. This will start
+an Emacs daemon process if necessary.
 
 ``--print``
 Output the resulting elisp to stdout instead of evaluating it.
-- 
2.1.4

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


[PATCH v4 2/5] notmuch-emacs-mua: support --no-window-system also for non-client

2015-08-15 Thread Jani Nikula
Clearly --no-window-system should be applicable without --client as
well. Prepare for future changes with the naming of the variables.
---
 notmuch-emacs-mua | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/notmuch-emacs-mua b/notmuch-emacs-mua
index 79714305b3e2..e33aa955d6b5 100755
--- a/notmuch-emacs-mua
+++ b/notmuch-emacs-mua
@@ -34,8 +34,9 @@ EMACS=${EMACS-emacs}
 EMACSCLIENT=${EMACSCLIENT-emacsclient}
 
 PRINT_ONLY=
+NO_WINDOW=
 USE_EMACSCLIENT=
-CLIENT_TYPE=-c
+CREATE_FRAME=-c
 
 # The crux of it all: construct an elisp progn and eval it.
 ELISP=(prog1 'done (require 'notmuch) (notmuch-mua-new-mail)
@@ -103,7 +104,8 @@ while getopts :s:c:b:i:h opt; do
PRINT_ONLY=1
;;
--no-window-system)
-   CLIENT_TYPE=-t
+   NO_WINDOW=-nw
+   CREATE_FRAME=
;;
*)
# We should never end up here.
@@ -132,7 +134,7 @@ fi
 
 if [ -n $USE_EMACSCLIENT ]; then
 # Evaluate the progn.
-exec ${EMACSCLIENT} ${CLIENT_TYPE} -a '' --eval ${ELISP}
+exec ${EMACSCLIENT} ${NO_WINDOW} ${CREATE_FRAME} -a '' --eval ${ELISP}
 else
-exec ${EMACS} --eval ${ELISP}
+exec ${EMACS} ${NO_WINDOW} --eval ${ELISP}
 fi
-- 
2.1.4

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


Announcing Astroid v0.4

2015-08-15 Thread Gaute Hope

Greetings,

Astroid (https://github.com/gauteh/astroid) v0.4 is now ready!

 Astroid is a graphical threads-with-tags mail user agent for notmuch.
 Written in C++ using GTK+, WebKit and gmime.

Astroid can be found at: https://github.com/gauteh/astroid :

$ git clone https://github.com/gauteh/astroid.git


## README with screenshot and information on building and using

   https://github.com/gauteh/astroid#astroid-mua

 once you get Astroid running press '?' to get a list of keybindings
 for the current context.

## Changes since v0.3

* Mark threads with 't' or 'T' and apply actions to all marked threads
 with '+'.
* Mark messages with 't' or 'T' in thread-view and apply actions to all
 marked messages with '+' (nice for patch saving).
* Show attached icon in thread-view.
* #18: Fix display of amp; and friends.
* Configurable quote string for replying and forwarding.
* Replying adds 'replied' tag to original.
* Forwarding adds 'passed' tag to original.
* Message is updated thread-index after being sent.
* Show spinner in main window when polling.
* Show status icon for message sending.
* Indent messages according to reply-level in thread (configurable).

Regards, Gaute

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


[PATCH v4 0/5] notmuch-emacs-mua updates

2015-08-15 Thread Jani Nikula
The main goal is to not force --create-frame on users who dislike
it. Split to some hopefully less controversial prep patches.

BR,
Jani.


Jani Nikula (5):
  man: clean up notmuch-emacs-mua man page
  notmuch-emacs-mua: support --no-window-system also for non-client
  notmuch-emacs-mua: move --client option handling around
  notmuch-emacs-mua: add --auto-daemon option to start Emacs daemon as
needed
  notmuch-emacs-mua: do not create a frame by default with --client

 doc/man1/notmuch-emacs-mua.rst | 21 -
 notmuch-emacs-mua  | 30 +-
 2 files changed, 37 insertions(+), 14 deletions(-)

-- 
2.1.4

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


Re: revision tracking patches round 4

2015-08-15 Thread Tomi Ollila
On Fri, Aug 14 2015, David Bremner da...@tethera.net wrote:

 This obsoletes

  id:1439112285-6681-1-git-send-email-da...@tethera.net

 The main differences since that series are in the command line syntax
 for notmuch-count.

 We also now consider passing --uuid to notmuch-compact an error, since
 the user might reasonably expect that to do something sensible, but we
 don't because of the existing API.

Series LGTM. Tests pass.

Looked a bit to xapian documentation... it seems in case of compacting
one should do the following:

1) see that current database uuid is the one expected (which is stored
somewhere) 
2) compact database
3) read new uuid and store it to somewhere

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


Re: [PATCH 3/5] cli/count: add --lastmod

2015-08-15 Thread David Bremner
Daniel Schoepe dan...@schoepe.org writes:

 Sorry to keep harping on this, but I'm not entirely happy with the way
 we handle notmuch-compact here (and in the other commit that mentions
 compacting explicitly). Given that lastmod values (and pretty much
 everything else) aren't affected by compacting, would it perhaps make
 sense to copy the previous UUID to the newly compacted database?

We aren't currently maintaining a UUID for notmuch, but using
Xapian::database::get_uuid(). There is no way in Xapian to change the
UUID; even if there was, lying to Xapian probably would not be a good
idea.

We could maintain our own UUID, but I'm not sure it's worth the extra
code just to make compaction slightly nicer. 

For me compaction is a rare event, so having to take the fallback path
and do a full dump or whatever doesn't seem so bad. If you don't want to
have a fallback path, then I guess you need to guarantee externally that
no bad changes happen and either ignore the uuid's or copy them
forward in your external tool.

Mainly though I think this will be fixed in Xapian. As it happens Xapian
developer Olly Betts is here at DebConf, and I discussed this problem
with him. According to Olly, in-progress / future versions of compact
will function in place, and guarantee the UUID is preserved. I'm not
sure of the timeline here, but given our scarce developer resources, I
think I'd rather wait for Olly to fix this.

On the bright side, if in the future we decide that notmuch should have
it's own notion of UUID, then this would would not change the library
API or command line interface.  There is some argument here for giving
our name to the UUID, but revision turned out to be a terribly
confusing choice in previous rounds of patches.  The current transparent
naming has the advantage of matching the output.

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


[PATCH] lib: add support for date:expr..! to mean date:expr..expr

2015-08-15 Thread Jani Nikula
It doesn't seem likely we can support simple date:expr expanding to
date:expr..expr any time soon. (This can be done with a future
version of Xapian, or with a custom query query parser.) In the mean
time, provide shorthand date:expr..! to mean the same. This is
useful, as the expansion takes place before interpetation, and we can
use, for example, date:yesterday..! to match from beginning of
yesterday to end of yesterday.

Idea from Mark Walters markwalters1...@gmail.com.
---
 doc/man7/notmuch-search-terms.rst | 12 +++-
 lib/parse-time-vrp.cc |  5 +
 test/T500-search-date.sh  |  4 
 3 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/doc/man7/notmuch-search-terms.rst 
b/doc/man7/notmuch-search-terms.rst
index 1d27ac1e6de5..3b35a32b7d23 100644
--- a/doc/man7/notmuch-search-terms.rst
+++ b/doc/man7/notmuch-search-terms.rst
@@ -270,6 +270,13 @@ In this case, since is taken as the earliest time it 
could describe
 could describe (the end of yesterday). Similarly, date:january..february
 matches from the beginning of January to the end of February.
 
+date:expr..! can be used as a shorthand for date:expr..expr. The
+expansion takes place before interpretation, and thus, for example,
+date:monday..! matches from the beginning of Monday until the end of
+Monday. (Note that entering date:expr without .., for example
+date:yesterday, won't work, as it's not interpreted as a range
+expression at all. Again, use date:yesterday..!)
+
 Currently, we do not support spaces in range expressions. You can
 replace the spaces with '\_', or (in most cases) '-', or (in some cases)
 leave the spaces out altogether. Examples in this man page use spaces
@@ -280,11 +287,6 @@ to specify date:..until or date:since.. to not limit 
the start or
 end time, respectively. Pre-1.2.1 Xapian does not report an error on
 open ended ranges, but it does not work as expected either.
 
-Entering date:expr without .. (for example date:yesterday) won't work,
-as it's not interpreted as a range expression at all. You can achieve
-the expected result by duplicating the expr both sides of .. (for
-example date:yesterday..yesterday).
-
 Relative date and time
 --
 
diff --git a/lib/parse-time-vrp.cc b/lib/parse-time-vrp.cc
index 33f07db3410e..03804cf50fa8 100644
--- a/lib/parse-time-vrp.cc
+++ b/lib/parse-time-vrp.cc
@@ -31,6 +31,7 @@ Xapian::valueno
 ParseTimeValueRangeProcessor::operator() (std::string begin, std::string end)
 {
 time_t t, now;
+std::string b;
 
 /* Require date: prefix in start of the range... */
 if (STRNCMP_LITERAL (begin.c_str (), PREFIX))
@@ -38,6 +39,7 @@ ParseTimeValueRangeProcessor::operator() (std::string begin, 
std::string end)
 
 /* ...and remove it. */
 begin.erase (0, sizeof (PREFIX) - 1);
+b = begin;
 
 /* Use the same 'now' for begin and end. */
 if (time (now) == (time_t) -1)
@@ -51,6 +53,9 @@ ParseTimeValueRangeProcessor::operator() (std::string begin, 
std::string end)
 }
 
 if (!end.empty ()) {
+   if (end == !  ! b.empty ())
+   end = b;
+
if (parse_time_string (end.c_str (), t, now, 
PARSE_TIME_ROUND_UP_INCLUSIVE))
return Xapian::BAD_VALUENO;
 
diff --git a/test/T500-search-date.sh b/test/T500-search-date.sh
index b28496b78e2e..f5cea421d785 100755
--- a/test/T500-search-date.sh
+++ b/test/T500-search-date.sh
@@ -8,6 +8,10 @@ test_begin_subtest Absolute date range
 output=$(notmuch search date:2010-12-16..12/16/2010 | notmuch_search_sanitize)
 test_expect_equal $output thread:XXX   2010-12-16 [1/1] Olivier Berger; 
Essai accentué (inbox unread)
 
+test_begin_subtest Absolute date range with 'same' operator
+output=$(notmuch search date:2010-12-16..! | notmuch_search_sanitize)
+test_expect_equal $output thread:XXX   2010-12-16 [1/1] Olivier Berger; 
Essai accentué (inbox unread)
+
 test_begin_subtest Absolute time range with TZ
 notmuch search date:18-Nov-2009_02:19:26-0800..2009-11-18_04:49:52-06:00 | 
notmuch_search_sanitize  OUTPUT
 cat EOF EXPECTED
-- 
2.1.4

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


Re: revision tracking patches round 4

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


 Looked a bit to xapian documentation... it seems in case of compacting
 one should do the following:

 1) see that current database uuid is the one expected (which is stored
 somewhere) 
 2) compact database
 3) read new uuid and store it to somewhere

right, I think this is basically right. It falls under the same general
lazy objections in id:87si7kx27c@maritornes.cs.unb.ca; I think
compact changing uuid is a short term problem.

d


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