Re: Thanks for the nmbug-status program

2014-04-22 Thread Carl Worth
"W. Trevor King"  writes:
>> > I think that making nmbug and nmbug-status generally applicable for
>> > other projects is a good target.  I don't see any need to pull them
>> > out into a stand-alone project to do that though.
>> 
>> For what it's worth, I don't disagree.
>
> Does that mean your patches are aimed upstream at the notmuch
> repository?

I didn't really intend them that way. What I meant was that I'd be happy
to switch to a script within the notmuch repository if it did what I
wanted, (which is basically just "create an HTML file from a notmuch
query").

> (or their shell's approriate environment variable syntax), and I'd
> version the config file in the same repo as the associated tags.  I
> don't see the point of keeping the config file somewhere else, when
> you'll already need a repository to store the tags.

Ah, then you've missed something different about my usage. I don't have
any repository storing tags. My tags exist only in my notmuch
database. The tool I want here is a simpler one, (think, "allow HTML
export from HTML"). Heck, what I want could almost be nothing more than:

notmuch search --format=html

Other than that I want the other bits like multiple defined "views" with
their own queries and descriptions.

I see the part that has a repository holding tags as totally orthogonal
functionality. That orthogonal functionality is "tag synchronization" or
"tag collaboration" and is independent from HTML export to my way of
thinking.

So it makes sense to me that the HTML export just talks to the notmuch
database and doesn't need to assume anything else.

> * d456390 Add a comment describing the program
>
> I like the idea, but I'd prefer a docstring just after the leading
> comment.  Then we could reuse the docstring as the description for the
> ArgumentParser.

Sure. That's better.

> * 336411f Add "notmuch search" to the advertised queries.
>
> Folks can already copy-paste the terms into Emacs etc.  You only need
> the 'notmuch search' prefix if you're pasting into a shell, in which
> case you'll also want to escape shell-sensitive characters like
> parenthesis.  I'm fine without this one.

This is more about advertising notmuch to people not familiar with
it. It's more important for something like "mesa stable queue" than it
is for the notmuch bug list, of course.

> * 396869c Add support for a --query option (along with a default 
> configuration)
>
> I don't have an opinion about this one ;).  The default config doesn't
> look very useful (especially with it's dummy metadata settings), but
> I'd only be using the in-Git-config approach, and I don't mind if
> others want something like this.

This is about making this script self-documenting.

When I first tried nmbug-status I got just a stack trace[*], not even a
usage message. Even after running "nmbug-status --help" I wasn't any
closer to knowing how to run the thing. It wasn't obvious that --config
was the option I needed to get things to work, (from the stack trace,
clearly this script wants some git repository somewhere), and even if I
had know that --config was what I wanted, I had no idea how to construct
a config file.

I tried the documentation for nmbug which had a "git clone" command in
it, but even then I couldn't get nmbug-status to work, (I tried to
replicate this bug just now, but couldn't---it does seem to be working
after the documented "git clone"). But even then, all I had was a bare
repository and no clear indication that I needed a config file nor where
to find it.

By the time I had read the code and understood it well enough to know
where to find the config file, I also knew enough to fix the script to
be self-documenting as far as configuration. So that's what I did.

If you run "notmuch-to-html" with no arguments it will naturally walk
you through everything you need. It will give you functional sample
output before you've even constructed a configuration file. And then it
will give you the exact syntax for that example configuration file.

I can't see how these changes could be anything other than an
improvement.

-Carl

[*] Here it is, for reference:

(master)$ ./nmbug-status 
fatal: Not a git repository: '/home/cworth/.nmbug'
fatal: Not a git repository: '/home/cworth/.nmbug'
Traceback (most recent call last):
  File "./nmbug-status", line 254, in 
config = read_config(path=args.config)
  File "./nmbug-status", line 73, in read_config
return json.load(fp)
  File "/usr/lib/python2.7/json/__init__.py", line 290, in load
**kw)
  File "/usr/lib/python2.7/json/__init__.py", line 338, in loads
return _default_decoder.decode(s)
  File "/usr/lib/python2.7/json/decoder.py", line 366, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python2.7/json/decoder.py", line 384, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded



pgpPcVgTDlY6t.pgp
Description: PGP signature
___

[PATCH v2] test: Test thread linking in all possible delivery orders

2014-04-22 Thread Mark Walters

Hi

Broadly this looks good but I am somewhat confused by the python
part. Is it intended to produce the same tree multiple times? It does
seem to produce all the possible trees (*) so it doesn't matter but
might be worth a comment.

Best wishes

Mark

(*) I think there should be 64 rooted trees (16 trees and 4 possible
roots) and the python generates 144 lines. Piping the output to sort and
uniq gives 64 lines.



On Mon, 21 Apr 2014, Austin Clements  wrote:
> These tests deliver all possible (single-root) four-message threads in
> all possible orders and check that notmuch successfully links them
> into threads.
>
> There are two variants of the test: one delivers messages that
> reference only their immediate parent and the other delivers messages
> that reference all of their parents.  The latter test is currently
> known-broken.
>
> This is introduced as a new test (rather than just adding it to
> T050-new) because it's much easier for this to start with an empty
> database.
> ---
>
> This version hopefully addresses David's comments in
> id:87y4zhfmrn.fsf at maritornes.cs.unb.ca and adds a second test that
> demonstrates the bug Mark in figured out in
> id:8738h7kv2q.fsf at qmul.ac.uk.
>
> test/T051-new-linking.sh | 91 
>  1 file changed, 91 insertions(+)
>  create mode 100755 test/T051-new-linking.sh
>
> diff --git a/test/T051-new-linking.sh b/test/T051-new-linking.sh
> new file mode 100755
> index 000..9ccbc52
> --- /dev/null
> +++ b/test/T051-new-linking.sh
> @@ -0,0 +1,91 @@
> +#!/usr/bin/env bash
> +test_description='"notmuch new" thread linking'
> +
> +. ./test-lib.sh
> +
> +# Generate all possible single-root four message thread structures.
> +# Each line in THREADS is a thread structure, where the n'th field is
> +# the parent of message n.  We'll use this for multiple tests below.
> +THREADS=$(python -c '
> +def mkTrees(free, tree={}):
> +if free == set():
> +print(" ".join(map(str, [msg[1] for msg in sorted(tree.items())])))
> +return
> +# Attach each free message to each message in the tree (if there is
> +# no tree, make the free message the root), backtracking after each
> +for msg in sorted(free):
> +parents = sorted(tree.keys()) if tree else ["none"]
> +for parent in parents:
> +ntree = tree.copy()
> +ntree[msg] = parent
> +mkTrees(free - set([msg]), ntree)
> +mkTrees(set(range(4)))')
> +nthreads=$(wc -l <<< "$THREADS")
> +
> +test_begin_subtest "All four-message threads get linked in all delivery 
> orders (one parent)"
> +# In the first variant, this delivers messages that reference only
> +# their immediate parent.  Hence, we should only expect threads to be
> +# fully joined at the end.
> +for ((n = 0; n < 4; n++)); do
> +# Deliver the n'th message of every thread
> +thread=0
> +while read -a parents; do
> +parent=${parents[$n]}
> +generate_message \
> +[id]=m$n at t$thread [in-reply-to]="\" \
> +[subject]=p$thread [from]=m$n
> +thread=$((thread + 1))
> +done <<< "$THREADS"
> +notmuch new > /dev/null
> +done
> +output=$(notmuch search --sort=newest-first '*' | notmuch_search_sanitize)
> +expected=$(for ((i = 0; i < $nthreads; i++)); do
> +echo "thread:XXX   2001-01-05 [4/4] m3, m2, m1, m0; p$i (inbox 
> unread)"
> +done)
> +test_expect_equal "$output" "$expected"
> +
> +test_begin_subtest "The same (full parent linkage)"
> +test_subtest_known_broken
> +# Here we do the same thing as the previous test, but each message
> +# references all of its parents.  Since every message references the
> +# root of the thread, each thread should always be fully joined.  This
> +# is currently broken because of the bug detailed in
> +# id:8738h7kv2q.fsf at qmul.ac.uk.
> +rm ${MAIL_DIR}/*
> +notmuch new
> +output=""
> +expected=""
> +for ((n = 0; n < 4; n++)); do
> +# Deliver the n'th message of every thread
> +thread=0
> +while read -a parents; do
> +references=""
> +parent=${parents[$n]}
> +while [[ $parent != none ]]; do
> +references=" $references"
> +parent=${parents[$parent]}
> +done
> +
> +generate_message \
> +[id]=m$n at t$thread [references]="'$references'" \
> +[subject]=p$thread [from]=m$n
> +thread=$((thread + 1))
> +done <<< "$THREADS"
> +notmuch new > /dev/null
> +
> +output="$output
> +$(notmuch search --sort=newest-first '*' | notmuch_search_sanitize)"
> +
> +# Construct expected output
> +template="thread:XXX   2001-01-05 [$((n+1))/$((n+1))]"
> +for ((m = n; m > 0; m--)); do
> +template="$template m$m,"
> +done
> +expected="$expected
> +$(for ((i = 0; i < $nthreads; i++)); do
> +echo "$template m0; p$i (inbox unread)"
> +done)"
> +done
> +test_expect_equal "$output" "$expected"
> +
> +test_done
> -- 
> 1.9.1


[PATCH 1/1] building from git: use --abbrev=7 for version string

2014-04-22 Thread Mark Walters

LGTM +1

MW

On Tue, 22 Apr 2014, Tomi Ollila  wrote:
> Users may have set core.abbrev=n, where n != 7 in their git config
> file(s) which would give them different than expected version strings
> when building notmuch from git. This fixes the commit hash part of
> version string to 7 hexadecimal values.
> ---
>
> tested with:
> git config core.abbrev 12
> git describe
> rm version.stamp
> make
> cat version.stamp
> git reset --hard origin/master
> make
> cat version.stamp
>
> .local | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/Makefile.local b/Makefile.local
> index 877a979..6e78368 100644
> --- a/Makefile.local
> +++ b/Makefile.local
> @@ -21,7 +21,7 @@ endif
>  VERSION:=$(shell cat ${srcdir}/version)
>  ifeq ($(filter release release-message pre-release 
> update-versions,$(MAKECMDGOALS)),)
>  ifeq ($(IS_GIT),yes)
> -VERSION:=$(shell git describe --match '[0-9.]*'|sed -e s/_/~/ -e s/-/+/ -e 
> s/-/~/)
> +VERSION:=$(shell git describe --abbrev=7 --match '[0-9.]*'|sed -e s/_/~/ -e 
> s/-/+/ -e s/-/~/)
>  # Write the file 'version.stamp' in case its contents differ from $(VERSION)
>  FILE_VERSION:=$(shell test -f version.stamp && read vs < version.stamp || 
> vs=; echo $$vs)
>  ifneq ($(FILE_VERSION),$(VERSION))
> -- 
> 1.9.0
>
> ___
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


[WIP PATCH 4/4] emacs: search: add key binding for marking a thread

2014-04-22 Thread Mark Walters
Add a function for toggling the mark on a thread, by default bound to
",".  Also make a marked thread clearly visible: this uses inverse
video as being a bit like selecting. Perhaps actually using the same
face (mainly backgorund colour) as a selection would make sense?
---
 emacs/notmuch.el |   15 +++
 1 file changed, 15 insertions(+)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index e1ece47..4976f0a 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -179,6 +179,7 @@ (defvar notmuch-search-mode-map
 (define-key map "+" 'notmuch-search-add-tag)
 (define-key map (kbd "RET") 'notmuch-search-show-thread)
 (define-key map "Z" 'notmuch-tree-from-search-current-query)
+(define-key map "," 'notmuch-search-mark-thread)
 map)
   "Keymap for \"notmuch search\" buffers.")
 (fset 'notmuch-search-mode-map notmuch-search-mode-map)
@@ -604,6 +605,17 @@ (defun notmuch-search-archive-thread (&optional unarchive 
beg end thread-list)
  (notmuch-tag-change-list notmuch-archive-tags unarchive) beg end 
thread-list))
   (notmuch-search-next-thread))

+(defun notmuch-search-mark-thread ()
+  "Toggle the mark on the currently selected thread."
+  (interactive)
+  (let ((thread (notmuch-search-find-thread-id)))
+(if (member thread notmuch-search-marked-threads)
+   (setq notmuch-search-marked-threads
+ (delete thread notmuch-search-marked-threads))
+  (push (notmuch-search-find-thread-id) notmuch-search-marked-threads)))
+  (notmuch-search-update-result (notmuch-search-get-result))
+  (notmuch-search-next-thread))
+
 (defun notmuch-search-update-result (result &optional pos)
   "Replace the result object of the thread at POS (or point) by
 RESULT and redraw it.
@@ -806,6 +818,9 @@ (defun notmuch-search-show-result (result pos)
   (dolist (spec notmuch-search-result-format)
(notmuch-search-insert-field (car spec) (cdr spec) result))
   (insert "\n")
+  (when (member (concat "thread:" (plist-get result :thread))
+   notmuch-search-marked-threads)
+   (notmuch-apply-face nil '(:inverse-video t) nil pos (point)))
   (notmuch-search-color-line pos (point) (plist-get result :tags))
   (put-text-property pos (point) 'notmuch-search-result result

-- 
1.7.10.4



[WIP PATCH 3/4] emacs: search: split foreach-result into list and region variants

2014-04-22 Thread Mark Walters
---
 emacs/notmuch.el |   20 +++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 7b06458..e1ece47 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -380,7 +380,20 @@ (defun notmuch-search-result-end (&optional pos)
 (next-single-property-change (or pos (point)) 'notmuch-search-result
 nil (point-max

-(defun notmuch-search-foreach-result (beg end thread-list function)
+(defun notmuch-search-foreach-result-in-list (thread-list function)
+  "Invoke function for each thread in list."
+  (lexical-let ((thread-list (copy-sequence thread-list)))
+(save-excursion
+  (goto-char (point-min))
+  (while (and (notmuch-search-get-result)
+ thread-list)
+   (let ((thread (notmuch-search-find-thread-id)))
+ (when (member thread thread-list)
+   (funcall function)
+   (setq thread-list (delete thread thread-list
+   (notmuch-search-next-thread)
+
+(defun notmuch-search-foreach-result-in-region (beg end function)
   "Invoke FUNCTION for each result between BEG and END.

 FUNCTION should take no arguments.  It will be applied at the
@@ -401,6 +414,11 @@ (defun notmuch-search-foreach-result (beg end thread-list 
function)
  (funcall function)
  (notmuch-search-next-thread))

+(defun notmuch-search-foreach-result (beg end thread-list function)
+  (if thread-list
+  (notmuch-search-foreach-result-in-list thread-list function)
+(notmuch-search-foreach-result-in-region beg end function)))
+
 ;; Unindent the function argument of notmuch-search-foreach-result so
 ;; the indentation of callers doesn't get out of hand.
 (put 'notmuch-search-foreach-result 'lisp-indent-function 2)
-- 
1.7.10.4



[WIP PATCH 2/4] emacs: search: add a marked thread variable and add to relevant functions

2014-04-22 Thread Mark Walters
Add a marked thread variable containing a list of thread ids of marked
threads and make it be passed through all relevant functions. This
ends up being quite large as there are quite a few callers.

Alternatively we could overload beg rather than adding a thread-list
variable. This would make a much smaller patch but might be more
confusing.
---
 emacs/notmuch.el |   66 +++---
 1 file changed, 38 insertions(+), 28 deletions(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index cb7c006..7b06458 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -100,6 +100,11 @@ (defcustom notmuch-init-file (locate-user-emacs-file 
"notmuch-config")
 (defvar notmuch-query-history nil
   "Variable to store minibuffer history for notmuch queries")

+(defvar notmuch-search-marked-threads nil
+  "Buffer local list of marked threads")
+(make-variable-buffer-local 'notmuch-search-marked-threads)
+(put 'notmuch-search-marked-threads 'permanent-local t)
+
 (defun notmuch-foreach-mime-part (function mm-handle)
   (cond ((stringp (car mm-handle))
  (dolist (part (cdr mm-handle))
@@ -375,7 +380,7 @@ (defun notmuch-search-result-end (&optional pos)
 (next-single-property-change (or pos (point)) 'notmuch-search-result
 nil (point-max

-(defun notmuch-search-foreach-result (beg end function)
+(defun notmuch-search-foreach-result (beg end thread-list function)
   "Invoke FUNCTION for each result between BEG and END.

 FUNCTION should take no arguments.  It will be applied at the
@@ -400,9 +405,9 @@ (defun notmuch-search-foreach-result (beg end function)
 ;; the indentation of callers doesn't get out of hand.
 (put 'notmuch-search-foreach-result 'lisp-indent-function 2)

-(defun notmuch-search-properties-in-region (property beg end)
+(defun notmuch-search-properties-in-region (property beg end &optional 
thread-list)
   (let (output)
-(notmuch-search-foreach-result beg end
+(notmuch-search-foreach-result beg end thread-list
   (lambda ()
(push (plist-get (notmuch-search-get-result) property) output)))
 output))
@@ -421,13 +426,13 @@ (defun notmuch-search-find-stable-query ()
 matched and unmatched messages in the current thread."
   (plist-get (notmuch-search-get-result) :query))

-(defun notmuch-search-find-stable-query-region (beg end &optional only-matched)
+(defun notmuch-search-find-stable-query-region (beg end &optional only-matched 
thread-list)
   "Return the stable query for the current region.

 If ONLY-MATCHED is non-nil, include only matched messages.  If it
 is nil, include both matched and unmatched messages."
   (let ((query-list nil) (all (not only-matched)))
-(dolist (queries (notmuch-search-properties-in-region :query beg end))
+(dolist (queries (notmuch-search-properties-in-region :query beg end 
thread-list))
   (when (first queries)
(push (first queries) query-list))
   (when (and all (second queries))
@@ -438,17 +443,17 @@ (defun notmuch-search-find-authors ()
   "Return the authors for the current thread"
   (plist-get (notmuch-search-get-result) :authors))

-(defun notmuch-search-find-authors-region (beg end)
+(defun notmuch-search-find-authors-region (beg end &optional thread-list)
   "Return a list of authors for the current region"
-  (notmuch-search-properties-in-region :authors beg end))
+  (notmuch-search-properties-in-region :authors beg end thread-list))

 (defun notmuch-search-find-subject ()
   "Return the subject for the current thread"
   (plist-get (notmuch-search-get-result) :subject))

-(defun notmuch-search-find-subject-region (beg end)
+(defun notmuch-search-find-subject-region (beg end &optional thread-list)
   "Return a list of authors for the current region"
-  (notmuch-search-properties-in-region :subject beg end))
+  (notmuch-search-properties-in-region :subject beg end thread-list))

 (defun notmuch-search-show-thread (&optional elide-toggle)
   "Display the currently selected thread."
@@ -497,9 +502,9 @@ (defun notmuch-search-set-tags (tags &optional pos)
 (defun notmuch-search-get-tags (&optional pos)
   (plist-get (notmuch-search-get-result pos) :tags))

-(defun notmuch-search-get-tags-region (beg end)
+(defun notmuch-search-get-tags-region (beg end &optional thread-list)
   (let (output)
-(notmuch-search-foreach-result beg end
+(notmuch-search-foreach-result beg end thread-list
   (lambda ()
(setq output (append output (notmuch-search-get-tags)
 output))
@@ -507,24 +512,29 @@ (defun notmuch-search-get-tags-region (beg end)
 (defun notmuch-search-interactive-region ()
   "Return the bounds of the current interactive region.

-This returns (BEG END), where BEG and END are the bounds of the
-region if the region is active, or both `point' otherwise."
+This returns (BEG END THREAD-LIST), where BEG and END are the
+bounds of the region if the region is active, or both `point'
+otherwise and THREAD-LIST is a list of 

[WIP PATCH 1/4] emacs: search: tidy notmuch-search-foreach-result

2014-04-22 Thread Mark Walters
notmuch-search-foreach-result is cumbersome as it applies the callback
function with the position of the start of the thread as the
argument. It is more natural to move point to the start of each
relevant thread and not pass any arguments to the callback function.
---
 emacs/notmuch.el |   52 
 1 file changed, 24 insertions(+), 28 deletions(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 6c0bc1b..cb7c006 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -378,27 +378,24 @@ (defun notmuch-search-result-end (&optional pos)
 (defun notmuch-search-foreach-result (beg end function)
   "Invoke FUNCTION for each result between BEG and END.

-FUNCTION should take one argument.  It will be applied to the
-character position of the beginning of each result that overlaps
-the region between points BEG and END.  As a special case, if (=
-BEG END), FUNCTION will be applied to the result containing point
-BEG."
-
-  (lexical-let ((pos (notmuch-search-result-beginning beg))
-   ;; End must be a marker in case function changes the
-   ;; text.
-   (end (copy-marker end))
-   ;; Make sure we examine at least one result, even if
-   ;; (= beg end).
-   (first t))
-;; We have to be careful if the region extends beyond the results.
-;; In this case, pos could be null or there could be no result at
-;; pos.
-(while (and pos (or (< pos end) first))
-  (when (notmuch-search-get-result pos)
-   (funcall function pos))
-  (setq pos (notmuch-search-result-end pos)
-   first nil
+FUNCTION should take no arguments.  It will be applied at the
+beginning of each result that overlaps the region between points
+BEG and END.  As a special case, if (= BEG END), FUNCTION will be
+applied to the result containing point BEG."
+
+  (when (notmuch-search-get-result)
+(save-excursion
+  ;; End must be a marker in case function changes the text.
+  (lexical-let ((end (copy-marker end)))
+   ;; We always apply function at least once: even if (= BEG END).
+   (goto-char (notmuch-search-result-beginning beg))
+   (funcall function)
+   (notmuch-search-next-thread)
+   (while (and (notmuch-search-get-result)
+   (< (notmuch-search-result-beginning) end))
+ (funcall function)
+ (notmuch-search-next-thread))
+
 ;; Unindent the function argument of notmuch-search-foreach-result so
 ;; the indentation of callers doesn't get out of hand.
 (put 'notmuch-search-foreach-result 'lisp-indent-function 2)
@@ -406,8 +403,8 @@ (defun notmuch-search-foreach-result (beg end function)
 (defun notmuch-search-properties-in-region (property beg end)
   (let (output)
 (notmuch-search-foreach-result beg end
-  (lambda (pos)
-   (push (plist-get (notmuch-search-get-result pos) property) output)))
+  (lambda ()
+   (push (plist-get (notmuch-search-get-result) property) output)))
 output))

 (defun notmuch-search-find-thread-id (&optional bare)
@@ -503,8 +500,8 @@ (defun notmuch-search-get-tags (&optional pos)
 (defun notmuch-search-get-tags-region (beg end)
   (let (output)
 (notmuch-search-foreach-result beg end
-  (lambda (pos)
-   (setq output (append output (notmuch-search-get-tags pos)
+  (lambda ()
+   (setq output (append output (notmuch-search-get-tags)
 output))

 (defun notmuch-search-interactive-region ()
@@ -543,10 +540,9 @@ (defun notmuch-search-tag (tag-changes &optional beg end 
only-matched)
beg end only-matched)))
 (notmuch-tag search-string tag-changes)
 (notmuch-search-foreach-result beg end
-  (lambda (pos)
+  (lambda ()
(notmuch-search-set-tags
-(notmuch-update-tags (notmuch-search-get-tags pos) tag-changes)
-pos)
+(notmuch-update-tags (notmuch-search-get-tags) tag-changes))

 (defun notmuch-search-add-tag (tag-changes &optional beg end)
   "Change tags for the current thread or region (defaulting to add).
-- 
1.7.10.4



[WIP PATCH 0/4] Add a mark thread option

2014-04-22 Thread Mark Walters
Allow users to mark threads in the search buffer and then apply
tagging operations to all marked threads.

This was requested on irc and is also something I have wanted several times.

Patch 1 is a cleanup which simplifies the existing code (imo) and
makes the subsequent patches easier.

Patch 2 is large but mostly just passing an argument all the way
throught the call chain.

Patch 3 and 4 do the actual logic.

At the moment the best way to clear all markings is to refresh the
buffer. Maybe that should change (do we even want refresh to clear
markings?)

On light testing it seems to work.

Best wishes

Mark

Mark Walters (4):
  emacs: search: tidy notmuch-search-foreach-result
  emacs: search: add a marked thread variable and add to relevant
functions
  emacs: search: split foreach-result into list and region variants
  emacs: search: add key binding for marking a thread

 emacs/notmuch.el |  151 ++
 1 file changed, 95 insertions(+), 56 deletions(-)

-- 
1.7.10.4



0.18: call for NEWS, feature freeze April 21

2014-04-22 Thread David Bremner
David Bremner  writes:

> Hi Gang;
>
> We're overdue for a release. I'd like to feature freeze on April 21 and
> release not too long after that. I ran through the commits since 0.17
> and we are missing quite a few NEWS items.  

We are still missing some NEWS items, but I tagged 0.18_rc0 
(and did a corresponding upload to Debian experimental).

d


[PATCH 1/1] building from git: use --abbrev=7 for version string

2014-04-22 Thread Tomi Ollila
Users may have set core.abbrev=n, where n != 7 in their git config
file(s) which would give them different than expected version strings
when building notmuch from git. This fixes the commit hash part of
version string to 7 hexadecimal values.
---

tested with:
git config core.abbrev 12
git describe
rm version.stamp
make
cat version.stamp
git reset --hard origin/master
make
cat version.stamp

.local | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile.local b/Makefile.local
index 877a979..6e78368 100644
--- a/Makefile.local
+++ b/Makefile.local
@@ -21,7 +21,7 @@ endif
 VERSION:=$(shell cat ${srcdir}/version)
 ifeq ($(filter release release-message pre-release 
update-versions,$(MAKECMDGOALS)),)
 ifeq ($(IS_GIT),yes)
-VERSION:=$(shell git describe --match '[0-9.]*'|sed -e s/_/~/ -e s/-/+/ -e 
s/-/~/)
+VERSION:=$(shell git describe --abbrev=7 --match '[0-9.]*'|sed -e s/_/~/ -e 
s/-/+/ -e s/-/~/)
 # Write the file 'version.stamp' in case its contents differ from $(VERSION)
 FILE_VERSION:=$(shell test -f version.stamp && read vs < version.stamp || vs=; 
echo $$vs)
 ifneq ($(FILE_VERSION),$(VERSION))
-- 
1.9.0



[PATCH v2] test: Test thread linking in all possible delivery orders

2014-04-22 Thread Austin Clements
The intent was to produce distinct trees, but obviously combinatorics
is not my strong suit.  Any ideas how to fix/rewrite the algorithm,
other than just uniq'ing the output?

Quoth Mark Walters on Apr 22 at 10:31 pm:
> 
> Hi
> 
> Broadly this looks good but I am somewhat confused by the python
> part. Is it intended to produce the same tree multiple times? It does
> seem to produce all the possible trees (*) so it doesn't matter but
> might be worth a comment.
> 
> Best wishes
> 
> Mark
> 
> (*) I think there should be 64 rooted trees (16 trees and 4 possible
> roots) and the python generates 144 lines. Piping the output to sort and
> uniq gives 64 lines.
> 
> 
>  
> On Mon, 21 Apr 2014, Austin Clements  wrote:
> > These tests deliver all possible (single-root) four-message threads in
> > all possible orders and check that notmuch successfully links them
> > into threads.
> >
> > There are two variants of the test: one delivers messages that
> > reference only their immediate parent and the other delivers messages
> > that reference all of their parents.  The latter test is currently
> > known-broken.
> >
> > This is introduced as a new test (rather than just adding it to
> > T050-new) because it's much easier for this to start with an empty
> > database.
> > ---
> >
> > This version hopefully addresses David's comments in
> > id:87y4zhfmrn.fsf at maritornes.cs.unb.ca and adds a second test that
> > demonstrates the bug Mark in figured out in
> > id:8738h7kv2q.fsf at qmul.ac.uk.
> >
> > test/T051-new-linking.sh | 91 
> > 
> >  1 file changed, 91 insertions(+)
> >  create mode 100755 test/T051-new-linking.sh
> >
> > diff --git a/test/T051-new-linking.sh b/test/T051-new-linking.sh
> > new file mode 100755
> > index 000..9ccbc52
> > --- /dev/null
> > +++ b/test/T051-new-linking.sh
> > @@ -0,0 +1,91 @@
> > +#!/usr/bin/env bash
> > +test_description='"notmuch new" thread linking'
> > +
> > +. ./test-lib.sh
> > +
> > +# Generate all possible single-root four message thread structures.
> > +# Each line in THREADS is a thread structure, where the n'th field is
> > +# the parent of message n.  We'll use this for multiple tests below.
> > +THREADS=$(python -c '
> > +def mkTrees(free, tree={}):
> > +if free == set():
> > +print(" ".join(map(str, [msg[1] for msg in sorted(tree.items())])))
> > +return
> > +# Attach each free message to each message in the tree (if there is
> > +# no tree, make the free message the root), backtracking after each
> > +for msg in sorted(free):
> > +parents = sorted(tree.keys()) if tree else ["none"]
> > +for parent in parents:
> > +ntree = tree.copy()
> > +ntree[msg] = parent
> > +mkTrees(free - set([msg]), ntree)
> > +mkTrees(set(range(4)))')
> > +nthreads=$(wc -l <<< "$THREADS")
> > +
> > +test_begin_subtest "All four-message threads get linked in all delivery 
> > orders (one parent)"
> > +# In the first variant, this delivers messages that reference only
> > +# their immediate parent.  Hence, we should only expect threads to be
> > +# fully joined at the end.
> > +for ((n = 0; n < 4; n++)); do
> > +# Deliver the n'th message of every thread
> > +thread=0
> > +while read -a parents; do
> > +parent=${parents[$n]}
> > +generate_message \
> > +[id]=m$n at t$thread [in-reply-to]="\" \
> > +[subject]=p$thread [from]=m$n
> > +thread=$((thread + 1))
> > +done <<< "$THREADS"
> > +notmuch new > /dev/null
> > +done
> > +output=$(notmuch search --sort=newest-first '*' | notmuch_search_sanitize)
> > +expected=$(for ((i = 0; i < $nthreads; i++)); do
> > +echo "thread:XXX   2001-01-05 [4/4] m3, m2, m1, m0; p$i (inbox 
> > unread)"
> > +done)
> > +test_expect_equal "$output" "$expected"
> > +
> > +test_begin_subtest "The same (full parent linkage)"
> > +test_subtest_known_broken
> > +# Here we do the same thing as the previous test, but each message
> > +# references all of its parents.  Since every message references the
> > +# root of the thread, each thread should always be fully joined.  This
> > +# is currently broken because of the bug detailed in
> > +# id:8738h7kv2q.fsf at qmul.ac.uk.
> > +rm ${MAIL_DIR}/*
> > +notmuch new
> > +output=""
> > +expected=""
> > +for ((n = 0; n < 4; n++)); do
> > +# Deliver the n'th message of every thread
> > +thread=0
> > +while read -a parents; do
> > +references=""
> > +parent=${parents[$n]}
> > +while [[ $parent != none ]]; do
> > +references=" $references"
> > +parent=${parents[$parent]}
> > +done
> > +
> > +generate_message \
> > +[id]=m$n at t$thread [references]="'$references'" \
> > +[subject]=p$thread [from]=m$n
> > +thread=$((thread + 1))
> > +done <<< "$THREADS"
> > +notmuch new > /dev/null
> > +
> > +output="$output
>

Re: Thanks for the nmbug-status program

2014-04-22 Thread W. Trevor King
On Tue, Apr 22, 2014 at 04:01:06PM -0700, Carl Worth wrote:
> W. Trevor King writes:
> > I think that making nmbug and nmbug-status generally applicable for
> > other projects is a good target.  I don't see any need to pull them
> > out into a stand-alone project to do that though.
> 
> For what it's worth, I don't disagree.

Does that mean your patches are aimed upstream at the notmuch
repository?  If so, you should probably mail them to the list for
discussion.  Here are my initial reactions from reading the Git
history:

* bcc677a Add initial notmuch-to-html script

This is a side effect of pulling the script out into it's own repo and
doesn't need to be upstreamed.

* fb9f586 Add explicit license information

Another side effect of pulling the script out, but I like direct
license references.  Someone using the script may not want to track
down a chain of references to figure out what the license is.

* 9b8c173 Add copy of the GNU General Public License

Doesn't need to be upstreamed.

* 7d7ce23 Make the configuration file a required argument.

I liked the "fall back to $NMBGIT's config:status-config.json"
functionality.  I also think it generalizes well to parallel use for
multiple projects.  For example, if I was maintaining a "Mesa Stable
Queue", I'd suggest folks use:

  $ NMBGIT=~/.config/mesa-stable-queue nmbug
  $ NMBGIT=~/.config/mesa-stable-queue nmbug-status

(or their shell's approriate environment variable syntax), and I'd
version the config file in the same repo as the associated tags.  I
don't see the point of keeping the config file somewhere else, when
you'll already need a repository to store the tags.

* d456390 Add a comment describing the program

I like the idea, but I'd prefer a docstring just after the leading
comment.  Then we could reuse the docstring as the description for the
ArgumentParser.

* 336411f Add "notmuch search" to the advertised queries.

Folks can already copy-paste the terms into Emacs etc.  You only need
the 'notmuch search' prefix if you're pasting into a shell, in which
case you'll also want to escape shell-sensitive characters like
parenthesis.  I'm fine without this one.

* 9fd6177 Move the generated date from the top of the page to the footer.

I like this.  Part of me wants nmbug-status to use an actual
templating package (e.g. Jinja) for this sort of thing, but we can put
that off and stick with the hard-coded template as long as we keep
agreeing on the layout ;).

* f55ff7e Drop the --get-query option

I'd like to keep the in-Git config, so I'm -1 here.

* 396869c Add support for a --query option (along with a default configuration)

I don't have an opinion about this one ;).  The default config doesn't
look very useful (especially with it's dummy metadata settings), but
I'd only be using the in-Git-config approach, and I don't mind if
others want something like this.

Cheers,
Trevor

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy


signature.asc
Description: OpenPGP digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Thanks for the nmbug-status program

2014-04-22 Thread W. Trevor King
On Tue, Apr 22, 2014 at 04:01:06PM -0700, Carl Worth wrote:
> W. Trevor King writes:
> > I think that making nmbug and nmbug-status generally applicable for
> > other projects is a good target.  I don't see any need to pull them
> > out into a stand-alone project to do that though.
> 
> For what it's worth, I don't disagree.

Does that mean your patches are aimed upstream at the notmuch
repository?  If so, you should probably mail them to the list for
discussion.  Here are my initial reactions from reading the Git
history:

* bcc677a Add initial notmuch-to-html script

This is a side effect of pulling the script out into it's own repo and
doesn't need to be upstreamed.

* fb9f586 Add explicit license information

Another side effect of pulling the script out, but I like direct
license references.  Someone using the script may not want to track
down a chain of references to figure out what the license is.

* 9b8c173 Add copy of the GNU General Public License

Doesn't need to be upstreamed.

* 7d7ce23 Make the configuration file a required argument.

I liked the "fall back to $NMBGIT's config:status-config.json"
functionality.  I also think it generalizes well to parallel use for
multiple projects.  For example, if I was maintaining a "Mesa Stable
Queue", I'd suggest folks use:

  $ NMBGIT=~/.config/mesa-stable-queue nmbug
  $ NMBGIT=~/.config/mesa-stable-queue nmbug-status

(or their shell's approriate environment variable syntax), and I'd
version the config file in the same repo as the associated tags.  I
don't see the point of keeping the config file somewhere else, when
you'll already need a repository to store the tags.

* d456390 Add a comment describing the program

I like the idea, but I'd prefer a docstring just after the leading
comment.  Then we could reuse the docstring as the description for the
ArgumentParser.

* 336411f Add "notmuch search" to the advertised queries.

Folks can already copy-paste the terms into Emacs etc.  You only need
the 'notmuch search' prefix if you're pasting into a shell, in which
case you'll also want to escape shell-sensitive characters like
parenthesis.  I'm fine without this one.

* 9fd6177 Move the generated date from the top of the page to the footer.

I like this.  Part of me wants nmbug-status to use an actual
templating package (e.g. Jinja) for this sort of thing, but we can put
that off and stick with the hard-coded template as long as we keep
agreeing on the layout ;).

* f55ff7e Drop the --get-query option

I'd like to keep the in-Git config, so I'm -1 here.

* 396869c Add support for a --query option (along with a default configuration)

I don't have an opinion about this one ;).  The default config doesn't
look very useful (especially with it's dummy metadata settings), but
I'd only be using the in-Git-config approach, and I don't mind if
others want something like this.

Cheers,
Trevor

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy
-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20140422/eac777f8/attachment.pgp>


Re: Thanks for the nmbug-status program

2014-04-22 Thread Carl Worth
"W. Trevor King"  writes:
>   $ git clone http://git.cworth.org/git/notmuch-to-html

Sorry about that. What I had meant to say is:

  git clone git://git.cworth.org/git/notmuch-to-html

(This time I actually copy-pasted from a terminal where I tested that
the command actually works.)

And now, just in case you say you can talk http, but not git protocol,
I've made this work too:

  git clone http://http-git.cworth.org/git/notmuch-to-html

-Carl

PS. If someone knows magic so that git clients could clone from the same
URL that web browsers can use to get to the web pages, it would be nice
to have that set up.


pgpM0yuwJkWEf.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: Thanks for the nmbug-status program

2014-04-22 Thread W. Trevor King
On Tue, Apr 22, 2014 at 04:01:06PM -0700, Carl Worth wrote:
> "W. Trevor King"  writes:
> >>http://git.cworth.org/git/notmuch-to-html
> >
> > Is there a clonable URL for this?
> 
> Yes. Sorry I didn't provide that, (and clearly I need to reconfigure my
> git web pages to mention the URL):
> 
>   git clone http://git.cworth.org/git/notmuch-to-html

  $ git clone http://git.cworth.org/git/notmuch-to-html
  Cloning into 'notmuch-to-html'...
  fatal: repository 'http://git.cworth.org/git/notmuch-to-html/' not found

Cheers,
Trevor

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy


signature.asc
Description: OpenPGP digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Thanks for the nmbug-status program

2014-04-22 Thread W. Trevor King
On Tue, Apr 22, 2014 at 04:01:06PM -0700, Carl Worth wrote:
> "W. Trevor King"  writes:
> >>http://git.cworth.org/git/notmuch-to-html
> >
> > Is there a clonable URL for this?
> 
> Yes. Sorry I didn't provide that, (and clearly I need to reconfigure my
> git web pages to mention the URL):
> 
>   git clone http://git.cworth.org/git/notmuch-to-html

  $ git clone http://git.cworth.org/git/notmuch-to-html
  Cloning into 'notmuch-to-html'...
  fatal: repository 'http://git.cworth.org/git/notmuch-to-html/' not found

Cheers,
Trevor

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy
-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20140422/9d0729cd/attachment.pgp>


Re: Thanks for the nmbug-status program

2014-04-22 Thread Carl Worth
"W. Trevor King"  writes:
>>  http://git.cworth.org/git/notmuch-to-html
>
> Is there a clonable URL for this?

Yes. Sorry I didn't provide that, (and clearly I need to reconfigure my
git web pages to mention the URL):

git clone http://git.cworth.org/git/notmuch-to-html

> I think that making nmbug and nmbug-status generally applicable for
> other projects is a good target.  I don't see any need to pull them
> out into a stand-alone project to do that though.

For what it's worth, I don't disagree.

-- 
carl.d.wo...@intel.com


pgpseKquuCLLa.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH v2] test: Test thread linking in all possible delivery orders

2014-04-22 Thread Austin Clements
The intent was to produce distinct trees, but obviously combinatorics
is not my strong suit.  Any ideas how to fix/rewrite the algorithm,
other than just uniq'ing the output?

Quoth Mark Walters on Apr 22 at 10:31 pm:
> 
> Hi
> 
> Broadly this looks good but I am somewhat confused by the python
> part. Is it intended to produce the same tree multiple times? It does
> seem to produce all the possible trees (*) so it doesn't matter but
> might be worth a comment.
> 
> Best wishes
> 
> Mark
> 
> (*) I think there should be 64 rooted trees (16 trees and 4 possible
> roots) and the python generates 144 lines. Piping the output to sort and
> uniq gives 64 lines.
> 
> 
>  
> On Mon, 21 Apr 2014, Austin Clements  wrote:
> > These tests deliver all possible (single-root) four-message threads in
> > all possible orders and check that notmuch successfully links them
> > into threads.
> >
> > There are two variants of the test: one delivers messages that
> > reference only their immediate parent and the other delivers messages
> > that reference all of their parents.  The latter test is currently
> > known-broken.
> >
> > This is introduced as a new test (rather than just adding it to
> > T050-new) because it's much easier for this to start with an empty
> > database.
> > ---
> >
> > This version hopefully addresses David's comments in
> > id:87y4zhfmrn@maritornes.cs.unb.ca and adds a second test that
> > demonstrates the bug Mark in figured out in
> > id:8738h7kv2q@qmul.ac.uk.
> >
> > test/T051-new-linking.sh | 91 
> > 
> >  1 file changed, 91 insertions(+)
> >  create mode 100755 test/T051-new-linking.sh
> >
> > diff --git a/test/T051-new-linking.sh b/test/T051-new-linking.sh
> > new file mode 100755
> > index 000..9ccbc52
> > --- /dev/null
> > +++ b/test/T051-new-linking.sh
> > @@ -0,0 +1,91 @@
> > +#!/usr/bin/env bash
> > +test_description='"notmuch new" thread linking'
> > +
> > +. ./test-lib.sh
> > +
> > +# Generate all possible single-root four message thread structures.
> > +# Each line in THREADS is a thread structure, where the n'th field is
> > +# the parent of message n.  We'll use this for multiple tests below.
> > +THREADS=$(python -c '
> > +def mkTrees(free, tree={}):
> > +if free == set():
> > +print(" ".join(map(str, [msg[1] for msg in sorted(tree.items())])))
> > +return
> > +# Attach each free message to each message in the tree (if there is
> > +# no tree, make the free message the root), backtracking after each
> > +for msg in sorted(free):
> > +parents = sorted(tree.keys()) if tree else ["none"]
> > +for parent in parents:
> > +ntree = tree.copy()
> > +ntree[msg] = parent
> > +mkTrees(free - set([msg]), ntree)
> > +mkTrees(set(range(4)))')
> > +nthreads=$(wc -l <<< "$THREADS")
> > +
> > +test_begin_subtest "All four-message threads get linked in all delivery 
> > orders (one parent)"
> > +# In the first variant, this delivers messages that reference only
> > +# their immediate parent.  Hence, we should only expect threads to be
> > +# fully joined at the end.
> > +for ((n = 0; n < 4; n++)); do
> > +# Deliver the n'th message of every thread
> > +thread=0
> > +while read -a parents; do
> > +parent=${parents[$n]}
> > +generate_message \
> > +[id]=m$n@t$thread [in-reply-to]="\" \
> > +[subject]=p$thread [from]=m$n
> > +thread=$((thread + 1))
> > +done <<< "$THREADS"
> > +notmuch new > /dev/null
> > +done
> > +output=$(notmuch search --sort=newest-first '*' | notmuch_search_sanitize)
> > +expected=$(for ((i = 0; i < $nthreads; i++)); do
> > +echo "thread:XXX   2001-01-05 [4/4] m3, m2, m1, m0; p$i (inbox 
> > unread)"
> > +done)
> > +test_expect_equal "$output" "$expected"
> > +
> > +test_begin_subtest "The same (full parent linkage)"
> > +test_subtest_known_broken
> > +# Here we do the same thing as the previous test, but each message
> > +# references all of its parents.  Since every message references the
> > +# root of the thread, each thread should always be fully joined.  This
> > +# is currently broken because of the bug detailed in
> > +# id:8738h7kv2q@qmul.ac.uk.
> > +rm ${MAIL_DIR}/*
> > +notmuch new
> > +output=""
> > +expected=""
> > +for ((n = 0; n < 4; n++)); do
> > +# Deliver the n'th message of every thread
> > +thread=0
> > +while read -a parents; do
> > +references=""
> > +parent=${parents[$n]}
> > +while [[ $parent != none ]]; do
> > +references=" $references"
> > +parent=${parents[$parent]}
> > +done
> > +
> > +generate_message \
> > +[id]=m$n@t$thread [references]="'$references'" \
> > +[subject]=p$thread [from]=m$n
> > +thread=$((thread + 1))
> > +done <<< "$THREADS"
> > +notmuch new > /dev/null
> > +
> > +output="$output
> > +$(notmuch s

Re: [PATCH] Add configurable changed tag to messages that have been changed on disk

2014-04-22 Thread David Bremner
Gaute Hope  writes:

>
> I am talking about syncing tags to a maildir _folder_, not flags. It
> could be implemented as maildir.synchronize is now, but it would be a
> larger feature which could work in a lot of different ways.
>

So to try and clarify the use case, this could be used to add a tag
"changed" to each message-id that had one or more files
moved/added/deleted on disk.  You would then retag that message using
something like the output of notmuch search --output=files so that a set
of tags corresponds to a set of folders containing the message. Is this
correct?   I guess the proposed ctime information could be used for this
as well, if it also tracked those non-tag related changes. I guess this
would make it worse for David M's purposes (although presumeably still
better than nothing).

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


Re: Thanks for the nmbug-status program

2014-04-22 Thread W. Trevor King
On Tue, Apr 22, 2014 at 02:12:30PM -0700, Carl Worth wrote:
> The script is quite general, (only a tiny portion was tied directly
> to nmbug), so I renamed it notmuch-to-html, and hosted it here after
> a tiny bit of generalization and a couple of minor user-interface
> changes:
> 
>   http://git.cworth.org/git/notmuch-to-html

Is there a clonable URL for this?

I think that making nmbug and nmbug-status generally applicable for
other projects is a good target.  I don't see any need to pull them
out into a stand-alone project to do that though.  Folks can just
install them alongside notmuch when they install notmuch.  I have a
hard time imagining folks using them *without* installing notmuch.  I
have no preference on whether they should be packaged separately or
together with the notmuch core (Gentoo has an optional nmbug USE flag
to toggle it's installation).

Cheers,
Trevor

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy


signature.asc
Description: OpenPGP digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Thanks for the nmbug-status program

2014-04-22 Thread W. Trevor King
On Tue, Apr 22, 2014 at 02:12:30PM -0700, Carl Worth wrote:
> The script is quite general, (only a tiny portion was tied directly
> to nmbug), so I renamed it notmuch-to-html, and hosted it here after
> a tiny bit of generalization and a couple of minor user-interface
> changes:
> 
>   http://git.cworth.org/git/notmuch-to-html

Is there a clonable URL for this?

I think that making nmbug and nmbug-status generally applicable for
other projects is a good target.  I don't see any need to pull them
out into a stand-alone project to do that though.  Folks can just
install them alongside notmuch when they install notmuch.  I have a
hard time imagining folks using them *without* installing notmuch.  I
have no preference on whether they should be packaged separately or
together with the notmuch core (Gentoo has an optional nmbug USE flag
to toggle it's installation).

Cheers,
Trevor

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy
-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20140422/91f8c6f0/attachment.pgp>


Re: [PATCH v2] test: Test thread linking in all possible delivery orders

2014-04-22 Thread Mark Walters

Hi

Broadly this looks good but I am somewhat confused by the python
part. Is it intended to produce the same tree multiple times? It does
seem to produce all the possible trees (*) so it doesn't matter but
might be worth a comment.

Best wishes

Mark

(*) I think there should be 64 rooted trees (16 trees and 4 possible
roots) and the python generates 144 lines. Piping the output to sort and
uniq gives 64 lines.


 
On Mon, 21 Apr 2014, Austin Clements  wrote:
> These tests deliver all possible (single-root) four-message threads in
> all possible orders and check that notmuch successfully links them
> into threads.
>
> There are two variants of the test: one delivers messages that
> reference only their immediate parent and the other delivers messages
> that reference all of their parents.  The latter test is currently
> known-broken.
>
> This is introduced as a new test (rather than just adding it to
> T050-new) because it's much easier for this to start with an empty
> database.
> ---
>
> This version hopefully addresses David's comments in
> id:87y4zhfmrn@maritornes.cs.unb.ca and adds a second test that
> demonstrates the bug Mark in figured out in
> id:8738h7kv2q@qmul.ac.uk.
>
> test/T051-new-linking.sh | 91 
>  1 file changed, 91 insertions(+)
>  create mode 100755 test/T051-new-linking.sh
>
> diff --git a/test/T051-new-linking.sh b/test/T051-new-linking.sh
> new file mode 100755
> index 000..9ccbc52
> --- /dev/null
> +++ b/test/T051-new-linking.sh
> @@ -0,0 +1,91 @@
> +#!/usr/bin/env bash
> +test_description='"notmuch new" thread linking'
> +
> +. ./test-lib.sh
> +
> +# Generate all possible single-root four message thread structures.
> +# Each line in THREADS is a thread structure, where the n'th field is
> +# the parent of message n.  We'll use this for multiple tests below.
> +THREADS=$(python -c '
> +def mkTrees(free, tree={}):
> +if free == set():
> +print(" ".join(map(str, [msg[1] for msg in sorted(tree.items())])))
> +return
> +# Attach each free message to each message in the tree (if there is
> +# no tree, make the free message the root), backtracking after each
> +for msg in sorted(free):
> +parents = sorted(tree.keys()) if tree else ["none"]
> +for parent in parents:
> +ntree = tree.copy()
> +ntree[msg] = parent
> +mkTrees(free - set([msg]), ntree)
> +mkTrees(set(range(4)))')
> +nthreads=$(wc -l <<< "$THREADS")
> +
> +test_begin_subtest "All four-message threads get linked in all delivery 
> orders (one parent)"
> +# In the first variant, this delivers messages that reference only
> +# their immediate parent.  Hence, we should only expect threads to be
> +# fully joined at the end.
> +for ((n = 0; n < 4; n++)); do
> +# Deliver the n'th message of every thread
> +thread=0
> +while read -a parents; do
> +parent=${parents[$n]}
> +generate_message \
> +[id]=m$n@t$thread [in-reply-to]="\" \
> +[subject]=p$thread [from]=m$n
> +thread=$((thread + 1))
> +done <<< "$THREADS"
> +notmuch new > /dev/null
> +done
> +output=$(notmuch search --sort=newest-first '*' | notmuch_search_sanitize)
> +expected=$(for ((i = 0; i < $nthreads; i++)); do
> +echo "thread:XXX   2001-01-05 [4/4] m3, m2, m1, m0; p$i (inbox 
> unread)"
> +done)
> +test_expect_equal "$output" "$expected"
> +
> +test_begin_subtest "The same (full parent linkage)"
> +test_subtest_known_broken
> +# Here we do the same thing as the previous test, but each message
> +# references all of its parents.  Since every message references the
> +# root of the thread, each thread should always be fully joined.  This
> +# is currently broken because of the bug detailed in
> +# id:8738h7kv2q@qmul.ac.uk.
> +rm ${MAIL_DIR}/*
> +notmuch new
> +output=""
> +expected=""
> +for ((n = 0; n < 4; n++)); do
> +# Deliver the n'th message of every thread
> +thread=0
> +while read -a parents; do
> +references=""
> +parent=${parents[$n]}
> +while [[ $parent != none ]]; do
> +references=" $references"
> +parent=${parents[$parent]}
> +done
> +
> +generate_message \
> +[id]=m$n@t$thread [references]="'$references'" \
> +[subject]=p$thread [from]=m$n
> +thread=$((thread + 1))
> +done <<< "$THREADS"
> +notmuch new > /dev/null
> +
> +output="$output
> +$(notmuch search --sort=newest-first '*' | notmuch_search_sanitize)"
> +
> +# Construct expected output
> +template="thread:XXX   2001-01-05 [$((n+1))/$((n+1))]"
> +for ((m = n; m > 0; m--)); do
> +template="$template m$m,"
> +done
> +expected="$expected
> +$(for ((i = 0; i < $nthreads; i++)); do
> +echo "$template m0; p$i (inbox unread)"
> +done)"
> +done
> +test_expect_equal "$output" "$expected"
> +
> +test_done
> -- 
> 1.9.1
___

Thanks for the nmbug-status program

2014-04-22 Thread Carl Worth
Hi David,

I just wanted to give you a quick "thank you" for the nmbug-status
program. It's really handy to be able to publish decent-looking HTML
pages based on notmuch search results with this.

The script is quite general, (only a tiny portion was tied directly to
nmbug), so I renamed it notmuch-to-html, and hosted it here after a tiny
bit of generalization and a couple of minor user-interface changes:

http://git.cworth.org/git/notmuch-to-html

Feel free to re-adopt this as part of nmbug if you want or to suck it
back into notmuch/contrib or whatever.

Again, thanks!

-Carl

PS. For reference, here are the results I'm currently generating with
the script (for the Mesa project):

http://cworth.org/~cworth/mesa-stable-queue/

You'll see that I'm doing something very similar to what nmbug does,
(even with a compatible tag-naming scheme). In my case, I'm not (yet)
doing any collaborative maintenance of the patch queue, so I don't need
any of the tag-synchronization features that nmbug provides.

I would like to be able to do collaborative tag maintenance in the
future. And I think for that what I'd really like is a standalone tool
that allowed me to synchronize a set of tags (such as, "anything with a
msq::" prefix). Of course, that's really close to what nmbug is. I'd
just like to see it be a bit more general, and walk the user more gently
through the setup.

(I'll confess that I tried to hack up nmbug a bit, but failed. There's
some mismatch between me and perl that is apparently not going to be
resolved.)

-- 
carl.d.wo...@intel.com


pgpQX1OhV5isz.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 1/1] building from git: use --abbrev=7 for version string

2014-04-22 Thread Jani Nikula
On Tue, 22 Apr 2014, Mark Walters  wrote:
> LGTM +1

Looks good, and fixes the problem for me.

BR,
Jani.

>
> MW
>
> On Tue, 22 Apr 2014, Tomi Ollila  wrote:
>> Users may have set core.abbrev=n, where n != 7 in their git config
>> file(s) which would give them different than expected version strings
>> when building notmuch from git. This fixes the commit hash part of
>> version string to 7 hexadecimal values.
>> ---
>>
>> tested with:
>> git config core.abbrev 12
>> git describe
>> rm version.stamp
>> make
>> cat version.stamp
>> git reset --hard origin/master
>> make
>> cat version.stamp
>>
>> .local | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/Makefile.local b/Makefile.local
>> index 877a979..6e78368 100644
>> --- a/Makefile.local
>> +++ b/Makefile.local
>> @@ -21,7 +21,7 @@ endif
>>  VERSION:=$(shell cat ${srcdir}/version)
>>  ifeq ($(filter release release-message pre-release 
>> update-versions,$(MAKECMDGOALS)),)
>>  ifeq ($(IS_GIT),yes)
>> -VERSION:=$(shell git describe --match '[0-9.]*'|sed -e s/_/~/ -e s/-/+/ -e 
>> s/-/~/)
>> +VERSION:=$(shell git describe --abbrev=7 --match '[0-9.]*'|sed -e s/_/~/ -e 
>> s/-/+/ -e s/-/~/)
>>  # Write the file 'version.stamp' in case its contents differ from $(VERSION)
>>  FILE_VERSION:=$(shell test -f version.stamp && read vs < version.stamp || 
>> vs=; echo $$vs)
>>  ifneq ($(FILE_VERSION),$(VERSION))
>> -- 
>> 1.9.0
>>
>> ___
>> notmuch mailing list
>> notmuch@notmuchmail.org
>> http://notmuchmail.org/mailman/listinfo/notmuch
> ___
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 1/1] building from git: use --abbrev=7 for version string

2014-04-22 Thread Mark Walters

LGTM +1

MW

On Tue, 22 Apr 2014, Tomi Ollila  wrote:
> Users may have set core.abbrev=n, where n != 7 in their git config
> file(s) which would give them different than expected version strings
> when building notmuch from git. This fixes the commit hash part of
> version string to 7 hexadecimal values.
> ---
>
> tested with:
> git config core.abbrev 12
> git describe
> rm version.stamp
> make
> cat version.stamp
> git reset --hard origin/master
> make
> cat version.stamp
>
> .local | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/Makefile.local b/Makefile.local
> index 877a979..6e78368 100644
> --- a/Makefile.local
> +++ b/Makefile.local
> @@ -21,7 +21,7 @@ endif
>  VERSION:=$(shell cat ${srcdir}/version)
>  ifeq ($(filter release release-message pre-release 
> update-versions,$(MAKECMDGOALS)),)
>  ifeq ($(IS_GIT),yes)
> -VERSION:=$(shell git describe --match '[0-9.]*'|sed -e s/_/~/ -e s/-/+/ -e 
> s/-/~/)
> +VERSION:=$(shell git describe --abbrev=7 --match '[0-9.]*'|sed -e s/_/~/ -e 
> s/-/+/ -e s/-/~/)
>  # Write the file 'version.stamp' in case its contents differ from $(VERSION)
>  FILE_VERSION:=$(shell test -f version.stamp && read vs < version.stamp || 
> vs=; echo $$vs)
>  ifneq ($(FILE_VERSION),$(VERSION))
> -- 
> 1.9.0
>
> ___
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[WIP PATCH 3/4] emacs: search: split foreach-result into list and region variants

2014-04-22 Thread Mark Walters
---
 emacs/notmuch.el |   20 +++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 7b06458..e1ece47 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -380,7 +380,20 @@ (defun notmuch-search-result-end (&optional pos)
 (next-single-property-change (or pos (point)) 'notmuch-search-result
 nil (point-max
 
-(defun notmuch-search-foreach-result (beg end thread-list function)
+(defun notmuch-search-foreach-result-in-list (thread-list function)
+  "Invoke function for each thread in list."
+  (lexical-let ((thread-list (copy-sequence thread-list)))
+(save-excursion
+  (goto-char (point-min))
+  (while (and (notmuch-search-get-result)
+ thread-list)
+   (let ((thread (notmuch-search-find-thread-id)))
+ (when (member thread thread-list)
+   (funcall function)
+   (setq thread-list (delete thread thread-list
+   (notmuch-search-next-thread)
+
+(defun notmuch-search-foreach-result-in-region (beg end function)
   "Invoke FUNCTION for each result between BEG and END.
 
 FUNCTION should take no arguments.  It will be applied at the
@@ -401,6 +414,11 @@ (defun notmuch-search-foreach-result (beg end thread-list 
function)
  (funcall function)
  (notmuch-search-next-thread))
 
+(defun notmuch-search-foreach-result (beg end thread-list function)
+  (if thread-list
+  (notmuch-search-foreach-result-in-list thread-list function)
+(notmuch-search-foreach-result-in-region beg end function)))
+
 ;; Unindent the function argument of notmuch-search-foreach-result so
 ;; the indentation of callers doesn't get out of hand.
 (put 'notmuch-search-foreach-result 'lisp-indent-function 2)
-- 
1.7.10.4

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


[WIP PATCH 1/4] emacs: search: tidy notmuch-search-foreach-result

2014-04-22 Thread Mark Walters
notmuch-search-foreach-result is cumbersome as it applies the callback
function with the position of the start of the thread as the
argument. It is more natural to move point to the start of each
relevant thread and not pass any arguments to the callback function.
---
 emacs/notmuch.el |   52 
 1 file changed, 24 insertions(+), 28 deletions(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 6c0bc1b..cb7c006 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -378,27 +378,24 @@ (defun notmuch-search-result-end (&optional pos)
 (defun notmuch-search-foreach-result (beg end function)
   "Invoke FUNCTION for each result between BEG and END.
 
-FUNCTION should take one argument.  It will be applied to the
-character position of the beginning of each result that overlaps
-the region between points BEG and END.  As a special case, if (=
-BEG END), FUNCTION will be applied to the result containing point
-BEG."
-
-  (lexical-let ((pos (notmuch-search-result-beginning beg))
-   ;; End must be a marker in case function changes the
-   ;; text.
-   (end (copy-marker end))
-   ;; Make sure we examine at least one result, even if
-   ;; (= beg end).
-   (first t))
-;; We have to be careful if the region extends beyond the results.
-;; In this case, pos could be null or there could be no result at
-;; pos.
-(while (and pos (or (< pos end) first))
-  (when (notmuch-search-get-result pos)
-   (funcall function pos))
-  (setq pos (notmuch-search-result-end pos)
-   first nil
+FUNCTION should take no arguments.  It will be applied at the
+beginning of each result that overlaps the region between points
+BEG and END.  As a special case, if (= BEG END), FUNCTION will be
+applied to the result containing point BEG."
+
+  (when (notmuch-search-get-result)
+(save-excursion
+  ;; End must be a marker in case function changes the text.
+  (lexical-let ((end (copy-marker end)))
+   ;; We always apply function at least once: even if (= BEG END).
+   (goto-char (notmuch-search-result-beginning beg))
+   (funcall function)
+   (notmuch-search-next-thread)
+   (while (and (notmuch-search-get-result)
+   (< (notmuch-search-result-beginning) end))
+ (funcall function)
+ (notmuch-search-next-thread))
+
 ;; Unindent the function argument of notmuch-search-foreach-result so
 ;; the indentation of callers doesn't get out of hand.
 (put 'notmuch-search-foreach-result 'lisp-indent-function 2)
@@ -406,8 +403,8 @@ (defun notmuch-search-foreach-result (beg end function)
 (defun notmuch-search-properties-in-region (property beg end)
   (let (output)
 (notmuch-search-foreach-result beg end
-  (lambda (pos)
-   (push (plist-get (notmuch-search-get-result pos) property) output)))
+  (lambda ()
+   (push (plist-get (notmuch-search-get-result) property) output)))
 output))
 
 (defun notmuch-search-find-thread-id (&optional bare)
@@ -503,8 +500,8 @@ (defun notmuch-search-get-tags (&optional pos)
 (defun notmuch-search-get-tags-region (beg end)
   (let (output)
 (notmuch-search-foreach-result beg end
-  (lambda (pos)
-   (setq output (append output (notmuch-search-get-tags pos)
+  (lambda ()
+   (setq output (append output (notmuch-search-get-tags)
 output))
 
 (defun notmuch-search-interactive-region ()
@@ -543,10 +540,9 @@ (defun notmuch-search-tag (tag-changes &optional beg end 
only-matched)
beg end only-matched)))
 (notmuch-tag search-string tag-changes)
 (notmuch-search-foreach-result beg end
-  (lambda (pos)
+  (lambda ()
(notmuch-search-set-tags
-(notmuch-update-tags (notmuch-search-get-tags pos) tag-changes)
-pos)
+(notmuch-update-tags (notmuch-search-get-tags) tag-changes))
 
 (defun notmuch-search-add-tag (tag-changes &optional beg end)
   "Change tags for the current thread or region (defaulting to add).
-- 
1.7.10.4

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


[WIP PATCH 4/4] emacs: search: add key binding for marking a thread

2014-04-22 Thread Mark Walters
Add a function for toggling the mark on a thread, by default bound to
",".  Also make a marked thread clearly visible: this uses inverse
video as being a bit like selecting. Perhaps actually using the same
face (mainly backgorund colour) as a selection would make sense?
---
 emacs/notmuch.el |   15 +++
 1 file changed, 15 insertions(+)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index e1ece47..4976f0a 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -179,6 +179,7 @@ (defvar notmuch-search-mode-map
 (define-key map "+" 'notmuch-search-add-tag)
 (define-key map (kbd "RET") 'notmuch-search-show-thread)
 (define-key map "Z" 'notmuch-tree-from-search-current-query)
+(define-key map "," 'notmuch-search-mark-thread)
 map)
   "Keymap for \"notmuch search\" buffers.")
 (fset 'notmuch-search-mode-map notmuch-search-mode-map)
@@ -604,6 +605,17 @@ (defun notmuch-search-archive-thread (&optional unarchive 
beg end thread-list)
  (notmuch-tag-change-list notmuch-archive-tags unarchive) beg end 
thread-list))
   (notmuch-search-next-thread))
 
+(defun notmuch-search-mark-thread ()
+  "Toggle the mark on the currently selected thread."
+  (interactive)
+  (let ((thread (notmuch-search-find-thread-id)))
+(if (member thread notmuch-search-marked-threads)
+   (setq notmuch-search-marked-threads
+ (delete thread notmuch-search-marked-threads))
+  (push (notmuch-search-find-thread-id) notmuch-search-marked-threads)))
+  (notmuch-search-update-result (notmuch-search-get-result))
+  (notmuch-search-next-thread))
+
 (defun notmuch-search-update-result (result &optional pos)
   "Replace the result object of the thread at POS (or point) by
 RESULT and redraw it.
@@ -806,6 +818,9 @@ (defun notmuch-search-show-result (result pos)
   (dolist (spec notmuch-search-result-format)
(notmuch-search-insert-field (car spec) (cdr spec) result))
   (insert "\n")
+  (when (member (concat "thread:" (plist-get result :thread))
+   notmuch-search-marked-threads)
+   (notmuch-apply-face nil '(:inverse-video t) nil pos (point)))
   (notmuch-search-color-line pos (point) (plist-get result :tags))
   (put-text-property pos (point) 'notmuch-search-result result
 
-- 
1.7.10.4

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


[WIP PATCH 2/4] emacs: search: add a marked thread variable and add to relevant functions

2014-04-22 Thread Mark Walters
Add a marked thread variable containing a list of thread ids of marked
threads and make it be passed through all relevant functions. This
ends up being quite large as there are quite a few callers.

Alternatively we could overload beg rather than adding a thread-list
variable. This would make a much smaller patch but might be more
confusing.
---
 emacs/notmuch.el |   66 +++---
 1 file changed, 38 insertions(+), 28 deletions(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index cb7c006..7b06458 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -100,6 +100,11 @@ (defcustom notmuch-init-file (locate-user-emacs-file 
"notmuch-config")
 (defvar notmuch-query-history nil
   "Variable to store minibuffer history for notmuch queries")
 
+(defvar notmuch-search-marked-threads nil
+  "Buffer local list of marked threads")
+(make-variable-buffer-local 'notmuch-search-marked-threads)
+(put 'notmuch-search-marked-threads 'permanent-local t)
+
 (defun notmuch-foreach-mime-part (function mm-handle)
   (cond ((stringp (car mm-handle))
  (dolist (part (cdr mm-handle))
@@ -375,7 +380,7 @@ (defun notmuch-search-result-end (&optional pos)
 (next-single-property-change (or pos (point)) 'notmuch-search-result
 nil (point-max
 
-(defun notmuch-search-foreach-result (beg end function)
+(defun notmuch-search-foreach-result (beg end thread-list function)
   "Invoke FUNCTION for each result between BEG and END.
 
 FUNCTION should take no arguments.  It will be applied at the
@@ -400,9 +405,9 @@ (defun notmuch-search-foreach-result (beg end function)
 ;; the indentation of callers doesn't get out of hand.
 (put 'notmuch-search-foreach-result 'lisp-indent-function 2)
 
-(defun notmuch-search-properties-in-region (property beg end)
+(defun notmuch-search-properties-in-region (property beg end &optional 
thread-list)
   (let (output)
-(notmuch-search-foreach-result beg end
+(notmuch-search-foreach-result beg end thread-list
   (lambda ()
(push (plist-get (notmuch-search-get-result) property) output)))
 output))
@@ -421,13 +426,13 @@ (defun notmuch-search-find-stable-query ()
 matched and unmatched messages in the current thread."
   (plist-get (notmuch-search-get-result) :query))
 
-(defun notmuch-search-find-stable-query-region (beg end &optional only-matched)
+(defun notmuch-search-find-stable-query-region (beg end &optional only-matched 
thread-list)
   "Return the stable query for the current region.
 
 If ONLY-MATCHED is non-nil, include only matched messages.  If it
 is nil, include both matched and unmatched messages."
   (let ((query-list nil) (all (not only-matched)))
-(dolist (queries (notmuch-search-properties-in-region :query beg end))
+(dolist (queries (notmuch-search-properties-in-region :query beg end 
thread-list))
   (when (first queries)
(push (first queries) query-list))
   (when (and all (second queries))
@@ -438,17 +443,17 @@ (defun notmuch-search-find-authors ()
   "Return the authors for the current thread"
   (plist-get (notmuch-search-get-result) :authors))
 
-(defun notmuch-search-find-authors-region (beg end)
+(defun notmuch-search-find-authors-region (beg end &optional thread-list)
   "Return a list of authors for the current region"
-  (notmuch-search-properties-in-region :authors beg end))
+  (notmuch-search-properties-in-region :authors beg end thread-list))
 
 (defun notmuch-search-find-subject ()
   "Return the subject for the current thread"
   (plist-get (notmuch-search-get-result) :subject))
 
-(defun notmuch-search-find-subject-region (beg end)
+(defun notmuch-search-find-subject-region (beg end &optional thread-list)
   "Return a list of authors for the current region"
-  (notmuch-search-properties-in-region :subject beg end))
+  (notmuch-search-properties-in-region :subject beg end thread-list))
 
 (defun notmuch-search-show-thread (&optional elide-toggle)
   "Display the currently selected thread."
@@ -497,9 +502,9 @@ (defun notmuch-search-set-tags (tags &optional pos)
 (defun notmuch-search-get-tags (&optional pos)
   (plist-get (notmuch-search-get-result pos) :tags))
 
-(defun notmuch-search-get-tags-region (beg end)
+(defun notmuch-search-get-tags-region (beg end &optional thread-list)
   (let (output)
-(notmuch-search-foreach-result beg end
+(notmuch-search-foreach-result beg end thread-list
   (lambda ()
(setq output (append output (notmuch-search-get-tags)
 output))
@@ -507,24 +512,29 @@ (defun notmuch-search-get-tags-region (beg end)
 (defun notmuch-search-interactive-region ()
   "Return the bounds of the current interactive region.
 
-This returns (BEG END), where BEG and END are the bounds of the
-region if the region is active, or both `point' otherwise."
+This returns (BEG END THREAD-LIST), where BEG and END are the
+bounds of the region if the region is active, or both `point'
+otherwise and THREAD-LIST i

[WIP PATCH 0/4] Add a mark thread option

2014-04-22 Thread Mark Walters
Allow users to mark threads in the search buffer and then apply
tagging operations to all marked threads.

This was requested on irc and is also something I have wanted several times.

Patch 1 is a cleanup which simplifies the existing code (imo) and
makes the subsequent patches easier.

Patch 2 is large but mostly just passing an argument all the way
throught the call chain.

Patch 3 and 4 do the actual logic.

At the moment the best way to clear all markings is to refresh the
buffer. Maybe that should change (do we even want refresh to clear
markings?)

On light testing it seems to work.

Best wishes

Mark

Mark Walters (4):
  emacs: search: tidy notmuch-search-foreach-result
  emacs: search: add a marked thread variable and add to relevant
functions
  emacs: search: split foreach-result into list and region variants
  emacs: search: add key binding for marking a thread

 emacs/notmuch.el |  151 ++
 1 file changed, 95 insertions(+), 56 deletions(-)

-- 
1.7.10.4

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


[PATCH 1/1] building from git: use --abbrev=7 for version string

2014-04-22 Thread Tomi Ollila
Users may have set core.abbrev=n, where n != 7 in their git config
file(s) which would give them different than expected version strings
when building notmuch from git. This fixes the commit hash part of
version string to 7 hexadecimal values.
---

tested with:
git config core.abbrev 12
git describe
rm version.stamp
make
cat version.stamp
git reset --hard origin/master
make
cat version.stamp

.local | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile.local b/Makefile.local
index 877a979..6e78368 100644
--- a/Makefile.local
+++ b/Makefile.local
@@ -21,7 +21,7 @@ endif
 VERSION:=$(shell cat ${srcdir}/version)
 ifeq ($(filter release release-message pre-release 
update-versions,$(MAKECMDGOALS)),)
 ifeq ($(IS_GIT),yes)
-VERSION:=$(shell git describe --match '[0-9.]*'|sed -e s/_/~/ -e s/-/+/ -e 
s/-/~/)
+VERSION:=$(shell git describe --abbrev=7 --match '[0-9.]*'|sed -e s/_/~/ -e 
s/-/+/ -e s/-/~/)
 # Write the file 'version.stamp' in case its contents differ from $(VERSION)
 FILE_VERSION:=$(shell test -f version.stamp && read vs < version.stamp || vs=; 
echo $$vs)
 ifneq ($(FILE_VERSION),$(VERSION))
-- 
1.9.0

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


Re: 0.18: call for NEWS, feature freeze April 21

2014-04-22 Thread David Bremner
David Bremner  writes:

> Hi Gang;
>
> We're overdue for a release. I'd like to feature freeze on April 21 and
> release not too long after that. I ran through the commits since 0.17
> and we are missing quite a few NEWS items.  

We are still missing some NEWS items, but I tagged 0.18_rc0 
(and did a corresponding upload to Debian experimental).

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