[PATCH v10 1/2] emacs: User-defined sections in notmuch-hello

2012-03-07 Thread Pieter Praet
On Thu, 01 Mar 2012 08:36:33 -0400, David Bremner  wrote:
> 
> Pushed, finally. Thanks for both of your hard work on this.
>

625 lines changed (425 added, 200 removed), in a *single* commit ?

It's a useful bit of functionality which definitely deserves to be
included, and I do recognize and appreciate all the hard work that
went into it, but... am I the only one who was a bit surprised to
see this patch being applied [1] as-is?

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


Peace

-- 
Pieter

[1] commit 3557acab


plans for 0.12

2012-03-07 Thread Pieter Praet
On Thu, 01 Mar 2012 18:43:50 -0400, David Bremner  wrote:
> On Thu, 01 Mar 2012 22:21:29 +0100, Pieter Praet  wrote:
> > 
> > Some of the features added/refactored post-0.11.1 don't have any
> > test coverage yet.  Should they, before wrapping up 0.12 ?
> > (not a rhetorical question, I'm genuinely asking for opinions)
> > 
> 
> Hi Pieter;
> 
> My initial answer is probably not. I see the tests as mainly useful
> during development, for detecting regressions. I think most people doing
> development will be working from git, rather than the distribution
> tarballs we ship.   
> 
> On the other hand, adding tests is also not that risky, so if the
> concensus is strongly in favour of integrating them pre 0.12, and
> somebody wants to review them all, then I'm willing to consider it.
>

Fair enough.

Just in case anyone considers them beneficial and/or is willing to
review (whether it be for inclusion in 0.12 or later), I've gotten
rid of the merge conflict by moving the last test to a new file
called `emacs-search' [1] (also see [2]).  Other than that, it
remains unchanged.

> d


Peace

-- 
Pieter

[1] id:"1331149792-17192-1-git-send-email-pieter at praet.org"
[2] id:"87aa47euao.fsf at praet.org"


[PATCH v4] test: emacs: new test "notmuch-search: change tags of all matching messages"

2012-03-07 Thread Pieter Praet
* test/emacs-search:

  - New subtest "notmuch-search: change tags of all matching messages":
`notmuch-search-tag-all' (bound to "*") adds and removes tags
to/from all messages which match the query used to populate the
current search buffer.
---

Moved to a separate file to prevent a merge conflict when applied in
conjunction with the patches listed @ id:"877gz4dnl2.fsf at praet.org".


 test/emacs-search |   48 
 test/notmuch-test |1 +
 2 files changed, 49 insertions(+), 0 deletions(-)
 create mode 100755 test/emacs-search

diff --git a/test/emacs-search b/test/emacs-search
new file mode 100755
index 000..1cd8a89
--- /dev/null
+++ b/test/emacs-search
@@ -0,0 +1,48 @@
+#!/usr/bin/env bash
+
+test_description="Emacs notmuch-search-mode"
+. test-lib.sh
+
+EXPECTED=$TEST_DIRECTORY/emacs-show.expected-output
+
+add_email_corpus
+
+
+test_begin_subtest "notmuch-search: change tags of all matching messages"
+old_tag="inbox"
+new_tag="xobni"
+filter="AND from:cworth"
+
+# Get initial tag counts and prevent false positives/negatives
+old_tag_count_1=$(notmuch count tag:"${old_tag}" "${filter}")
+new_tag_count_1=$(notmuch count tag:"${new_tag}" "${filter}")
+test "${old_tag_count_1}" = "0" && old_tag_count_1="Need >0 matches!"
+test "${new_tag_count_1}" = "0" || new_tag_count_1="Need 0 matches!"
+
+# Change tags of all matching messages and get tag counts
+test_emacs "(notmuch-search \"tag:${old_tag} ${filter}\")
+   (notmuch-test-wait)
+   (notmuch-search-tag-all \"-${old_tag}\" \"+${new_tag}\")"
+old_tag_count_2=$(notmuch count tag:"${old_tag}" "${filter}")
+new_tag_count_2=$(notmuch count tag:"${new_tag}" "${filter}")
+
+# Revert tag changes and get tag counts
+test_emacs "(notmuch-search \"tag:${new_tag} ${filter}\")
+   (notmuch-test-wait)
+   (notmuch-search-tag-all \"+${old_tag}\" \"-${new_tag}\")"
+old_tag_count_3=$(notmuch count tag:"${old_tag}" "${filter}")
+new_tag_count_3=$(notmuch count tag:"${new_tag}" "${filter}")
+
+# ... and verify the results
+output="
+before:   old:${old_tag_count_1} new:${new_tag_count_1}
+after:old:${old_tag_count_2} new:${new_tag_count_2}
+restored: old:${old_tag_count_3} new:${new_tag_count_3}"
+expected="
+before:   old:${old_tag_count_1} new:0
+after:old:0 new:${old_tag_count_1}
+restored: old:${old_tag_count_1} new:0"
+test_expect_equal "$output" "$expected"
+
+
+test_done
diff --git a/test/notmuch-test b/test/notmuch-test
index e14d34e..81d0d7f 100755
--- a/test/notmuch-test
+++ b/test/notmuch-test
@@ -54,6 +54,7 @@ TESTS="
   argument-parsing
   emacs-test-functions
   emacs-address-cleaning
+  emacs-search
   emacs-show
 "
 TESTS=${NOTMUCH_TESTS:=$TESTS}
-- 
1.7.8.1



[PATCH v4] test: emacs: new test notmuch-search: change tags of all matching messages

2012-03-07 Thread Pieter Praet
* test/emacs-search:

  - New subtest notmuch-search: change tags of all matching messages:
`notmuch-search-tag-all' (bound to *) adds and removes tags
to/from all messages which match the query used to populate the
current search buffer.
---

Moved to a separate file to prevent a merge conflict when applied in
conjunction with the patches listed @ id:877gz4dnl2@praet.org.


 test/emacs-search |   48 
 test/notmuch-test |1 +
 2 files changed, 49 insertions(+), 0 deletions(-)
 create mode 100755 test/emacs-search

diff --git a/test/emacs-search b/test/emacs-search
new file mode 100755
index 000..1cd8a89
--- /dev/null
+++ b/test/emacs-search
@@ -0,0 +1,48 @@
+#!/usr/bin/env bash
+
+test_description=Emacs notmuch-search-mode
+. test-lib.sh
+
+EXPECTED=$TEST_DIRECTORY/emacs-show.expected-output
+
+add_email_corpus
+
+
+test_begin_subtest notmuch-search: change tags of all matching messages
+old_tag=inbox
+new_tag=xobni
+filter=AND from:cworth
+
+# Get initial tag counts and prevent false positives/negatives
+old_tag_count_1=$(notmuch count tag:${old_tag} ${filter})
+new_tag_count_1=$(notmuch count tag:${new_tag} ${filter})
+test ${old_tag_count_1} = 0  old_tag_count_1=Need 0 matches!
+test ${new_tag_count_1} = 0 || new_tag_count_1=Need 0 matches!
+
+# Change tags of all matching messages and get tag counts
+test_emacs (notmuch-search \tag:${old_tag} ${filter}\)
+   (notmuch-test-wait)
+   (notmuch-search-tag-all \-${old_tag}\ \+${new_tag}\)
+old_tag_count_2=$(notmuch count tag:${old_tag} ${filter})
+new_tag_count_2=$(notmuch count tag:${new_tag} ${filter})
+
+# Revert tag changes and get tag counts
+test_emacs (notmuch-search \tag:${new_tag} ${filter}\)
+   (notmuch-test-wait)
+   (notmuch-search-tag-all \+${old_tag}\ \-${new_tag}\)
+old_tag_count_3=$(notmuch count tag:${old_tag} ${filter})
+new_tag_count_3=$(notmuch count tag:${new_tag} ${filter})
+
+# ... and verify the results
+output=
+before:   old:${old_tag_count_1} new:${new_tag_count_1}
+after:old:${old_tag_count_2} new:${new_tag_count_2}
+restored: old:${old_tag_count_3} new:${new_tag_count_3}
+expected=
+before:   old:${old_tag_count_1} new:0
+after:old:0 new:${old_tag_count_1}
+restored: old:${old_tag_count_1} new:0
+test_expect_equal $output $expected
+
+
+test_done
diff --git a/test/notmuch-test b/test/notmuch-test
index e14d34e..81d0d7f 100755
--- a/test/notmuch-test
+++ b/test/notmuch-test
@@ -54,6 +54,7 @@ TESTS=
   argument-parsing
   emacs-test-functions
   emacs-address-cleaning
+  emacs-search
   emacs-show
 
 TESTS=${NOTMUCH_TESTS:=$TESTS}
-- 
1.7.8.1

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


Re: plans for 0.12

2012-03-07 Thread Pieter Praet
On Thu, 01 Mar 2012 18:43:50 -0400, David Bremner da...@tethera.net wrote:
 On Thu, 01 Mar 2012 22:21:29 +0100, Pieter Praet pie...@praet.org wrote:
  
  Some of the features added/refactored post-0.11.1 don't have any
  test coverage yet.  Should they, before wrapping up 0.12 ?
  (not a rhetorical question, I'm genuinely asking for opinions)
  
 
 Hi Pieter;
 
 My initial answer is probably not. I see the tests as mainly useful
 during development, for detecting regressions. I think most people doing
 development will be working from git, rather than the distribution
 tarballs we ship.   
 
 On the other hand, adding tests is also not that risky, so if the
 concensus is strongly in favour of integrating them pre 0.12, and
 somebody wants to review them all, then I'm willing to consider it.


Fair enough.

Just in case anyone considers them beneficial and/or is willing to
review (whether it be for inclusion in 0.12 or later), I've gotten
rid of the merge conflict by moving the last test to a new file
called `emacs-search' [1] (also see [2]).  Other than that, it
remains unchanged.

 d


Peace

-- 
Pieter

[1] id:1331149792-17192-1-git-send-email-pie...@praet.org
[2] id:87aa47euao@praet.org
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH v10 1/2] emacs: User-defined sections in notmuch-hello

2012-03-07 Thread Pieter Praet
On Thu, 01 Mar 2012 08:36:33 -0400, David Bremner da...@tethera.net wrote:
 
 Pushed, finally. Thanks for both of your hard work on this.


625 lines changed (425 added, 200 removed), in a *single* commit ?

It's a useful bit of functionality which definitely deserves to be
included, and I do recognize and appreciate all the hard work that
went into it, but... am I the only one who was a bit surprised to
see this patch being applied [1] as-is?

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


Peace

-- 
Pieter

[1] commit 3557acab
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] NEWS: add entry for `notmuch-show-stash-mlarchive-link{, -and-go}'

2012-03-01 Thread Pieter Praet
---
 NEWS |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/NEWS b/NEWS
index 8fb2f24..a739914 100644
--- a/NEWS
+++ b/NEWS
@@ -80,6 +80,12 @@ Attachment buttons can be used to view or save attachments.
   button 1 saves the attachment but this is customisable (option
   Notmuch Show Part Button Default Action).

+New functions
+
+  `notmuch-show-stash-mlarchive-link{,-and-go}' allow stashing and
+  optionally visiting a URI to the current message at one of a number
+  of Mailing List Archives.
+
 Library changes
 ---

-- 
1.7.8.1



plans for 0.12

2012-03-01 Thread Pieter Praet
On Sat, 25 Feb 2012 10:27:02 -0400, David Bremner  wrote:
> 
> I would like to start a freeze (i.e. merge master to release) for 0.12
> within the next week, say March 1 for an easy to remember date.
> 
> If you have suggestions for things that "should really go in", feel free
> to follow up. The main point here is bug fixes, or features which are
> there in a kindof half baked way.
>

Some of the features added/refactored post-0.11.1 don't have any
test coverage yet.  Should they, before wrapping up 0.12 ?
(not a rhetorical question, I'm genuinely asking for opinions)


Anyways, I've taken the liberty of tagging the following patches '0.12':

- test: emacs: toggle processing of cryptographic MIME parts in `notmuch-show'
  - id:"1329684990-12504-2-git-send-email-pieter at praet.org"
- test: emacs: toggle eliding of non-matching messages in `notmuch-show'
  - id:"1329684990-12504-3-git-send-email-pieter at praet.org"
- test: emacs: toggle thread content indentation in `notmuch-show'
  - id:"1329684990-12504-4-git-send-email-pieter at praet.org"

- test: emacs: new tests "notmuch-show: {add,remove} multiple tags {to,from} 
single message"
  - id:"1330122640-18895-2-git-send-email-pieter at praet.org"
- test: emacs: new test "notmuch-show: change tags of all messages in current 
buffer"
  - id:"1330122640-18895-3-git-send-email-pieter at praet.org"

- test: emacs: new test "notmuch-search: change tags of all matching messages"
  - id:"1329936867-923-1-git-send-email-pieter at praet.org"

If applied in that order, the last one needs to be applied with the
`--3way' option, which results in an easily resolved merge conflict,
but if needed, I'll rebase it.


> Bug fix wise, I know about 
>   
>   id:"1330068983-4483-1-git-send-email-sojkam1 at fel.cvut.cz"
> 
> This could use some review.
> 
> It has also been some chatter that either (the next iteration of)
> 
>id:"1329296619-7463-1-git-send-email-markwalters1009 at gmail.com" 
> 
> Should go in, or we should revert amdragon's exclude stuff. 
> 
> I don't have strong feelings either way, except it is somewhat late in
> the day for a large(ish) and complicated series.
> 
> There are several other patch series that look ready from a review point
> of view, but I'd rather have them pushed earlier in the release cycle
> (or at least I don't see a hurry). For example 
> 
>id:"1329490088-8323-2-git-send-email-dmitry.kurochkin at gmail.com"
>id:"1329697590-7404-1-git-send-email-amdragon at mit.edu"
> 
> My (tentative) plan is to push those once I have branched for release.
> ___
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


Peace

-- 
Pieter


[PATCH] emacs: Mention race condition safety in user visible documentation

2012-03-01 Thread Pieter Praet
On Wed, 29 Feb 2012 22:49:46 -0400, David Bremner  wrote:
> On Tue, 21 Feb 2012 10:15:08 +0100, Michal Sojka  
> wrote:
> > -- >8 --
> > Subject: [PATCH] emacs: Clarify description of thread manipulating functions
> > 
> > It is not clear whether the term "thread" refers to the thread in the
> > database or to the thread currently shown in a buffer. Those two
> > meanings may refer to different sets of messages, e.g. when a new email
> > is added to the database while the buffer shows the state before the new
> > email arrived.
> 
> (will be) pushed.
> 
> For future reference, it's slightly inconvenient for me to use "git am
> -c". Not a big deal, but a sequence of those would make me cry...
>

Something like this might help save you some time:
(assuming you'd rather not leave Emacs to apply patches)

  #+begin_src emacs-lisp
(defvar praet/projects
  '(("notmuch at notmuchmail.org" . "~/src/dev/notmuch/")
("foo at bar.org" . "~/src/dev/foobar/")))

(defun praet/notmuch-patch-apply ( all-open)
  "Apply a patch from `notmuch-show-mode' using git-am(1).
If ALL-OPEN is non-nil, (try to) apply all open messages."
  (interactive "P")
  (let* ((msg (notmuch-show-get-message-id t))
 (rcpts (concat (notmuch-show-get-to)
(notmuch-show-get-cc)))
 (projs (loop for project in praet/projects
  if (string-match (car project) rcpts)
  collect (cdr project)))
 (proj (if (> (length projs) 1)
   (ido-completing-read "Apply in: " projs)
 (car projs)))
 (cmd "git am --abort ; git am")
 (optargs '("--signoff" "--3way" "--scissors"))
 (args (read-string "Args: " nil '(optargs . 0
(message "Applying in '%s': '%s' (using '%s %s')"
 proj msg cmd args)
(notmuch-show-pipe-message all-open
 (concat "(cd " proj " && (" cmd " " args ")" ")"

(define-key notmuch-show-mode-map (kbd "C-c p a")
  'praet/notmuch-patch-apply)
  #+end_src


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


Peace

-- 
Pieter


[PATCH v6 1/3] emacs: `notmuch-show-get-message-id': optionally return Message-Id sans prefix

2012-03-01 Thread Pieter Praet
On Wed, 29 Feb 2012 08:19:34 -0400, David Bremner  wrote:
> On Tue, 28 Feb 2012 19:40:04 +0100, Pieter Praet  wrote:
> > 
> > Though I couldn't help but notice (it's a curse...) that patch #3
> > seems to have gained an extra space in its commit message subject:
> > 
> >   Original (id:"1329684627-10708-4-git-send-email-pieter at praet.org"):
> > emacs: add `notmuch-show-stash-mlarchive-link{,-and-go}'
> >   ^
> 
> I don't have any applypatch-msg hook. I am using 
>   "notmuch show --format=raw $messageid | git am -" to
> apply the patch.  
> 
> I looked at the file on disk, and something is wrapping the subject
> there.  Perhaps somebody's unwrapping code is buggy? I'm not sure what's
> at fault here; [...]

TL;DR:  Doesn't seem like there's much we can do about it...


According to RFC 2822 section 2.2.3 [1], header fields should be folded
by inserting a CRLF right before the last whitespace char before the
line exceeds 78 characters, and when a field contains comma-separated
values (which is somewhat applicable in this case), it should be folded
by inserting a CRLF right after a comma.

Now, the issue is that unfolding is accomplished by simply removing any
CRLF that is immediately followed by a whitespace char:

If the subject headers of those patches were folded by simply inserting
a CRLF, they couldn't possibly be unfolded again as there wouldn't be a
whitespace char right after the CRLF, so Mailman seems to have helpfully
inserted a tab...


Here's one of those patches at a number of archives:

- http://notmuchmail.org/pipermail/notmuch/2012/009575.html
- http://mid.gmane.org/1329684627-10708-4-git-send-email-pieter at praet.org
- 
http://mail-archive.com/search?l=mid=1329684627-10708-4-git-send-email-pieter 
at praet.org

As you can see (in the source of those pages), both Pipermail and Gmane
unfold the subject header by simply removing the line break, and at The
Mail Archive, the tab is also replaced by a space.  I assume the latter
also happens in gmime ?


So, I guess I'll just have to learn to live with it... :)


> [...] maybe you could experiment with applying the the patches
> from the list and let me know if e.g. going from files is better than
> using "notmuch show --format=raw".
>

Based on my (admittedly very superficial) analysis of the problem,
that won't do us any good wrt this issue, unfortunately...

But it *would* buy us a (slight) performance increase, so if/when my
patch to `notmuch-show-mapc' [2] goes in, we might want to consider
making `notmuch-show-pipe-message' use `notmuch-show-get-filename'
instead of `notmuch-show-get-message-{id,ids-for-open-messages}'.


> d
> 
> 


Peace

-- 
Pieter

[1] http://tools.ietf.org/html/rfc2822.html#section-2.2.3
[2] id:"1330122640-18895-5-git-send-email-pieter at praet.org"


Re: [PATCH v6 1/3] emacs: `notmuch-show-get-message-id': optionally return Message-Id sans prefix

2012-03-01 Thread Pieter Praet
On Wed, 29 Feb 2012 08:19:34 -0400, David Bremner da...@tethera.net wrote:
 On Tue, 28 Feb 2012 19:40:04 +0100, Pieter Praet pie...@praet.org wrote:
  
  Though I couldn't help but notice (it's a curse...) that patch #3
  seems to have gained an extra space in its commit message subject:
  
Original (id:1329684627-10708-4-git-send-email-pie...@praet.org):
  emacs: add `notmuch-show-stash-mlarchive-link{,-and-go}'
^
 
 I don't have any applypatch-msg hook. I am using 
   notmuch show --format=raw $messageid | git am - to
 apply the patch.  
 
 I looked at the file on disk, and something is wrapping the subject
 there.  Perhaps somebody's unwrapping code is buggy? I'm not sure what's
 at fault here; [...]

TL;DR:  Doesn't seem like there's much we can do about it...


According to RFC 2822 section 2.2.3 [1], header fields should be folded
by inserting a CRLF right before the last whitespace char before the
line exceeds 78 characters, and when a field contains comma-separated
values (which is somewhat applicable in this case), it should be folded
by inserting a CRLF right after a comma.

Now, the issue is that unfolding is accomplished by simply removing any
CRLF that is immediately followed by a whitespace char:

If the subject headers of those patches were folded by simply inserting
a CRLF, they couldn't possibly be unfolded again as there wouldn't be a
whitespace char right after the CRLF, so Mailman seems to have helpfully
inserted a tab...


Here's one of those patches at a number of archives:

- http://notmuchmail.org/pipermail/notmuch/2012/009575.html
- http://mid.gmane.org/1329684627-10708-4-git-send-email-pie...@praet.org
- 
http://mail-archive.com/search?l=midq=1329684627-10708-4-git-send-email-pie...@praet.org

As you can see (in the source of those pages), both Pipermail and Gmane
unfold the subject header by simply removing the line break, and at The
Mail Archive, the tab is also replaced by a space.  I assume the latter
also happens in gmime ?


So, I guess I'll just have to learn to live with it... :)


 [...] maybe you could experiment with applying the the patches
 from the list and let me know if e.g. going from files is better than
 using notmuch show --format=raw.


Based on my (admittedly very superficial) analysis of the problem,
that won't do us any good wrt this issue, unfortunately...

But it *would* buy us a (slight) performance increase, so if/when my
patch to `notmuch-show-mapc' [2] goes in, we might want to consider
making `notmuch-show-pipe-message' use `notmuch-show-get-filename'
instead of `notmuch-show-get-message-{id,ids-for-open-messages}'.


 d
 
 


Peace

-- 
Pieter

[1] http://tools.ietf.org/html/rfc2822.html#section-2.2.3
[2] id:1330122640-18895-5-git-send-email-pie...@praet.org
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] emacs: Mention race condition safety in user visible documentation

2012-03-01 Thread Pieter Praet
On Wed, 29 Feb 2012 22:49:46 -0400, David Bremner da...@tethera.net wrote:
 On Tue, 21 Feb 2012 10:15:08 +0100, Michal Sojka sojk...@fel.cvut.cz wrote:
  -- 8 --
  Subject: [PATCH] emacs: Clarify description of thread manipulating functions
  
  It is not clear whether the term thread refers to the thread in the
  database or to the thread currently shown in a buffer. Those two
  meanings may refer to different sets of messages, e.g. when a new email
  is added to the database while the buffer shows the state before the new
  email arrived.
 
 (will be) pushed.
 
 For future reference, it's slightly inconvenient for me to use git am
 -c. Not a big deal, but a sequence of those would make me cry...


Something like this might help save you some time:
(assuming you'd rather not leave Emacs to apply patches)

  #+begin_src emacs-lisp
(defvar praet/projects
  '((notmuch@notmuchmail.org . ~/src/dev/notmuch/)
(f...@bar.org . ~/src/dev/foobar/)))

(defun praet/notmuch-patch-apply (optional all-open)
  Apply a patch from `notmuch-show-mode' using git-am(1).
If ALL-OPEN is non-nil, (try to) apply all open messages.
  (interactive P)
  (let* ((msg (notmuch-show-get-message-id t))
 (rcpts (concat (notmuch-show-get-to)
(notmuch-show-get-cc)))
 (projs (loop for project in praet/projects
  if (string-match (car project) rcpts)
  collect (cdr project)))
 (proj (if ( (length projs) 1)
   (ido-completing-read Apply in:  projs)
 (car projs)))
 (cmd git am --abort ; git am)
 (optargs '(--signoff --3way --scissors))
 (args (read-string Args:  nil '(optargs . 0
(message Applying in '%s': '%s' (using '%s %s')
 proj msg cmd args)
(notmuch-show-pipe-message all-open
 (concat (cd  proj   ( cmd   args ) )

(define-key notmuch-show-mode-map (kbd C-c p a)
  'praet/notmuch-patch-apply)
  #+end_src


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


Peace

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


Re: plans for 0.12

2012-03-01 Thread Pieter Praet
On Sat, 25 Feb 2012 10:27:02 -0400, David Bremner da...@tethera.net wrote:
 
 I would like to start a freeze (i.e. merge master to release) for 0.12
 within the next week, say March 1 for an easy to remember date.
 
 If you have suggestions for things that should really go in, feel free
 to follow up. The main point here is bug fixes, or features which are
 there in a kindof half baked way.


Some of the features added/refactored post-0.11.1 don't have any
test coverage yet.  Should they, before wrapping up 0.12 ?
(not a rhetorical question, I'm genuinely asking for opinions)


Anyways, I've taken the liberty of tagging the following patches '0.12':

- test: emacs: toggle processing of cryptographic MIME parts in `notmuch-show'
  - id:1329684990-12504-2-git-send-email-pie...@praet.org
- test: emacs: toggle eliding of non-matching messages in `notmuch-show'
  - id:1329684990-12504-3-git-send-email-pie...@praet.org
- test: emacs: toggle thread content indentation in `notmuch-show'
  - id:1329684990-12504-4-git-send-email-pie...@praet.org

- test: emacs: new tests notmuch-show: {add,remove} multiple tags {to,from} 
single message
  - id:1330122640-18895-2-git-send-email-pie...@praet.org
- test: emacs: new test notmuch-show: change tags of all messages in current 
buffer
  - id:1330122640-18895-3-git-send-email-pie...@praet.org

- test: emacs: new test notmuch-search: change tags of all matching messages
  - id:1329936867-923-1-git-send-email-pie...@praet.org

If applied in that order, the last one needs to be applied with the
`--3way' option, which results in an easily resolved merge conflict,
but if needed, I'll rebase it.


 Bug fix wise, I know about 
   
   id:1330068983-4483-1-git-send-email-sojk...@fel.cvut.cz
 
 This could use some review.
 
 It has also been some chatter that either (the next iteration of)
 
id:1329296619-7463-1-git-send-email-markwalters1...@gmail.com 
 
 Should go in, or we should revert amdragon's exclude stuff. 
 
 I don't have strong feelings either way, except it is somewhat late in
 the day for a large(ish) and complicated series.
 
 There are several other patch series that look ready from a review point
 of view, but I'd rather have them pushed earlier in the release cycle
 (or at least I don't see a hurry). For example 
 
id:1329490088-8323-2-git-send-email-dmitry.kuroch...@gmail.com
id:1329697590-7404-1-git-send-email-amdra...@mit.edu
 
 My (tentative) plan is to push those once I have branched for release.
 ___
 notmuch mailing list
 notmuch@notmuchmail.org
 http://notmuchmail.org/mailman/listinfo/notmuch


Peace

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


[PATCH] NEWS: add entry for `notmuch-show-stash-mlarchive-link{, -and-go}'

2012-03-01 Thread Pieter Praet
---
 NEWS |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/NEWS b/NEWS
index 8fb2f24..a739914 100644
--- a/NEWS
+++ b/NEWS
@@ -80,6 +80,12 @@ Attachment buttons can be used to view or save attachments.
   button 1 saves the attachment but this is customisable (option
   Notmuch Show Part Button Default Action).
 
+New functions
+
+  `notmuch-show-stash-mlarchive-link{,-and-go}' allow stashing and
+  optionally visiting a URI to the current message at one of a number
+  of Mailing List Archives.
+
 Library changes
 ---
 
-- 
1.7.8.1

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


[PATCH] doc: minor corrections in notmuch-config.1

2012-02-28 Thread Pieter Praet
On Tue, 28 Feb 2012 21:33:24 +0200, Jani Nikula  wrote:
> On Tue, 28 Feb 2012 19:42:03 +0100, Pieter Praet  wrote:
> > * man/man1/notmuch-config.1
> > 
> >   - SYNOPSIS:
> > Remove spaces in 'section.item' arg, and indicate that
> > `notmuch config set' accepts multiple value args.
> > 
> >   - DESCRIPTION:
> > Correct config option to exclude tags from search results.
> > ('search.exclude_tags' instead of 'search.exclude')
> 
> Oops, good catch. And thanks for showing that there was at least someone
> who read the patch/man. :)
>

Hehe :)

Rest assured: lack of replies != lack of readership/appreciation/scrutiny.

Also, I think I'm not the only one having a hard time shaking off the
candystore effect (so much good stuff, so little time to give it all
a try, the Paradox of Choice) whenever checking out the Notmuch ML.

Combine that with the realities of life and the need to scratch one's
own itches, and the end result is an intermittently unresponsive list.

Still the best damn list ever though... :)

> Jani.
> 
> [...]


Peace

-- 
Pieter


[PATCH v5 00/12] emacs: more flexible and consistent tagging operations

2012-02-28 Thread Pieter Praet
On Mon, 27 Feb 2012 16:50:53 +0200, Tomi Ollila  wrote:
> On Sat, 25 Feb 2012 12:20:31 -0400, David Bremner  
> wrote:
> > On Fri, 24 Feb 2012 00:07:27 +0100, Pieter Praet  
> > wrote:
> > > On Wed, 08 Feb 2012 11:58:32 -0400, David Bremner  
> > > wrote:
> > > > On Sun,  5 Feb 2012 11:13:41 +0400, Dmitry Kurochkin  > > > at gmail.com> wrote:
> > > 
> > > How about if '*' applies to all messages (as it currently does),
> > > but 'C-u *' only to open messages?  That would make more sense IMHO.
> > > 
> > > But, conforming to your original request, I've implemented the inverse.
> > > 
> > 
> > Thanks for implementing that. I could live with either way. Do other
> > people have opinions on this? My reasoning is if you descend into a
> > thread from some search page, it seems likely that you want to operate
> > on the messages matching the search.
> 
> I've pretty soon lost the original open/close status as I often navigate
> through messages by opening/closing messages, so for me not operating
> on all messages in thread is magic behaviour. In case I'd use C-u *
> I first have to check through the full thread what are the actual
> messages currently open (lots of screen scrolling :( )
>

I share your sentiment.  Also, the function is called `notmuch-show-tag-all',
so having it operate only on open messages would be counterintuitive IMO.

In other words, I think of the prefix arg as being a modifier for the
meaning of 'all'.

But either way, it's fairly trivial to invert its behavior [1].

> So, I prefer '*' operating on all messages in a thread and C-u '*'
> for all open messages in a thread.
> 
> > 
> > d
> 
> Tomi


Peace

-- 
Pieter

[1] id:"87sjhz22vw.fsf at praet.org"


[PATCH] man: document the notmuch configuration settings in notmuch-config(1)

2012-02-28 Thread Pieter Praet
On Sun, 26 Feb 2012 00:23:41 +0200, Jani Nikula  wrote:
> At the risk of duplication between the man page and the configuration
> file generated by default, document the notmuch configuration options
> in the notmuch config man page.
> 
> Existing users of notmuch should not be expected to re-generate their
> config file in order to get access to the documentation for new
> configuration options.
> 
> Include some minor fixes and cleanups while at it.
> ---

Nice!

Minor correction: the config option to exclude tags from search results
is called 'search.exclude_tags' instead of 'search.exclude'.

Patch available [1].


Peace

-- 
Pieter

[1] id:"1330454523-32613-1-git-send-email-pieter at praet.org"


[PATCH] doc: minor corrections in notmuch-config.1

2012-02-28 Thread Pieter Praet
* man/man1/notmuch-config.1

  - SYNOPSIS:
Remove spaces in 'section.item' arg, and indicate that
`notmuch config set' accepts multiple value args.

  - DESCRIPTION:
Correct config option to exclude tags from search results.
('search.exclude_tags' instead of 'search.exclude')

Also see commit bb8ab4c8.
---

See my reply to id:"1330208621-7462-1-git-send-email-jani at nikula.org".

 man/man1/notmuch-config.1 |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/man/man1/notmuch-config.1 b/man/man1/notmuch-config.1
index 0260eb7..3d69cc6 100644
--- a/man/man1/notmuch-config.1
+++ b/man/man1/notmuch-config.1
@@ -4,10 +4,10 @@ notmuch-config \- Access notmuch configuration file.
 .SH SYNOPSIS

 .B notmuch config get
-.RI  "<" section "> . <" item ">"
+.RI  "<" section ">.<" item ">"

 .B notmuch config set
-.RI  "<" section "> . <" item "> [" value "]"
+.RI  "<" section ">.<" item "> [" value " ...]"

 .SH DESCRIPTION

@@ -85,7 +85,7 @@ directory hierarchy.

 .RS 4
 .TP 4
-.B search.exclude
+.B search.exclude_tags
 A list of tags that will be excluded from search results by
 default. Using an excluded tag in a query will override that
 exclusion.
-- 
1.7.8.1


[PATCH v6 1/3] emacs: `notmuch-show-get-message-id': optionally return Message-Id sans prefix

2012-02-28 Thread Pieter Praet
On Sat, 25 Feb 2012 10:40:25 -0400, David Bremner  wrote:
> On Sun, 19 Feb 2012 21:50:25 +0100, Pieter Praet  wrote:
> > * emacs/notmuch-show.el
> > 
> >   (notmuch-show-get-message-id):
> > Add optional arg BARE.  When non-nil, return a Message-Id without
> > quotes and prefix, thus obviating the need to strip them off again
> > in various places.
> 
> Pushed all three.
>

Thanks!


Though I couldn't help but notice (it's a curse...) that patch #3
seems to have gained an extra space in its commit message subject:

  Original (id:"1329684627-10708-4-git-send-email-pieter at praet.org"):
emacs: add `notmuch-show-stash-mlarchive-link{,-and-go}'
  ^
  Pushed (commit 2f86290a):
emacs: add `notmuch-show-stash-mlarchive-link{, -and-go}'
   ^

Don't know whether or not this was accidental, but it's happened
before, with a similar commit message subject:

  Original (id:"1327292557-7701-1-git-send-email-pieter at praet.org"):
search: rename auto_exclude_tags to {search,}exclude_tags
   ^
  Pushed (commit 649a9f5f):
search: rename auto_exclude_tags to {search, }exclude_tags
^

Perhaps you're calling uncrustify(1) or something similar
from your '.git/hooks/applypatch-msg' ?

> d


Peace

-- 
Pieter


[PATCH] emacs: Mention race condition safety in user visible documentation

2012-02-28 Thread Pieter Praet
On Sat, 18 Feb 2012 23:44:18 +0100, Michal Sojka  wrote:
> After recent rework of a/A/x/X key bindings, the important paragraph in
> documentation of `notmuch-show-archive-thread' stayed hidden from users,
> because no key is bound to this function.
> 
> This patch copies the important paragraph to the documentation of
> functions currently bound to keys.
> ---

FYI, I've removed the 'needs-review' flag from this patch, as
it's obsoleted by the one @ id:"87linwsg2r.fsf at steelpick.2x.cz".

Keep in mind that one needs to run `git-am' with the '--scissors'
option when applying the latter.


Peace

-- 
Pieter


Re: [PATCH v6 1/3] emacs: `notmuch-show-get-message-id': optionally return Message-Id sans prefix

2012-02-28 Thread Pieter Praet
On Sat, 25 Feb 2012 10:40:25 -0400, David Bremner da...@tethera.net wrote:
 On Sun, 19 Feb 2012 21:50:25 +0100, Pieter Praet pie...@praet.org wrote:
  * emacs/notmuch-show.el
  
(notmuch-show-get-message-id):
  Add optional arg BARE.  When non-nil, return a Message-Id without
  quotes and prefix, thus obviating the need to strip them off again
  in various places.
 
 Pushed all three.


Thanks!


Though I couldn't help but notice (it's a curse...) that patch #3
seems to have gained an extra space in its commit message subject:

  Original (id:1329684627-10708-4-git-send-email-pie...@praet.org):
emacs: add `notmuch-show-stash-mlarchive-link{,-and-go}'
  ^
  Pushed (commit 2f86290a):
emacs: add `notmuch-show-stash-mlarchive-link{, -and-go}'
   ^

Don't know whether or not this was accidental, but it's happened
before, with a similar commit message subject:

  Original (id:1327292557-7701-1-git-send-email-pie...@praet.org):
search: rename auto_exclude_tags to {search,}exclude_tags
   ^
  Pushed (commit 649a9f5f):
search: rename auto_exclude_tags to {search, }exclude_tags
^

Perhaps you're calling uncrustify(1) or something similar
from your '.git/hooks/applypatch-msg' ?

 d


Peace

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


[PATCH] doc: minor corrections in notmuch-config.1

2012-02-28 Thread Pieter Praet
* man/man1/notmuch-config.1

  - SYNOPSIS:
Remove spaces in 'section.item' arg, and indicate that
`notmuch config set' accepts multiple value args.

  - DESCRIPTION:
Correct config option to exclude tags from search results.
('search.exclude_tags' instead of 'search.exclude')

Also see commit bb8ab4c8.
---

See my reply to id:1330208621-7462-1-git-send-email-j...@nikula.org.

 man/man1/notmuch-config.1 |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/man/man1/notmuch-config.1 b/man/man1/notmuch-config.1
index 0260eb7..3d69cc6 100644
--- a/man/man1/notmuch-config.1
+++ b/man/man1/notmuch-config.1
@@ -4,10 +4,10 @@ notmuch-config \- Access notmuch configuration file.
 .SH SYNOPSIS
 
 .B notmuch config get
-.RI   section  .  item 
+.RI   section . item 
 
 .B notmuch config set
-.RI   section  .  item  [ value ]
+.RI   section . item  [ value  ...]
 
 .SH DESCRIPTION
 
@@ -85,7 +85,7 @@ directory hierarchy.
 
 .RS 4
 .TP 4
-.B search.exclude
+.B search.exclude_tags
 A list of tags that will be excluded from search results by
 default. Using an excluded tag in a query will override that
 exclusion.
-- 
1.7.8.1
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] man: document the notmuch configuration settings in notmuch-config(1)

2012-02-28 Thread Pieter Praet
On Sun, 26 Feb 2012 00:23:41 +0200, Jani Nikula j...@nikula.org wrote:
 At the risk of duplication between the man page and the configuration
 file generated by default, document the notmuch configuration options
 in the notmuch config man page.
 
 Existing users of notmuch should not be expected to re-generate their
 config file in order to get access to the documentation for new
 configuration options.
 
 Include some minor fixes and cleanups while at it.
 ---

Nice!

Minor correction: the config option to exclude tags from search results
is called 'search.exclude_tags' instead of 'search.exclude'.

Patch available [1].


Peace

-- 
Pieter

[1] id:1330454523-32613-1-git-send-email-pie...@praet.org
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH v5 00/12] emacs: more flexible and consistent tagging operations

2012-02-28 Thread Pieter Praet
On Mon, 27 Feb 2012 16:50:53 +0200, Tomi Ollila tomi.oll...@iki.fi wrote:
 On Sat, 25 Feb 2012 12:20:31 -0400, David Bremner da...@tethera.net wrote:
  On Fri, 24 Feb 2012 00:07:27 +0100, Pieter Praet pie...@praet.org wrote:
   On Wed, 08 Feb 2012 11:58:32 -0400, David Bremner da...@tethera.net 
   wrote:
On Sun,  5 Feb 2012 11:13:41 +0400, Dmitry Kurochkin 
dmitry.kuroch...@gmail.com wrote:
   
   How about if '*' applies to all messages (as it currently does),
   but 'C-u *' only to open messages?  That would make more sense IMHO.
   
   But, conforming to your original request, I've implemented the inverse.
   
  
  Thanks for implementing that. I could live with either way. Do other
  people have opinions on this? My reasoning is if you descend into a
  thread from some search page, it seems likely that you want to operate
  on the messages matching the search.
 
 I've pretty soon lost the original open/close status as I often navigate
 through messages by opening/closing messages, so for me not operating
 on all messages in thread is magic behaviour. In case I'd use C-u *
 I first have to check through the full thread what are the actual
 messages currently open (lots of screen scrolling :( )


I share your sentiment.  Also, the function is called `notmuch-show-tag-all',
so having it operate only on open messages would be counterintuitive IMO.

In other words, I think of the prefix arg as being a modifier for the
meaning of 'all'.

But either way, it's fairly trivial to invert its behavior [1].

 So, I prefer '*' operating on all messages in a thread and C-u '*'
 for all open messages in a thread.
 
  
  d
 
 Tomi


Peace

-- 
Pieter

[1] id:87sjhz22vw@praet.org
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] doc: minor corrections in notmuch-config.1

2012-02-28 Thread Pieter Praet
On Tue, 28 Feb 2012 21:33:24 +0200, Jani Nikula j...@nikula.org wrote:
 On Tue, 28 Feb 2012 19:42:03 +0100, Pieter Praet pie...@praet.org wrote:
  * man/man1/notmuch-config.1
  
- SYNOPSIS:
  Remove spaces in 'section.item' arg, and indicate that
  `notmuch config set' accepts multiple value args.
  
- DESCRIPTION:
  Correct config option to exclude tags from search results.
  ('search.exclude_tags' instead of 'search.exclude')
 
 Oops, good catch. And thanks for showing that there was at least someone
 who read the patch/man. :)


Hehe :)

Rest assured: lack of replies != lack of readership/appreciation/scrutiny.

Also, I think I'm not the only one having a hard time shaking off the
candystore effect (so much good stuff, so little time to give it all
a try, the Paradox of Choice) whenever checking out the Notmuch ML.

Combine that with the realities of life and the need to scratch one's
own itches, and the end result is an intermittently unresponsive list.

Still the best damn list ever though... :)

 Jani.
 
 [...]


Peace

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


[PATCH v5 00/12] emacs: more flexible and consistent tagging operations

2012-02-25 Thread Pieter Praet
On Fri, 24 Feb 2012 23:38:20 +0100, Pieter Praet  wrote:
> [...]
> Same here.  In v2 [1], '*' tags all and 'C-u *' tags only open.
> 
> One can always swap the keybindings if so inclined.
>

Did I really say that?

There's only a single keybinding, so swap it with *what* ?!?  Itself ?

This should work though:

  #+begin_src emacs-lisp
(define-key notmuch-show-mode-map "*"
  (lambda (prefix  tag-changes)
(interactive
 (cons
  (not current-prefix-arg)
  (notmuch-read-tag-changes nil notmuch-show-thread-id)))
(apply 'notmuch-show-tag-all prefix tag-changes)))
  #+end_src

> [...]


Peace

-- 
Pieter


[PATCH v5 00/12] emacs: more flexible and consistent tagging operations

2012-02-24 Thread Pieter Praet
On Fri, 24 Feb 2012 14:33:35 +0400, Dmitry Kurochkin  wrote:
> On Fri, 24 Feb 2012 14:30:29 +0400, Dmitry Kurochkin  gmail.com> wrote:
> > On Fri, 24 Feb 2012 00:07:27 +0100, Pieter Praet  
> > wrote:
> > > On Wed, 08 Feb 2012 11:58:32 -0400, David Bremner  
> > > wrote:
> > > > On Sun,  5 Feb 2012 11:13:41 +0400, Dmitry Kurochkin  > > > at gmail.com> wrote:
> > > > > Changes:
> > > > > 
> > > > > v4:
> > > > > 
> > > > > * rebased on master, no conflicts so no need for another review
> > > > > 
> > > > 
> > > > I pushed this series.  
> > > > 
> > > > Maybe this was discussed already, but I think ideally * would apply only
> > > > to open messages. So consider that a feature request if someone is
> > > > looking for a project.
> > > >
> > > 
> > > How about if '*' applies to all messages (as it currently does),
> > > but 'C-u *' only to open messages?  That would make more sense IMHO.
> > > 
> > > But, conforming to your original request, I've implemented the inverse.
> > > 
> > 
> > I personally do like '*' as is and do not want to change it's behavior.
> > Though I am not against adding a prefix argument for it.
> > 
> 
> Also can you please send new patches (and patch series) in a new
> separate thread?  If they are related to another thread, you can add a
> reference.  But having multiple patch series with multiple versions in a
> single thread is very confusing IMO.
>

Since I've already soiled this thread with my initial series,
I've sent v2 [1] in reply to David's request as well, but will
make sure to start a fresh thread from now on.


> Regards,
>   Dmitry
> 
> > Regards,
> >   Dmitry
> > 
> > > Patches follow.
> > > 
> > > 
> > > > d
> > > > ___
> > > > notmuch mailing list
> > > > notmuch at notmuchmail.org
> > > > http://notmuchmail.org/mailman/listinfo/notmuch
> > > 
> > > 
> > > Peace
> > > 
> > > -- 
> > > Pieter

Thanks for all your comments!


Peace

-- 
Pieter

[1] id:"1330122640-18895-1-git-send-email-pieter at praet.org"


[PATCH v5 00/12] emacs: more flexible and consistent tagging operations

2012-02-24 Thread Pieter Praet
On Fri, 24 Feb 2012 14:30:29 +0400, Dmitry Kurochkin  wrote:
> On Fri, 24 Feb 2012 00:07:27 +0100, Pieter Praet  wrote:
> > On Wed, 08 Feb 2012 11:58:32 -0400, David Bremner  
> > wrote:
> > > On Sun,  5 Feb 2012 11:13:41 +0400, Dmitry Kurochkin  > > gmail.com> wrote:
> > > > Changes:
> > > > 
> > > > v4:
> > > > 
> > > > * rebased on master, no conflicts so no need for another review
> > > > 
> > > 
> > > I pushed this series.  
> > > 
> > > Maybe this was discussed already, but I think ideally * would apply only
> > > to open messages. So consider that a feature request if someone is
> > > looking for a project.
> > >
> > 
> > How about if '*' applies to all messages (as it currently does),
> > but 'C-u *' only to open messages?  That would make more sense IMHO.
> > 
> > But, conforming to your original request, I've implemented the inverse.
> > 
> 
> I personally do like '*' as is and do not want to change it's behavior.
> Though I am not against adding a prefix argument for it.
>

Same here.  In v2 [1], '*' tags all and 'C-u *' tags only open.

One can always swap the keybindings if so inclined.


> Regards,
>   Dmitry
> 
> > Patches follow.
> > 
> > 
> > > d
> > > ___
> > > notmuch mailing list
> > > notmuch at notmuchmail.org
> > > http://notmuchmail.org/mailman/listinfo/notmuch
> > 
> > 
> > Peace
> > 
> > -- 
> > Pieter
> ___
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


Peace

-- 
Pieter

[1] id:"1330122640-18895-1-git-send-email-pieter at praet.org"


[PATCH 6/6] emacs: `notmuch-show-tag-all' sans prefix arg only tags open messages

2012-02-24 Thread Pieter Praet
On Fri, 24 Feb 2012 14:47:30 +0400, Dmitry Kurochkin  wrote:
> On Fri, 24 Feb 2012 00:09:14 +0100, Pieter Praet  wrote:
> > * emacs/notmuch-show.el
> > 
> >   (notmuch-show-get-messages-ids):
> > New optional argument ONLY-OPEN.  If non-nil, only return
> > Message-Id's for messages which are currently visible.
> > 
> >   (notmuch-show-tag-all):
> > New optional argument IGNORE-VISIBILITY, of which the inverse is
> > passed as ONLY-OPEN argument to `notmuch-show-get-messages-ids':
> > If called with a prefix arg, affect *all* messages in the current
> > buffer.  Otherwise, only change tags of visible messages.
> > 
> >   (notmuch-show-archive-thread):
> > Update wrt changes to `notmuch-show-tag-all'.
> > 
> > * test/emacs
> > 
> >   - Subtest "notmuch-show: change tags of open messages in current buffer"
> > is no longer broken.
> > ---
> >  emacs/notmuch-show.el |   28 
> >  test/emacs|1 -
> >  2 files changed, 20 insertions(+), 9 deletions(-)
> > 
> > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> > index 4b37c77..4499fcd 100644
> > --- a/emacs/notmuch-show.el
> > +++ b/emacs/notmuch-show.el
> > @@ -1334,13 +1334,17 @@ (defun notmuch-show-get-message-id ()
> >"Return the message id of the current message."
> >(concat "id:\"" (notmuch-show-get-prop :id) "\""))
> >  
> > -(defun notmuch-show-get-messages-ids ( separator)
> > +(defun notmuch-show-get-messages-ids ( only-open separator)
> >"Return a list of Message-Id's of all messages in the current buffer.
> >  
> > +If optional argument ONLY-OPEN is non-nil, only return
> > +Message-Id's for messages which are currently visible.
> > +
> >  If provided with optional argument SEPARATOR, return a string
> >  instead, consisting of all Message-Id's separated by SEPARATOR."
> >(let ((message-ids))
> > -(notmuch-show-mapc t
> > +(notmuch-show-mapc
> > + `(if only-open (notmuch-show-message-visible-p) t)
> 
> How about changing ONLY-OPEN to a general optional PREDICATE argument
> and pass it as is to `notmuch-show-mapc'?  Please make it the last
> argument.
>

Done.


> Regards,
>   Dmitry
> 
> >   (lambda () (push (notmuch-show-get-message-id) message-ids)))
> >  (if separator
> > (mapconcat 'identity message-ids separator)
> > @@ -1628,13 +1632,21 @@ (defun notmuch-show-tag ( initial-input)
> >   initial-input (notmuch-show-get-message-id
> >  (apply 'notmuch-show-tag-message tag-changes)))
> >  
> > -(defun notmuch-show-tag-all ( tag-changes)
> > -  "Change tags for all messages in the current thread.
> > +(defun notmuch-show-tag-all ( ignore-visibility  tag-changes)
> > +  "Change tags of all open messages in the current buffer.
> > +
> > +If optional arg IGNORE-VISIBILITY is non-nil, change tags of
> > +*all* messages in the current buffer, independent of their
> > +visibility.
> >  
> >  TAG-CHANGES is a list of tag operations for `notmuch-tag'."
> > -  (interactive (notmuch-read-tag-changes nil notmuch-show-thread-id))
> > -  (apply 'notmuch-tag (notmuch-show-get-messages-ids " or ") tag-changes)
> > -  (notmuch-show-mapc t
> > +  (interactive (cons current-prefix-arg
> > +(notmuch-read-tag-changes nil notmuch-show-thread-id)))
> > +  (apply 'notmuch-tag
> > +(notmuch-show-get-messages-ids (not ignore-visibility) " or ")
> > +tag-changes)
> > +  (notmuch-show-mapc
> > +   `(if ignore-visibility t (notmuch-show-message-visible-p))
> > (lambda ()
> >   (let* ((current-tags (notmuch-show-get-tags))
> > (new-tags (notmuch-update-tags current-tags tag-changes)))
> > @@ -1719,7 +1731,7 @@ (defun notmuch-show-archive-thread ( 
> > unarchive)
> >  buffer."
> >(interactive "P")
> >(let ((op (if unarchive "+" "-")))
> > -(notmuch-show-tag-all (concat op "inbox"
> > +(notmuch-show-tag-all t (concat op "inbox"
> >  
> >  (defun notmuch-show-archive-thread-then-next ()
> >"Archive each message in thread, then show next thread from search."
> > diff --git a/test/emacs b/test/emacs
> > index 644ef59..c286ff5 100755
> > --- a/test/emacs
> > +++ b/test/emacs
> > @@ -152,7 +152,6 @@ notmuch tag +"$del_tag" -"$add_tag" -- "$query" # 
> > revert tag changes
> >  test_expect_equal "$count_changed" "$count_total" # assert that CHANGED == 
> > TOTAL
> >  
> >  test_begin_subtest "notmuch-show: change tags of open messages in current 
> > buffer"
> > -test_subtest_known_broken
> >  query="$os_x_darwin_thread"
> >  filter="from:Jiang"
> >  add_tag="notmuch-show-tag-all"
> > -- 
> > 1.7.8.1
> > 


Peace

-- 
Pieter


[PATCH 5/6] emacs: simplify `notmuch-show-get-messages-ids{, -search}'

2012-02-24 Thread Pieter Praet
On Fri, 24 Feb 2012 14:42:53 +0400, Dmitry Kurochkin  wrote:
> On Fri, 24 Feb 2012 00:09:13 +0100, Pieter Praet  wrote:
> > * emacs/notmuch-show.el
> > 
> >   (notmuch-show-get-messages-ids):
> > If provided with optional arg SEPARATOR, return a string consisting
> > of all Message-Id's, separated by SEPARATOR.  Also improve original
> > docstring wrt default return value.
> > 
> >   (notmuch-show-get-messages-ids-search):
> > Removed, as its functionality is now in `notmuch-show-get-messages-ids'.
> > 
> >   (notmuch-show-tag-all):
> > Call `notmuch-show-get-messages-ids' with SEPARATOR arg instead of
> > `notmuch-show-get-messages-ids-search'.
> > ---
> 
> There is another similar case in notmuch.el:
> `notmuch-show-get-messages-ids' and
> `notmuch-show-get-messages-ids-search'.  There may be more.
> 
> Please change them as well.
>

You mean `notmuch-search-find-thread-id-region{,-search}' ?

They aren't relevant to this series, so I'll submit a separate patch
for that (later).  A quick `rgrep' doesn't reveal any others, but if
you happen to stumble across any, feel free to point them out.

> Regards,
>   Dmitry
> 
> >  emacs/notmuch-show.el |   18 +-
> >  1 files changed, 9 insertions(+), 9 deletions(-)
> > 
> > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> > index 5fc0e43..4b37c77 100644
> > --- a/emacs/notmuch-show.el
> > +++ b/emacs/notmuch-show.el
> > @@ -1334,17 +1334,17 @@ (defun notmuch-show-get-message-id ()
> >"Return the message id of the current message."
> >(concat "id:\"" (notmuch-show-get-prop :id) "\""))
> >  
> > -(defun notmuch-show-get-messages-ids ()
> > -  "Return all message ids of messages in the current thread."
> > +(defun notmuch-show-get-messages-ids ( separator)
> > +  "Return a list of Message-Id's of all messages in the current buffer.
> > +
> > +If provided with optional argument SEPARATOR, return a string
> > +instead, consisting of all Message-Id's separated by SEPARATOR."
> >(let ((message-ids))
> >  (notmuch-show-mapc t
> >   (lambda () (push (notmuch-show-get-message-id) message-ids)))
> > -message-ids))
> > -
> > -(defun notmuch-show-get-messages-ids-search ()
> > -  "Return a search string for all message ids of messages in the
> > -current thread."
> > -  (mapconcat 'identity (notmuch-show-get-messages-ids) " or "))
> > +(if separator
> > +   (mapconcat 'identity message-ids separator)
> > +  message-ids)))
> >  
> >  ;; dme: Would it make sense to use a macro for many of these?
> >  
> > @@ -1633,7 +1633,7 @@ (defun notmuch-show-tag-all ( tag-changes)
> >  
> >  TAG-CHANGES is a list of tag operations for `notmuch-tag'."
> >(interactive (notmuch-read-tag-changes nil notmuch-show-thread-id))
> > -  (apply 'notmuch-tag (notmuch-show-get-messages-ids-search) tag-changes)
> > +  (apply 'notmuch-tag (notmuch-show-get-messages-ids " or ") tag-changes)
> >(notmuch-show-mapc t
> > (lambda ()
> >   (let* ((current-tags (notmuch-show-get-tags))
> > -- 
> > 1.7.8.1
> > 


Peace

-- 
Pieter


[PATCH 4/6] emacs: add predicate arg to `notmuch-show-mapc'

2012-02-24 Thread Pieter Praet
On Fri, 24 Feb 2012 14:39:41 +0400, Dmitry Kurochkin  wrote:
> On Fri, 24 Feb 2012 00:09:12 +0100, Pieter Praet  wrote:
> > * emacs/notmuch-show.el
> > 
> >   (notmuch-show-mapc):
> > Only call FUNCTION if new argument PREDICATE is satisfied.
> > Also correct original docstring: 's/thread/buffer/'.
> > 
> >   (notmuch-show-get-messages-ids):
> > Update wrt changes to `notmuch-show-mapc'.
> > 
> >   (notmuch-show-tag-all):
> > Update wrt changes to `notmuch-show-mapc'.
> > ---
> >  emacs/notmuch-show.el |   15 ---
> >  1 files changed, 8 insertions(+), 7 deletions(-)
> > 
> > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> > index aa9ccee..5fc0e43 100644
> > --- a/emacs/notmuch-show.el
> > +++ b/emacs/notmuch-show.el
> > @@ -1272,13 +1272,14 @@ (defun notmuch-show-goto-message-previous ()
> >  (notmuch-show-move-to-message-top)
> >  t))
> >  
> > -(defun notmuch-show-mapc (function)
> > -  "Iterate through all messages in the current thread with
> > -`notmuch-show-goto-message-next' and call FUNCTION for side
> > -effects."
> > +(defun notmuch-show-mapc (predicate function)
> 
> Please make PREDICATE optional to avoid giving t when it is not needed.
>

Done.

> I would expect PREDICATE to be a function, [...]

Well, it *can* be a function actually (see later usage in e.g.
`notmuch-show-get-messages-ids' [1]), but should be provided
as a form instead of as a quoted symbol.

> [...] but perhaps the way you
> implemented it is common in Emacs.
>

Far from it, apparently.  I did it that way to prevent `funcall' from
choking on t/nil, which -in retrospect- was rather shortsighted...

I've used a more sensible approach in v2 [2].

> Regards,
>   Dmitry
> 
> > +  "Iterate through all messages in the current buffer with
> > +`notmuch-show-goto-message-next'.  If PREDICATE is satisfied,
> > +call FUNCTION for side effects."
> >(save-excursion
> >  (goto-char (point-min))
> > -(loop do (funcall function)
> > +(loop do (if (eval predicate)
> > +(funcall function))
> >   while (notmuch-show-goto-message-next
> >  
> >  ;; Functions relating to the visibility of messages and their
> > @@ -1336,7 +1337,7 @@ (defun notmuch-show-get-message-id ()
> >  (defun notmuch-show-get-messages-ids ()
> >"Return all message ids of messages in the current thread."
> >(let ((message-ids))
> > -(notmuch-show-mapc
> > +(notmuch-show-mapc t
> >   (lambda () (push (notmuch-show-get-message-id) message-ids)))
> >  message-ids))
> >  
> > @@ -1633,7 +1634,7 @@ (defun notmuch-show-tag-all ( tag-changes)
> >  TAG-CHANGES is a list of tag operations for `notmuch-tag'."
> >(interactive (notmuch-read-tag-changes nil notmuch-show-thread-id))
> >(apply 'notmuch-tag (notmuch-show-get-messages-ids-search) tag-changes)
> > -  (notmuch-show-mapc
> > +  (notmuch-show-mapc t
> > (lambda ()
> >   (let* ((current-tags (notmuch-show-get-tags))
> > (new-tags (notmuch-update-tags current-tags tag-changes)))
> > -- 
> > 1.7.8.1
> > 


Peace

-- 
Pieter

[1] id:"1330038554-10347-6-git-send-email-pieter at praet.org"
[2] id:"1330122640-18895-5-git-send-email-pieter at praet.org"


[PATCH 1/6] test: emacs: new tests "notmuch-show: {add, remove} multiple tags {to, from} single message"

2012-02-24 Thread Pieter Praet
On Fri, 24 Feb 2012 14:35:22 +0400, Dmitry Kurochkin  wrote:
> On Fri, 24 Feb 2012 00:09:09 +0100, Pieter Praet  wrote:
> > * test/emacs:
> > 
> >   - Rename subtests "{Add,Remove} tag from notmuch-show view" to
> > "notmuch-show: {add,remove} single tag {to,from} single message"
> > to be consistent with the following tests.
> > 
> >   - New subtest "notmuch-show: add multiple tags to single message":
> > `notmuch-show-add-tag' ("+") can add multiple tags to a message.
> > 
> >   - New subtest "notmuch-show: remove multiple tags from single message":
> > `notmuch-show-remove-tag' ("-") can remove multiple tags from a message.
> > ---
> 
> Would be nice to have another patch that moves notmuch-show tests to
> emacs-show file.
>

TL;DR: It's on my todo list.

Yeah, the Emacs test series *as a whole* desperately needs some
reorganizing, not in the least because it's still severely
lacking in coverage.

Some more structure/consistency would considerably increase the
feasibility (or at least reduce the PITAness...)  of filling in
the numerous blanks and reducing duplication of effort (regarding
both hard- and wetware based cycles), as well as increasing the
likelihood that developers (not looking in any specific direction)
serve their code with a side dish of tests.

Ideally (IMHO), it would be split up into separate files by mode,
i.e. `notmuch-hello', `notmuch-search', `notmuch-show',
`notmuch-{message,mua}', and those can be further divided into
sections like navigation, tagging, visibility stuff, hooks, ...

There's probably quite a number of implicit interdependencies that
need to be taken care of though, and I (as well as others) still
have a bunch of tests waiting to be applied, so we might want to do
this gradually.


> Regards,
>   Dmitry
> 
> >  test/emacs |   16 ++--
> >  1 files changed, 14 insertions(+), 2 deletions(-)
> > 
> > diff --git a/test/emacs b/test/emacs
> > index b74cfa9..ec1dbb0 100755
> > --- a/test/emacs
> > +++ b/test/emacs
> > @@ -112,18 +112,30 @@ test_emacs "(notmuch-search \"$os_x_darwin_thread\")
> >  output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
> >  test_expect_equal "$output" "thread:XXX   2009-11-18 [4/4] Jjgod Jiang, 
> > Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues 
> > (inbox unread)"
> >  
> > -test_begin_subtest "Add tag from notmuch-show view"
> > +test_begin_subtest "notmuch-show: add single tag to single message"
> >  test_emacs "(notmuch-show \"$os_x_darwin_thread\")
> > (execute-kbd-macro \"+tag-from-show-view\")"
> >  output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
> >  test_expect_equal "$output" "thread:XXX   2009-11-18 [4/4] Jjgod Jiang, 
> > Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues 
> > (inbox tag-from-show-view unread)"
> >  
> > -test_begin_subtest "Remove tag from notmuch-show view"
> > +test_begin_subtest "notmuch-show: remove single tag from single message"
> >  test_emacs "(notmuch-show \"$os_x_darwin_thread\")
> > (execute-kbd-macro \"-tag-from-show-view\")"
> >  output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
> >  test_expect_equal "$output" "thread:XXX   2009-11-18 [4/4] Jjgod Jiang, 
> > Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues 
> > (inbox unread)"
> >  
> > +test_begin_subtest "notmuch-show: add multiple tags to single message"
> > +test_emacs "(notmuch-show \"$os_x_darwin_thread\")
> > +   (execute-kbd-macro \"+tag1-from-show-view +tag2-from-show-view\")"
> > +output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
> > +test_expect_equal "$output" "thread:XXX   2009-11-18 [4/4] Jjgod Jiang, 
> > Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues 
> > (inbox tag1-from-show-view tag2-from-show-view unread)"
> > +
> > +test_begin_subtest "notmuch-show: remove multiple tags from single message"
> > +test_emacs "(notmuch-show \"$os_x_darwin_thread\")
> > +   (execute-kbd-macro \"-tag1-from-show-view -tag2-from-show-view\")"
> > +output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
> > +test_expect_equal "$output" "thread:XXX   2009-11-18 [4/4] Jjgod Jiang, 
> > Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues 
> > (inbox unread)"
> > +
> >  test_begin_subtest "Message with .. in Message-Id:"
> >  add_message [id]=123..456 at example '[subject]="Message with .. in 
> > Message-Id"'
> >  test_emacs '(notmuch-search "id:\"123..456 at example\"")
> > -- 
> > 1.7.8.1
> > 


Peace

-- 
Pieter


[PATCH v2 6/6] emacs: `notmuch-show-tag-all' with prefix arg only tags open messages

2012-02-24 Thread Pieter Praet
* emacs/notmuch-show.el

  (notmuch-show-get-messages-ids):
If provided with optional argument PREDICATE, only return
Message-Id's of messages for which PREDICATE returns non-nil.

  (notmuch-show-tag-all):
New argument ONLY-OPEN (set to `current-prefix-arg' if running
interactively): if non-nil, only change tags of *open* messages.
Also correct original docstring: 's/thread/buffer/'.

  (notmuch-show-archive-thread):
Update wrt changes to `notmuch-show-tag-all'.

* test/emacs

  - Subtest "notmuch-show: change tags of open messages in current buffer"
is no longer broken...
---
 emacs/notmuch-show.el |   33 -
 test/emacs|1 -
 2 files changed, 24 insertions(+), 10 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 05606fc..4bd1a7c 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1339,14 +1339,18 @@ (defun notmuch-show-get-message-id ()
   "Return the message id of the current message."
   (concat "id:\"" (notmuch-show-get-prop :id) "\""))

-(defun notmuch-show-get-messages-ids ( separator)
+(defun notmuch-show-get-messages-ids ( separator predicate)
   "Return a list of Message-Id's of all messages in the current buffer.

 If provided with optional argument SEPARATOR, return a string
-instead, consisting of all Message-Id's separated by SEPARATOR."
+instead, consisting of all Message-Id's separated by SEPARATOR.
+
+If provided with optional argument PREDICATE, only return
+Message-Id's of messages for which PREDICATE returns non-nil."
   (let ((message-ids))
 (notmuch-show-mapc
- (lambda () (push (notmuch-show-get-message-id) message-ids)))
+ (lambda () (push (notmuch-show-get-message-id) message-ids))
+ predicate)
 (if separator
(mapconcat 'identity message-ids separator)
   message-ids)))
@@ -1633,18 +1637,29 @@ (defun notmuch-show-tag ( initial-input)
  initial-input (notmuch-show-get-message-id
 (apply 'notmuch-show-tag-message tag-changes)))

-(defun notmuch-show-tag-all ( tag-changes)
-  "Change tags for all messages in the current thread.
+(defun notmuch-show-tag-all (only-open  tag-changes)
+  "Change tags of all messages in the current buffer.
+
+If ONLY-OPEN is non-nil, only change tags of *open* messages in
+the current buffer.

 TAG-CHANGES is a list of tag operations for `notmuch-tag'."
-  (interactive (notmuch-read-tag-changes nil notmuch-show-thread-id))
-  (apply 'notmuch-tag (notmuch-show-get-messages-ids " or ") tag-changes)
+  (interactive (cons current-prefix-arg
+(notmuch-read-tag-changes nil notmuch-show-thread-id)))
+  (apply 'notmuch-tag
+(notmuch-show-get-messages-ids
+ " or "
+ `(lambda ()
+,(if only-open '(notmuch-show-message-visible-p) t)))
+tag-changes)
   (notmuch-show-mapc
(lambda ()
  (let* ((current-tags (notmuch-show-get-tags))
(new-tags (notmuch-update-tags current-tags tag-changes)))
(unless (equal current-tags new-tags)
-(notmuch-show-set-tags new-tags))
+(notmuch-show-set-tags new-tags
+   `(lambda ()
+  ,(if only-open '(notmuch-show-message-visible-p) t

 (defun notmuch-show-add-tag ()
   "Same as `notmuch-show-tag' but sets initial input to '+'."
@@ -1724,7 +1739,7 @@ (defun notmuch-show-archive-thread ( unarchive)
 buffer."
   (interactive "P")
   (let ((op (if unarchive "+" "-")))
-(notmuch-show-tag-all (concat op "inbox"
+(notmuch-show-tag-all nil (concat op "inbox"

 (defun notmuch-show-archive-thread-then-next ()
   "Archive each message in thread, then show next thread from search."
diff --git a/test/emacs b/test/emacs
index 9088ced..e6b0503 100755
--- a/test/emacs
+++ b/test/emacs
@@ -152,7 +152,6 @@ notmuch tag +"$del_tag" -"$add_tag" -- "$query" # revert 
tag changes
 test_expect_equal "$count_changed" "$count_total" # assert that CHANGED == 
TOTAL

 test_begin_subtest "notmuch-show: change tags of open messages in current 
buffer"
-test_subtest_known_broken
 query="$os_x_darwin_thread"
 filter="from:Jiang"
 add_tag="notmuch-show-tag-all"
-- 
1.7.8.1



[PATCH v2 5/6] emacs: simplify `notmuch-show-get-messages-ids{, -search}'

2012-02-24 Thread Pieter Praet
* emacs/notmuch-show.el

  (notmuch-show-get-messages-ids):
If provided with optional arg SEPARATOR, return a string consisting
of all Message-Id's, separated by SEPARATOR.  Also improve original
docstring wrt default return value.

  (notmuch-show-get-messages-ids-search):
Removed, as its functionality is now in `notmuch-show-get-messages-ids'.

  (notmuch-show-tag-all):
Call `notmuch-show-get-messages-ids' with SEPARATOR arg instead of
`notmuch-show-get-messages-ids-search'.
---
 emacs/notmuch-show.el |   18 +-
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 6adbdc0..05606fc 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1339,17 +1339,17 @@ (defun notmuch-show-get-message-id ()
   "Return the message id of the current message."
   (concat "id:\"" (notmuch-show-get-prop :id) "\""))

-(defun notmuch-show-get-messages-ids ()
-  "Return all message ids of messages in the current thread."
+(defun notmuch-show-get-messages-ids ( separator)
+  "Return a list of Message-Id's of all messages in the current buffer.
+
+If provided with optional argument SEPARATOR, return a string
+instead, consisting of all Message-Id's separated by SEPARATOR."
   (let ((message-ids))
 (notmuch-show-mapc
  (lambda () (push (notmuch-show-get-message-id) message-ids)))
-message-ids))
-
-(defun notmuch-show-get-messages-ids-search ()
-  "Return a search string for all message ids of messages in the
-current thread."
-  (mapconcat 'identity (notmuch-show-get-messages-ids) " or "))
+(if separator
+   (mapconcat 'identity message-ids separator)
+  message-ids)))

 ;; dme: Would it make sense to use a macro for many of these?

@@ -1638,7 +1638,7 @@ (defun notmuch-show-tag-all ( tag-changes)

 TAG-CHANGES is a list of tag operations for `notmuch-tag'."
   (interactive (notmuch-read-tag-changes nil notmuch-show-thread-id))
-  (apply 'notmuch-tag (notmuch-show-get-messages-ids-search) tag-changes)
+  (apply 'notmuch-tag (notmuch-show-get-messages-ids " or ") tag-changes)
   (notmuch-show-mapc
(lambda ()
  (let* ((current-tags (notmuch-show-get-tags))
-- 
1.7.8.1



[PATCH v2 4/6] emacs: add optional predicate arg to `notmuch-show-mapc'

2012-02-24 Thread Pieter Praet
* emacs/notmuch-show.el (notmuch-show-mapc):

  If provided with optional argument PREDICATE, only call
  FUNCTION if calling PREDICATE returns non-nil.

  Also correct original docstring: 's/thread/buffer/'.
---
 emacs/notmuch-show.el |   14 ++
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index aa9ccee..6adbdc0 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1272,13 +1272,19 @@ (defun notmuch-show-goto-message-previous ()
 (notmuch-show-move-to-message-top)
 t))

-(defun notmuch-show-mapc (function)
-  "Iterate through all messages in the current thread with
+(defun notmuch-show-mapc (function  predicate)
+  "Iterate through all messages in the current buffer with
 `notmuch-show-goto-message-next' and call FUNCTION for side
-effects."
+effects.
+
+If provided with optional argument PREDICATE, only call
+FUNCTION if calling PREDICATE returns non-nil."
   (save-excursion
 (goto-char (point-min))
-(loop do (funcall function)
+(loop do (if predicate
+(if (funcall predicate)
+(funcall function))
+  (funcall function))
  while (notmuch-show-goto-message-next

 ;; Functions relating to the visibility of messages and their
-- 
1.7.8.1



[PATCH v2 3/6] test: emacs: `notmuch-show-tag-all' with prefix arg should only tag open messages

2012-02-24 Thread Pieter Praet
* test/emacs:

  - New subtest "notmuch-show: change tags of open messages in current buffer":
When called with a prefix arg, `notmuch-show-tag-all' ("*") should only
change the tags of *open* messages.  Currently broken, fix follows later.
---
 test/emacs |   16 
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/test/emacs b/test/emacs
index d2dbafc..9088ced 100755
--- a/test/emacs
+++ b/test/emacs
@@ -151,6 +151,22 @@ count_changed=$(notmuch count -- "$query" AND 
tag:"$add_tag" AND NOT tag:"$del_t
 notmuch tag +"$del_tag" -"$add_tag" -- "$query" # revert tag changes
 test_expect_equal "$count_changed" "$count_total" # assert that CHANGED == 
TOTAL

+test_begin_subtest "notmuch-show: change tags of open messages in current 
buffer"
+test_subtest_known_broken
+query="$os_x_darwin_thread"
+filter="from:Jiang"
+add_tag="notmuch-show-tag-all"
+del_tag="inbox"
+count_total=$(notmuch count -- "$query")   # = 4
+count_match=$(notmuch count -- "$query" AND "$filter") # = 2
+test_emacs "(notmuch-search \"$query AND $filter\")
+(notmuch-test-wait)
+(notmuch-search-show-thread)
+(execute-kbd-macro \"*+$add_tag -$del_tag\")"
+count_changed=$(notmuch count -- "$query" AND tag:"$add_tag" AND NOT 
tag:"$del_tag")
+notmuch tag +"$del_tag" -"$add_tag" -- "$query" # revert tag changes
+test_expect_equal "$count_changed" "$count_match" # assert that CHANGED == 
MATCHING
+
 test_begin_subtest "Message with .. in Message-Id:"
 add_message [id]=123..456 at example '[subject]="Message with .. in 
Message-Id"'
 test_emacs '(notmuch-search "id:\"123..456 at example\"")
-- 
1.7.8.1



[PATCH v2 2/6] test: emacs: new test "notmuch-show: change tags of all messages in current buffer"

2012-02-24 Thread Pieter Praet
* test/emacs:

  New subtest "notmuch-show: change tags of all messages in current buffer":
  `notmuch-show-tag-all' ("*") changes tags of *all* messages in current buffer.
---
 test/emacs |   15 +++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/test/emacs b/test/emacs
index ec1dbb0..d2dbafc 100755
--- a/test/emacs
+++ b/test/emacs
@@ -136,6 +136,21 @@ test_emacs "(notmuch-show \"$os_x_darwin_thread\")
 output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
 test_expect_equal "$output" "thread:XXX   2009-11-18 [4/4] Jjgod Jiang, 
Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox 
unread)"

+test_begin_subtest "notmuch-show: change tags of all messages in current 
buffer"
+query="$os_x_darwin_thread"
+filter="from:Jiang"
+add_tag="notmuch-show-tag-all"
+del_tag="inbox"
+count_total=$(notmuch count -- "$query")   # = 4
+count_match=$(notmuch count -- "$query" AND "$filter") # = 2
+test_emacs "(notmuch-search \"$query AND $filter\")
+(notmuch-test-wait)
+(notmuch-search-show-thread)
+(execute-kbd-macro \"*+$add_tag -$del_tag\")"
+count_changed=$(notmuch count -- "$query" AND tag:"$add_tag" AND NOT 
tag:"$del_tag")
+notmuch tag +"$del_tag" -"$add_tag" -- "$query" # revert tag changes
+test_expect_equal "$count_changed" "$count_total" # assert that CHANGED == 
TOTAL
+
 test_begin_subtest "Message with .. in Message-Id:"
 add_message [id]=123..456 at example '[subject]="Message with .. in 
Message-Id"'
 test_emacs '(notmuch-search "id:\"123..456 at example\"")
-- 
1.7.8.1



[PATCH v2 1/6] test: emacs: new tests "notmuch-show: {add, remove} multiple tags {to, from} single message"

2012-02-24 Thread Pieter Praet
* test/emacs:

  - Rename subtests "{Add,Remove} tag from notmuch-show view" to
"notmuch-show: {add,remove} single tag {to,from} single message"
to be consistent with the following tests.

  - New subtest "notmuch-show: add multiple tags to single message":
`notmuch-show-add-tag' ("+") can add multiple tags to a message.

  - New subtest "notmuch-show: remove multiple tags from single message":
`notmuch-show-remove-tag' ("-") can remove multiple tags from a message.
---
 test/emacs |   16 ++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/test/emacs b/test/emacs
index b74cfa9..ec1dbb0 100755
--- a/test/emacs
+++ b/test/emacs
@@ -112,18 +112,30 @@ test_emacs "(notmuch-search \"$os_x_darwin_thread\")
 output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
 test_expect_equal "$output" "thread:XXX   2009-11-18 [4/4] Jjgod Jiang, 
Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox 
unread)"

-test_begin_subtest "Add tag from notmuch-show view"
+test_begin_subtest "notmuch-show: add single tag to single message"
 test_emacs "(notmuch-show \"$os_x_darwin_thread\")
(execute-kbd-macro \"+tag-from-show-view\")"
 output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
 test_expect_equal "$output" "thread:XXX   2009-11-18 [4/4] Jjgod Jiang, 
Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox 
tag-from-show-view unread)"

-test_begin_subtest "Remove tag from notmuch-show view"
+test_begin_subtest "notmuch-show: remove single tag from single message"
 test_emacs "(notmuch-show \"$os_x_darwin_thread\")
(execute-kbd-macro \"-tag-from-show-view\")"
 output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
 test_expect_equal "$output" "thread:XXX   2009-11-18 [4/4] Jjgod Jiang, 
Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox 
unread)"

+test_begin_subtest "notmuch-show: add multiple tags to single message"
+test_emacs "(notmuch-show \"$os_x_darwin_thread\")
+   (execute-kbd-macro \"+tag1-from-show-view +tag2-from-show-view\")"
+output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
+test_expect_equal "$output" "thread:XXX   2009-11-18 [4/4] Jjgod Jiang, 
Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox 
tag1-from-show-view tag2-from-show-view unread)"
+
+test_begin_subtest "notmuch-show: remove multiple tags from single message"
+test_emacs "(notmuch-show \"$os_x_darwin_thread\")
+   (execute-kbd-macro \"-tag1-from-show-view -tag2-from-show-view\")"
+output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
+test_expect_equal "$output" "thread:XXX   2009-11-18 [4/4] Jjgod Jiang, 
Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox 
unread)"
+
 test_begin_subtest "Message with .. in Message-Id:"
 add_message [id]=123..456 at example '[subject]="Message with .. in 
Message-Id"'
 test_emacs '(notmuch-search "id:\"123..456 at example\"")
-- 
1.7.8.1



[PATCH v2 0/6] `notmuch-show-tag-all' with prefix arg only tags open messages

2012-02-24 Thread Pieter Praet
Addresses Dmitry's comments [1,2,3], save for the ones that aren't
directly related to this series [4,5] and will be dealt with later.

Also made `notmuch-show-tag-all's ONLY-OPEN arg non-optional.
Otherwise it would cause issues when running non-interactively.


Peace

-- 
Pieter

[1] id:"87fwe0jz0y.fsf at gmail.com"
[2] id:"87aa48jynx.fsf at gmail.com"
[3] id:"87obsojzga.fsf at gmail.com"
[4] id:"87ipiwjz85.fsf at gmail.com"
[5] id:"87d394jyvm.fsf at gmail.com"



[PATCH 6/6] emacs: `notmuch-show-tag-all' sans prefix arg only tags open messages

2012-02-24 Thread Pieter Praet
* emacs/notmuch-show.el

  (notmuch-show-get-messages-ids):
New optional argument ONLY-OPEN.  If non-nil, only return
Message-Id's for messages which are currently visible.

  (notmuch-show-tag-all):
New optional argument IGNORE-VISIBILITY, of which the inverse is
passed as ONLY-OPEN argument to `notmuch-show-get-messages-ids':
If called with a prefix arg, affect *all* messages in the current
buffer.  Otherwise, only change tags of visible messages.

  (notmuch-show-archive-thread):
Update wrt changes to `notmuch-show-tag-all'.

* test/emacs

  - Subtest "notmuch-show: change tags of open messages in current buffer"
is no longer broken.
---
 emacs/notmuch-show.el |   28 
 test/emacs|1 -
 2 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 4b37c77..4499fcd 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1334,13 +1334,17 @@ (defun notmuch-show-get-message-id ()
   "Return the message id of the current message."
   (concat "id:\"" (notmuch-show-get-prop :id) "\""))

-(defun notmuch-show-get-messages-ids ( separator)
+(defun notmuch-show-get-messages-ids ( only-open separator)
   "Return a list of Message-Id's of all messages in the current buffer.

+If optional argument ONLY-OPEN is non-nil, only return
+Message-Id's for messages which are currently visible.
+
 If provided with optional argument SEPARATOR, return a string
 instead, consisting of all Message-Id's separated by SEPARATOR."
   (let ((message-ids))
-(notmuch-show-mapc t
+(notmuch-show-mapc
+ `(if only-open (notmuch-show-message-visible-p) t)
  (lambda () (push (notmuch-show-get-message-id) message-ids)))
 (if separator
(mapconcat 'identity message-ids separator)
@@ -1628,13 +1632,21 @@ (defun notmuch-show-tag ( initial-input)
  initial-input (notmuch-show-get-message-id
 (apply 'notmuch-show-tag-message tag-changes)))

-(defun notmuch-show-tag-all ( tag-changes)
-  "Change tags for all messages in the current thread.
+(defun notmuch-show-tag-all ( ignore-visibility  tag-changes)
+  "Change tags of all open messages in the current buffer.
+
+If optional arg IGNORE-VISIBILITY is non-nil, change tags of
+*all* messages in the current buffer, independent of their
+visibility.

 TAG-CHANGES is a list of tag operations for `notmuch-tag'."
-  (interactive (notmuch-read-tag-changes nil notmuch-show-thread-id))
-  (apply 'notmuch-tag (notmuch-show-get-messages-ids " or ") tag-changes)
-  (notmuch-show-mapc t
+  (interactive (cons current-prefix-arg
+(notmuch-read-tag-changes nil notmuch-show-thread-id)))
+  (apply 'notmuch-tag
+(notmuch-show-get-messages-ids (not ignore-visibility) " or ")
+tag-changes)
+  (notmuch-show-mapc
+   `(if ignore-visibility t (notmuch-show-message-visible-p))
(lambda ()
  (let* ((current-tags (notmuch-show-get-tags))
(new-tags (notmuch-update-tags current-tags tag-changes)))
@@ -1719,7 +1731,7 @@ (defun notmuch-show-archive-thread ( unarchive)
 buffer."
   (interactive "P")
   (let ((op (if unarchive "+" "-")))
-(notmuch-show-tag-all (concat op "inbox"
+(notmuch-show-tag-all t (concat op "inbox"

 (defun notmuch-show-archive-thread-then-next ()
   "Archive each message in thread, then show next thread from search."
diff --git a/test/emacs b/test/emacs
index 644ef59..c286ff5 100755
--- a/test/emacs
+++ b/test/emacs
@@ -152,7 +152,6 @@ notmuch tag +"$del_tag" -"$add_tag" -- "$query" # revert 
tag changes
 test_expect_equal "$count_changed" "$count_total" # assert that CHANGED == 
TOTAL

 test_begin_subtest "notmuch-show: change tags of open messages in current 
buffer"
-test_subtest_known_broken
 query="$os_x_darwin_thread"
 filter="from:Jiang"
 add_tag="notmuch-show-tag-all"
-- 
1.7.8.1



[PATCH 5/6] emacs: simplify `notmuch-show-get-messages-ids{, -search}'

2012-02-24 Thread Pieter Praet
* emacs/notmuch-show.el

  (notmuch-show-get-messages-ids):
If provided with optional arg SEPARATOR, return a string consisting
of all Message-Id's, separated by SEPARATOR.  Also improve original
docstring wrt default return value.

  (notmuch-show-get-messages-ids-search):
Removed, as its functionality is now in `notmuch-show-get-messages-ids'.

  (notmuch-show-tag-all):
Call `notmuch-show-get-messages-ids' with SEPARATOR arg instead of
`notmuch-show-get-messages-ids-search'.
---
 emacs/notmuch-show.el |   18 +-
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 5fc0e43..4b37c77 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1334,17 +1334,17 @@ (defun notmuch-show-get-message-id ()
   "Return the message id of the current message."
   (concat "id:\"" (notmuch-show-get-prop :id) "\""))

-(defun notmuch-show-get-messages-ids ()
-  "Return all message ids of messages in the current thread."
+(defun notmuch-show-get-messages-ids ( separator)
+  "Return a list of Message-Id's of all messages in the current buffer.
+
+If provided with optional argument SEPARATOR, return a string
+instead, consisting of all Message-Id's separated by SEPARATOR."
   (let ((message-ids))
 (notmuch-show-mapc t
  (lambda () (push (notmuch-show-get-message-id) message-ids)))
-message-ids))
-
-(defun notmuch-show-get-messages-ids-search ()
-  "Return a search string for all message ids of messages in the
-current thread."
-  (mapconcat 'identity (notmuch-show-get-messages-ids) " or "))
+(if separator
+   (mapconcat 'identity message-ids separator)
+  message-ids)))

 ;; dme: Would it make sense to use a macro for many of these?

@@ -1633,7 +1633,7 @@ (defun notmuch-show-tag-all ( tag-changes)

 TAG-CHANGES is a list of tag operations for `notmuch-tag'."
   (interactive (notmuch-read-tag-changes nil notmuch-show-thread-id))
-  (apply 'notmuch-tag (notmuch-show-get-messages-ids-search) tag-changes)
+  (apply 'notmuch-tag (notmuch-show-get-messages-ids " or ") tag-changes)
   (notmuch-show-mapc t
(lambda ()
  (let* ((current-tags (notmuch-show-get-tags))
-- 
1.7.8.1



[PATCH 4/6] emacs: add predicate arg to `notmuch-show-mapc'

2012-02-24 Thread Pieter Praet
* emacs/notmuch-show.el

  (notmuch-show-mapc):
Only call FUNCTION if new argument PREDICATE is satisfied.
Also correct original docstring: 's/thread/buffer/'.

  (notmuch-show-get-messages-ids):
Update wrt changes to `notmuch-show-mapc'.

  (notmuch-show-tag-all):
Update wrt changes to `notmuch-show-mapc'.
---
 emacs/notmuch-show.el |   15 ---
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index aa9ccee..5fc0e43 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1272,13 +1272,14 @@ (defun notmuch-show-goto-message-previous ()
 (notmuch-show-move-to-message-top)
 t))

-(defun notmuch-show-mapc (function)
-  "Iterate through all messages in the current thread with
-`notmuch-show-goto-message-next' and call FUNCTION for side
-effects."
+(defun notmuch-show-mapc (predicate function)
+  "Iterate through all messages in the current buffer with
+`notmuch-show-goto-message-next'.  If PREDICATE is satisfied,
+call FUNCTION for side effects."
   (save-excursion
 (goto-char (point-min))
-(loop do (funcall function)
+(loop do (if (eval predicate)
+(funcall function))
  while (notmuch-show-goto-message-next

 ;; Functions relating to the visibility of messages and their
@@ -1336,7 +1337,7 @@ (defun notmuch-show-get-message-id ()
 (defun notmuch-show-get-messages-ids ()
   "Return all message ids of messages in the current thread."
   (let ((message-ids))
-(notmuch-show-mapc
+(notmuch-show-mapc t
  (lambda () (push (notmuch-show-get-message-id) message-ids)))
 message-ids))

@@ -1633,7 +1634,7 @@ (defun notmuch-show-tag-all ( tag-changes)
 TAG-CHANGES is a list of tag operations for `notmuch-tag'."
   (interactive (notmuch-read-tag-changes nil notmuch-show-thread-id))
   (apply 'notmuch-tag (notmuch-show-get-messages-ids-search) tag-changes)
-  (notmuch-show-mapc
+  (notmuch-show-mapc t
(lambda ()
  (let* ((current-tags (notmuch-show-get-tags))
(new-tags (notmuch-update-tags current-tags tag-changes)))
-- 
1.7.8.1



[PATCH 3/6] test: emacs: `notmuch-show-tag-all' sans prefix arg should only tag open messages

2012-02-24 Thread Pieter Praet
* test/emacs:

  - Alter subtest "notmuch-show: change tags of all messages in current buffer":
Pass a prefix arg to `notmuch-show-tag-all' ("*").

  - New subtest "notmuch-show: change tags of open messages in current buffer":
When called *without* a prefix arg, `notmuch-show-tag-all' ("*") should only
change the tags of *open* messages.  Currently broken, fix follows later.
---
 test/emacs |   18 +-
 1 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/test/emacs b/test/emacs
index d2dbafc..644ef59 100755
--- a/test/emacs
+++ b/test/emacs
@@ -146,11 +146,27 @@ count_match=$(notmuch count -- "$query" AND "$filter") # 
= 2
 test_emacs "(notmuch-search \"$query AND $filter\")
 (notmuch-test-wait)
 (notmuch-search-show-thread)
-(execute-kbd-macro \"*+$add_tag -$del_tag\")"
+(execute-kbd-macro \"*+$add_tag -$del_tag\")"
 count_changed=$(notmuch count -- "$query" AND tag:"$add_tag" AND NOT 
tag:"$del_tag")
 notmuch tag +"$del_tag" -"$add_tag" -- "$query" # revert tag changes
 test_expect_equal "$count_changed" "$count_total" # assert that CHANGED == 
TOTAL

+test_begin_subtest "notmuch-show: change tags of open messages in current 
buffer"
+test_subtest_known_broken
+query="$os_x_darwin_thread"
+filter="from:Jiang"
+add_tag="notmuch-show-tag-all"
+del_tag="inbox"
+count_total=$(notmuch count -- "$query")   # = 4
+count_match=$(notmuch count -- "$query" AND "$filter") # = 2
+test_emacs "(notmuch-search \"$query AND $filter\")
+(notmuch-test-wait)
+(notmuch-search-show-thread)
+(execute-kbd-macro \"*+$add_tag -$del_tag\")"
+count_changed=$(notmuch count -- "$query" AND tag:"$add_tag" AND NOT 
tag:"$del_tag")
+notmuch tag +"$del_tag" -"$add_tag" -- "$query" # revert tag changes
+test_expect_equal "$count_changed" "$count_match" # assert that CHANGED == 
MATCHING
+
 test_begin_subtest "Message with .. in Message-Id:"
 add_message [id]=123..456 at example '[subject]="Message with .. in 
Message-Id"'
 test_emacs '(notmuch-search "id:\"123..456 at example\"")
-- 
1.7.8.1



[PATCH 2/6] test: emacs: new test "notmuch-show: change tags of all messages in current buffer"

2012-02-24 Thread Pieter Praet
* test/emacs:

  New subtest "notmuch-show: change tags of all messages in current buffer":
  `notmuch-show-tag-all' ("*") changes tags of *all* messages in current buffer.
---
 test/emacs |   15 +++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/test/emacs b/test/emacs
index ec1dbb0..d2dbafc 100755
--- a/test/emacs
+++ b/test/emacs
@@ -136,6 +136,21 @@ test_emacs "(notmuch-show \"$os_x_darwin_thread\")
 output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
 test_expect_equal "$output" "thread:XXX   2009-11-18 [4/4] Jjgod Jiang, 
Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox 
unread)"

+test_begin_subtest "notmuch-show: change tags of all messages in current 
buffer"
+query="$os_x_darwin_thread"
+filter="from:Jiang"
+add_tag="notmuch-show-tag-all"
+del_tag="inbox"
+count_total=$(notmuch count -- "$query")   # = 4
+count_match=$(notmuch count -- "$query" AND "$filter") # = 2
+test_emacs "(notmuch-search \"$query AND $filter\")
+(notmuch-test-wait)
+(notmuch-search-show-thread)
+(execute-kbd-macro \"*+$add_tag -$del_tag\")"
+count_changed=$(notmuch count -- "$query" AND tag:"$add_tag" AND NOT 
tag:"$del_tag")
+notmuch tag +"$del_tag" -"$add_tag" -- "$query" # revert tag changes
+test_expect_equal "$count_changed" "$count_total" # assert that CHANGED == 
TOTAL
+
 test_begin_subtest "Message with .. in Message-Id:"
 add_message [id]=123..456 at example '[subject]="Message with .. in 
Message-Id"'
 test_emacs '(notmuch-search "id:\"123..456 at example\"")
-- 
1.7.8.1



[PATCH 1/6] test: emacs: new tests "notmuch-show: {add, remove} multiple tags {to, from} single message"

2012-02-24 Thread Pieter Praet
* test/emacs:

  - Rename subtests "{Add,Remove} tag from notmuch-show view" to
"notmuch-show: {add,remove} single tag {to,from} single message"
to be consistent with the following tests.

  - New subtest "notmuch-show: add multiple tags to single message":
`notmuch-show-add-tag' ("+") can add multiple tags to a message.

  - New subtest "notmuch-show: remove multiple tags from single message":
`notmuch-show-remove-tag' ("-") can remove multiple tags from a message.
---
 test/emacs |   16 ++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/test/emacs b/test/emacs
index b74cfa9..ec1dbb0 100755
--- a/test/emacs
+++ b/test/emacs
@@ -112,18 +112,30 @@ test_emacs "(notmuch-search \"$os_x_darwin_thread\")
 output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
 test_expect_equal "$output" "thread:XXX   2009-11-18 [4/4] Jjgod Jiang, 
Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox 
unread)"

-test_begin_subtest "Add tag from notmuch-show view"
+test_begin_subtest "notmuch-show: add single tag to single message"
 test_emacs "(notmuch-show \"$os_x_darwin_thread\")
(execute-kbd-macro \"+tag-from-show-view\")"
 output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
 test_expect_equal "$output" "thread:XXX   2009-11-18 [4/4] Jjgod Jiang, 
Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox 
tag-from-show-view unread)"

-test_begin_subtest "Remove tag from notmuch-show view"
+test_begin_subtest "notmuch-show: remove single tag from single message"
 test_emacs "(notmuch-show \"$os_x_darwin_thread\")
(execute-kbd-macro \"-tag-from-show-view\")"
 output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
 test_expect_equal "$output" "thread:XXX   2009-11-18 [4/4] Jjgod Jiang, 
Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox 
unread)"

+test_begin_subtest "notmuch-show: add multiple tags to single message"
+test_emacs "(notmuch-show \"$os_x_darwin_thread\")
+   (execute-kbd-macro \"+tag1-from-show-view +tag2-from-show-view\")"
+output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
+test_expect_equal "$output" "thread:XXX   2009-11-18 [4/4] Jjgod Jiang, 
Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox 
tag1-from-show-view tag2-from-show-view unread)"
+
+test_begin_subtest "notmuch-show: remove multiple tags from single message"
+test_emacs "(notmuch-show \"$os_x_darwin_thread\")
+   (execute-kbd-macro \"-tag1-from-show-view -tag2-from-show-view\")"
+output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
+test_expect_equal "$output" "thread:XXX   2009-11-18 [4/4] Jjgod Jiang, 
Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox 
unread)"
+
 test_begin_subtest "Message with .. in Message-Id:"
 add_message [id]=123..456 at example '[subject]="Message with .. in 
Message-Id"'
 test_emacs '(notmuch-search "id:\"123..456 at example\"")
-- 
1.7.8.1



[PATCH v5 00/12] emacs: more flexible and consistent tagging operations

2012-02-24 Thread Pieter Praet
On Wed, 08 Feb 2012 11:58:32 -0400, David Bremner  wrote:
> On Sun,  5 Feb 2012 11:13:41 +0400, Dmitry Kurochkin  gmail.com> wrote:
> > Changes:
> > 
> > v4:
> > 
> > * rebased on master, no conflicts so no need for another review
> > 
> 
> I pushed this series.  
> 
> Maybe this was discussed already, but I think ideally * would apply only
> to open messages. So consider that a feature request if someone is
> looking for a project.
>

How about if '*' applies to all messages (as it currently does),
but 'C-u *' only to open messages?  That would make more sense IMHO.

But, conforming to your original request, I've implemented the inverse.

Patches follow.


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


Peace

-- 
Pieter


[PATCH v2 0/6] `notmuch-show-tag-all' with prefix arg only tags open messages

2012-02-24 Thread Pieter Praet
Addresses Dmitry's comments [1,2,3], save for the ones that aren't
directly related to this series [4,5] and will be dealt with later.

Also made `notmuch-show-tag-all's ONLY-OPEN arg non-optional.
Otherwise it would cause issues when running non-interactively.


Peace

-- 
Pieter

[1] id:87fwe0jz0y@gmail.com
[2] id:87aa48jynx@gmail.com
[3] id:87obsojzga@gmail.com
[4] id:87ipiwjz85@gmail.com
[5] id:87d394jyvm@gmail.com

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


[PATCH v2 2/6] test: emacs: new test notmuch-show: change tags of all messages in current buffer

2012-02-24 Thread Pieter Praet
* test/emacs:

  New subtest notmuch-show: change tags of all messages in current buffer:
  `notmuch-show-tag-all' (*) changes tags of *all* messages in current buffer.
---
 test/emacs |   15 +++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/test/emacs b/test/emacs
index ec1dbb0..d2dbafc 100755
--- a/test/emacs
+++ b/test/emacs
@@ -136,6 +136,21 @@ test_emacs (notmuch-show \$os_x_darwin_thread\)
 output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
 test_expect_equal $output thread:XXX   2009-11-18 [4/4] Jjgod Jiang, 
Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox 
unread)
 
+test_begin_subtest notmuch-show: change tags of all messages in current 
buffer
+query=$os_x_darwin_thread
+filter=from:Jiang
+add_tag=notmuch-show-tag-all
+del_tag=inbox
+count_total=$(notmuch count -- $query)   # = 4
+count_match=$(notmuch count -- $query AND $filter) # = 2
+test_emacs (notmuch-search \$query AND $filter\)
+(notmuch-test-wait)
+(notmuch-search-show-thread)
+(execute-kbd-macro \*+$add_tag -$del_tag\)
+count_changed=$(notmuch count -- $query AND tag:$add_tag AND NOT 
tag:$del_tag)
+notmuch tag +$del_tag -$add_tag -- $query # revert tag changes
+test_expect_equal $count_changed $count_total # assert that CHANGED == 
TOTAL
+
 test_begin_subtest Message with .. in Message-Id:
 add_message [id]=123..456@example '[subject]=Message with .. in Message-Id'
 test_emacs '(notmuch-search id:\123..456@example\)
-- 
1.7.8.1

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


[PATCH v2 3/6] test: emacs: `notmuch-show-tag-all' with prefix arg should only tag open messages

2012-02-24 Thread Pieter Praet
* test/emacs:

  - New subtest notmuch-show: change tags of open messages in current buffer:
When called with a prefix arg, `notmuch-show-tag-all' (*) should only
change the tags of *open* messages.  Currently broken, fix follows later.
---
 test/emacs |   16 
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/test/emacs b/test/emacs
index d2dbafc..9088ced 100755
--- a/test/emacs
+++ b/test/emacs
@@ -151,6 +151,22 @@ count_changed=$(notmuch count -- $query AND 
tag:$add_tag AND NOT tag:$del_t
 notmuch tag +$del_tag -$add_tag -- $query # revert tag changes
 test_expect_equal $count_changed $count_total # assert that CHANGED == 
TOTAL
 
+test_begin_subtest notmuch-show: change tags of open messages in current 
buffer
+test_subtest_known_broken
+query=$os_x_darwin_thread
+filter=from:Jiang
+add_tag=notmuch-show-tag-all
+del_tag=inbox
+count_total=$(notmuch count -- $query)   # = 4
+count_match=$(notmuch count -- $query AND $filter) # = 2
+test_emacs (notmuch-search \$query AND $filter\)
+(notmuch-test-wait)
+(notmuch-search-show-thread)
+(execute-kbd-macro \*+$add_tag -$del_tag\)
+count_changed=$(notmuch count -- $query AND tag:$add_tag AND NOT 
tag:$del_tag)
+notmuch tag +$del_tag -$add_tag -- $query # revert tag changes
+test_expect_equal $count_changed $count_match # assert that CHANGED == 
MATCHING
+
 test_begin_subtest Message with .. in Message-Id:
 add_message [id]=123..456@example '[subject]=Message with .. in Message-Id'
 test_emacs '(notmuch-search id:\123..456@example\)
-- 
1.7.8.1

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


[PATCH v2 4/6] emacs: add optional predicate arg to `notmuch-show-mapc'

2012-02-24 Thread Pieter Praet
* emacs/notmuch-show.el (notmuch-show-mapc):

  If provided with optional argument PREDICATE, only call
  FUNCTION if calling PREDICATE returns non-nil.

  Also correct original docstring: 's/thread/buffer/'.
---
 emacs/notmuch-show.el |   14 ++
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index aa9ccee..6adbdc0 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1272,13 +1272,19 @@ (defun notmuch-show-goto-message-previous ()
 (notmuch-show-move-to-message-top)
 t))
 
-(defun notmuch-show-mapc (function)
-  Iterate through all messages in the current thread with
+(defun notmuch-show-mapc (function optional predicate)
+  Iterate through all messages in the current buffer with
 `notmuch-show-goto-message-next' and call FUNCTION for side
-effects.
+effects.
+
+If provided with optional argument PREDICATE, only call
+FUNCTION if calling PREDICATE returns non-nil.
   (save-excursion
 (goto-char (point-min))
-(loop do (funcall function)
+(loop do (if predicate
+(if (funcall predicate)
+(funcall function))
+  (funcall function))
  while (notmuch-show-goto-message-next
 
 ;; Functions relating to the visibility of messages and their
-- 
1.7.8.1

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


[PATCH v2 6/6] emacs: `notmuch-show-tag-all' with prefix arg only tags open messages

2012-02-24 Thread Pieter Praet
* emacs/notmuch-show.el

  (notmuch-show-get-messages-ids):
If provided with optional argument PREDICATE, only return
Message-Id's of messages for which PREDICATE returns non-nil.

  (notmuch-show-tag-all):
New argument ONLY-OPEN (set to `current-prefix-arg' if running
interactively): if non-nil, only change tags of *open* messages.
Also correct original docstring: 's/thread/buffer/'.

  (notmuch-show-archive-thread):
Update wrt changes to `notmuch-show-tag-all'.

* test/emacs

  - Subtest notmuch-show: change tags of open messages in current buffer
is no longer broken...
---
 emacs/notmuch-show.el |   33 -
 test/emacs|1 -
 2 files changed, 24 insertions(+), 10 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 05606fc..4bd1a7c 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1339,14 +1339,18 @@ (defun notmuch-show-get-message-id ()
   Return the message id of the current message.
   (concat id:\ (notmuch-show-get-prop :id) \))
 
-(defun notmuch-show-get-messages-ids (optional separator)
+(defun notmuch-show-get-messages-ids (optional separator predicate)
   Return a list of Message-Id's of all messages in the current buffer.
 
 If provided with optional argument SEPARATOR, return a string
-instead, consisting of all Message-Id's separated by SEPARATOR.
+instead, consisting of all Message-Id's separated by SEPARATOR.
+
+If provided with optional argument PREDICATE, only return
+Message-Id's of messages for which PREDICATE returns non-nil.
   (let ((message-ids))
 (notmuch-show-mapc
- (lambda () (push (notmuch-show-get-message-id) message-ids)))
+ (lambda () (push (notmuch-show-get-message-id) message-ids))
+ predicate)
 (if separator
(mapconcat 'identity message-ids separator)
   message-ids)))
@@ -1633,18 +1637,29 @@ (defun notmuch-show-tag (optional initial-input)
  initial-input (notmuch-show-get-message-id
 (apply 'notmuch-show-tag-message tag-changes)))
 
-(defun notmuch-show-tag-all (rest tag-changes)
-  Change tags for all messages in the current thread.
+(defun notmuch-show-tag-all (only-open rest tag-changes)
+  Change tags of all messages in the current buffer.
+
+If ONLY-OPEN is non-nil, only change tags of *open* messages in
+the current buffer.
 
 TAG-CHANGES is a list of tag operations for `notmuch-tag'.
-  (interactive (notmuch-read-tag-changes nil notmuch-show-thread-id))
-  (apply 'notmuch-tag (notmuch-show-get-messages-ids  or ) tag-changes)
+  (interactive (cons current-prefix-arg
+(notmuch-read-tag-changes nil notmuch-show-thread-id)))
+  (apply 'notmuch-tag
+(notmuch-show-get-messages-ids
+  or 
+ `(lambda ()
+,(if only-open '(notmuch-show-message-visible-p) t)))
+tag-changes)
   (notmuch-show-mapc
(lambda ()
  (let* ((current-tags (notmuch-show-get-tags))
(new-tags (notmuch-update-tags current-tags tag-changes)))
(unless (equal current-tags new-tags)
-(notmuch-show-set-tags new-tags))
+(notmuch-show-set-tags new-tags
+   `(lambda ()
+  ,(if only-open '(notmuch-show-message-visible-p) t
 
 (defun notmuch-show-add-tag ()
   Same as `notmuch-show-tag' but sets initial input to '+'.
@@ -1724,7 +1739,7 @@ (defun notmuch-show-archive-thread (optional unarchive)
 buffer.
   (interactive P)
   (let ((op (if unarchive + -)))
-(notmuch-show-tag-all (concat op inbox
+(notmuch-show-tag-all nil (concat op inbox
 
 (defun notmuch-show-archive-thread-then-next ()
   Archive each message in thread, then show next thread from search.
diff --git a/test/emacs b/test/emacs
index 9088ced..e6b0503 100755
--- a/test/emacs
+++ b/test/emacs
@@ -152,7 +152,6 @@ notmuch tag +$del_tag -$add_tag -- $query # revert 
tag changes
 test_expect_equal $count_changed $count_total # assert that CHANGED == 
TOTAL
 
 test_begin_subtest notmuch-show: change tags of open messages in current 
buffer
-test_subtest_known_broken
 query=$os_x_darwin_thread
 filter=from:Jiang
 add_tag=notmuch-show-tag-all
-- 
1.7.8.1

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


[PATCH v2 1/6] test: emacs: new tests notmuch-show: {add, remove} multiple tags {to, from} single message

2012-02-24 Thread Pieter Praet
* test/emacs:

  - Rename subtests {Add,Remove} tag from notmuch-show view to
notmuch-show: {add,remove} single tag {to,from} single message
to be consistent with the following tests.

  - New subtest notmuch-show: add multiple tags to single message:
`notmuch-show-add-tag' (+) can add multiple tags to a message.

  - New subtest notmuch-show: remove multiple tags from single message:
`notmuch-show-remove-tag' (-) can remove multiple tags from a message.
---
 test/emacs |   16 ++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/test/emacs b/test/emacs
index b74cfa9..ec1dbb0 100755
--- a/test/emacs
+++ b/test/emacs
@@ -112,18 +112,30 @@ test_emacs (notmuch-search \$os_x_darwin_thread\)
 output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
 test_expect_equal $output thread:XXX   2009-11-18 [4/4] Jjgod Jiang, 
Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox 
unread)
 
-test_begin_subtest Add tag from notmuch-show view
+test_begin_subtest notmuch-show: add single tag to single message
 test_emacs (notmuch-show \$os_x_darwin_thread\)
(execute-kbd-macro \+tag-from-show-view\)
 output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
 test_expect_equal $output thread:XXX   2009-11-18 [4/4] Jjgod Jiang, 
Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox 
tag-from-show-view unread)
 
-test_begin_subtest Remove tag from notmuch-show view
+test_begin_subtest notmuch-show: remove single tag from single message
 test_emacs (notmuch-show \$os_x_darwin_thread\)
(execute-kbd-macro \-tag-from-show-view\)
 output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
 test_expect_equal $output thread:XXX   2009-11-18 [4/4] Jjgod Jiang, 
Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox 
unread)
 
+test_begin_subtest notmuch-show: add multiple tags to single message
+test_emacs (notmuch-show \$os_x_darwin_thread\)
+   (execute-kbd-macro \+tag1-from-show-view +tag2-from-show-view\)
+output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
+test_expect_equal $output thread:XXX   2009-11-18 [4/4] Jjgod Jiang, 
Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox 
tag1-from-show-view tag2-from-show-view unread)
+
+test_begin_subtest notmuch-show: remove multiple tags from single message
+test_emacs (notmuch-show \$os_x_darwin_thread\)
+   (execute-kbd-macro \-tag1-from-show-view -tag2-from-show-view\)
+output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
+test_expect_equal $output thread:XXX   2009-11-18 [4/4] Jjgod Jiang, 
Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox 
unread)
+
 test_begin_subtest Message with .. in Message-Id:
 add_message [id]=123..456@example '[subject]=Message with .. in Message-Id'
 test_emacs '(notmuch-search id:\123..456@example\)
-- 
1.7.8.1

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


Re: [PATCH 1/6] test: emacs: new tests notmuch-show: {add, remove} multiple tags {to, from} single message

2012-02-24 Thread Pieter Praet
On Fri, 24 Feb 2012 14:35:22 +0400, Dmitry Kurochkin 
dmitry.kuroch...@gmail.com wrote:
 On Fri, 24 Feb 2012 00:09:09 +0100, Pieter Praet pie...@praet.org wrote:
  * test/emacs:
  
- Rename subtests {Add,Remove} tag from notmuch-show view to
  notmuch-show: {add,remove} single tag {to,from} single message
  to be consistent with the following tests.
  
- New subtest notmuch-show: add multiple tags to single message:
  `notmuch-show-add-tag' (+) can add multiple tags to a message.
  
- New subtest notmuch-show: remove multiple tags from single message:
  `notmuch-show-remove-tag' (-) can remove multiple tags from a message.
  ---
 
 Would be nice to have another patch that moves notmuch-show tests to
 emacs-show file.


TL;DR: It's on my todo list.

Yeah, the Emacs test series *as a whole* desperately needs some
reorganizing, not in the least because it's still severely
lacking in coverage.

Some more structure/consistency would considerably increase the
feasibility (or at least reduce the PITAness...)  of filling in
the numerous blanks and reducing duplication of effort (regarding
both hard- and wetware based cycles), as well as increasing the
likelihood that developers (not looking in any specific direction)
serve their code with a side dish of tests.

Ideally (IMHO), it would be split up into separate files by mode,
i.e. `notmuch-hello', `notmuch-search', `notmuch-show',
`notmuch-{message,mua}', and those can be further divided into
sections like navigation, tagging, visibility stuff, hooks, ...

There's probably quite a number of implicit interdependencies that
need to be taken care of though, and I (as well as others) still
have a bunch of tests waiting to be applied, so we might want to do
this gradually.


 Regards,
   Dmitry
 
   test/emacs |   16 ++--
   1 files changed, 14 insertions(+), 2 deletions(-)
  
  diff --git a/test/emacs b/test/emacs
  index b74cfa9..ec1dbb0 100755
  --- a/test/emacs
  +++ b/test/emacs
  @@ -112,18 +112,30 @@ test_emacs (notmuch-search \$os_x_darwin_thread\)
   output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
   test_expect_equal $output thread:XXX   2009-11-18 [4/4] Jjgod Jiang, 
  Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues 
  (inbox unread)
   
  -test_begin_subtest Add tag from notmuch-show view
  +test_begin_subtest notmuch-show: add single tag to single message
   test_emacs (notmuch-show \$os_x_darwin_thread\)
  (execute-kbd-macro \+tag-from-show-view\)
   output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
   test_expect_equal $output thread:XXX   2009-11-18 [4/4] Jjgod Jiang, 
  Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues 
  (inbox tag-from-show-view unread)
   
  -test_begin_subtest Remove tag from notmuch-show view
  +test_begin_subtest notmuch-show: remove single tag from single message
   test_emacs (notmuch-show \$os_x_darwin_thread\)
  (execute-kbd-macro \-tag-from-show-view\)
   output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
   test_expect_equal $output thread:XXX   2009-11-18 [4/4] Jjgod Jiang, 
  Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues 
  (inbox unread)
   
  +test_begin_subtest notmuch-show: add multiple tags to single message
  +test_emacs (notmuch-show \$os_x_darwin_thread\)
  +   (execute-kbd-macro \+tag1-from-show-view +tag2-from-show-view\)
  +output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
  +test_expect_equal $output thread:XXX   2009-11-18 [4/4] Jjgod Jiang, 
  Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues 
  (inbox tag1-from-show-view tag2-from-show-view unread)
  +
  +test_begin_subtest notmuch-show: remove multiple tags from single message
  +test_emacs (notmuch-show \$os_x_darwin_thread\)
  +   (execute-kbd-macro \-tag1-from-show-view -tag2-from-show-view\)
  +output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
  +test_expect_equal $output thread:XXX   2009-11-18 [4/4] Jjgod Jiang, 
  Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues 
  (inbox unread)
  +
   test_begin_subtest Message with .. in Message-Id:
   add_message [id]=123..456@example '[subject]=Message with .. in 
  Message-Id'
   test_emacs '(notmuch-search id:\123..456@example\)
  -- 
  1.7.8.1
  


Peace

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


Re: [PATCH 4/6] emacs: add predicate arg to `notmuch-show-mapc'

2012-02-24 Thread Pieter Praet
On Fri, 24 Feb 2012 14:39:41 +0400, Dmitry Kurochkin 
dmitry.kuroch...@gmail.com wrote:
 On Fri, 24 Feb 2012 00:09:12 +0100, Pieter Praet pie...@praet.org wrote:
  * emacs/notmuch-show.el
  
(notmuch-show-mapc):
  Only call FUNCTION if new argument PREDICATE is satisfied.
  Also correct original docstring: 's/thread/buffer/'.
  
(notmuch-show-get-messages-ids):
  Update wrt changes to `notmuch-show-mapc'.
  
(notmuch-show-tag-all):
  Update wrt changes to `notmuch-show-mapc'.
  ---
   emacs/notmuch-show.el |   15 ---
   1 files changed, 8 insertions(+), 7 deletions(-)
  
  diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
  index aa9ccee..5fc0e43 100644
  --- a/emacs/notmuch-show.el
  +++ b/emacs/notmuch-show.el
  @@ -1272,13 +1272,14 @@ (defun notmuch-show-goto-message-previous ()
   (notmuch-show-move-to-message-top)
   t))
   
  -(defun notmuch-show-mapc (function)
  -  Iterate through all messages in the current thread with
  -`notmuch-show-goto-message-next' and call FUNCTION for side
  -effects.
  +(defun notmuch-show-mapc (predicate function)
 
 Please make PREDICATE optional to avoid giving t when it is not needed.


Done.

 I would expect PREDICATE to be a function, [...]

Well, it *can* be a function actually (see later usage in e.g.
`notmuch-show-get-messages-ids' [1]), but should be provided
as a form instead of as a quoted symbol.

 [...] but perhaps the way you
 implemented it is common in Emacs.


Far from it, apparently.  I did it that way to prevent `funcall' from
choking on t/nil, which -in retrospect- was rather shortsighted...

I've used a more sensible approach in v2 [2].

 Regards,
   Dmitry
 
  +  Iterate through all messages in the current buffer with
  +`notmuch-show-goto-message-next'.  If PREDICATE is satisfied,
  +call FUNCTION for side effects.
 (save-excursion
   (goto-char (point-min))
  -(loop do (funcall function)
  +(loop do (if (eval predicate)
  +(funcall function))
while (notmuch-show-goto-message-next
   
   ;; Functions relating to the visibility of messages and their
  @@ -1336,7 +1337,7 @@ (defun notmuch-show-get-message-id ()
   (defun notmuch-show-get-messages-ids ()
 Return all message ids of messages in the current thread.
 (let ((message-ids))
  -(notmuch-show-mapc
  +(notmuch-show-mapc t
(lambda () (push (notmuch-show-get-message-id) message-ids)))
   message-ids))
   
  @@ -1633,7 +1634,7 @@ (defun notmuch-show-tag-all (rest tag-changes)
   TAG-CHANGES is a list of tag operations for `notmuch-tag'.
 (interactive (notmuch-read-tag-changes nil notmuch-show-thread-id))
 (apply 'notmuch-tag (notmuch-show-get-messages-ids-search) tag-changes)
  -  (notmuch-show-mapc
  +  (notmuch-show-mapc t
  (lambda ()
(let* ((current-tags (notmuch-show-get-tags))
  (new-tags (notmuch-update-tags current-tags tag-changes)))
  -- 
  1.7.8.1
  


Peace

-- 
Pieter

[1] id:1330038554-10347-6-git-send-email-pie...@praet.org
[2] id:1330122640-18895-5-git-send-email-pie...@praet.org
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 5/6] emacs: simplify `notmuch-show-get-messages-ids{, -search}'

2012-02-24 Thread Pieter Praet
On Fri, 24 Feb 2012 14:42:53 +0400, Dmitry Kurochkin 
dmitry.kuroch...@gmail.com wrote:
 On Fri, 24 Feb 2012 00:09:13 +0100, Pieter Praet pie...@praet.org wrote:
  * emacs/notmuch-show.el
  
(notmuch-show-get-messages-ids):
  If provided with optional arg SEPARATOR, return a string consisting
  of all Message-Id's, separated by SEPARATOR.  Also improve original
  docstring wrt default return value.
  
(notmuch-show-get-messages-ids-search):
  Removed, as its functionality is now in `notmuch-show-get-messages-ids'.
  
(notmuch-show-tag-all):
  Call `notmuch-show-get-messages-ids' with SEPARATOR arg instead of
  `notmuch-show-get-messages-ids-search'.
  ---
 
 There is another similar case in notmuch.el:
 `notmuch-show-get-messages-ids' and
 `notmuch-show-get-messages-ids-search'.  There may be more.
 
 Please change them as well.


You mean `notmuch-search-find-thread-id-region{,-search}' ?

They aren't relevant to this series, so I'll submit a separate patch
for that (later).  A quick `rgrep' doesn't reveal any others, but if
you happen to stumble across any, feel free to point them out.

 Regards,
   Dmitry
 
   emacs/notmuch-show.el |   18 +-
   1 files changed, 9 insertions(+), 9 deletions(-)
  
  diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
  index 5fc0e43..4b37c77 100644
  --- a/emacs/notmuch-show.el
  +++ b/emacs/notmuch-show.el
  @@ -1334,17 +1334,17 @@ (defun notmuch-show-get-message-id ()
 Return the message id of the current message.
 (concat id:\ (notmuch-show-get-prop :id) \))
   
  -(defun notmuch-show-get-messages-ids ()
  -  Return all message ids of messages in the current thread.
  +(defun notmuch-show-get-messages-ids (optional separator)
  +  Return a list of Message-Id's of all messages in the current buffer.
  +
  +If provided with optional argument SEPARATOR, return a string
  +instead, consisting of all Message-Id's separated by SEPARATOR.
 (let ((message-ids))
   (notmuch-show-mapc t
(lambda () (push (notmuch-show-get-message-id) message-ids)))
  -message-ids))
  -
  -(defun notmuch-show-get-messages-ids-search ()
  -  Return a search string for all message ids of messages in the
  -current thread.
  -  (mapconcat 'identity (notmuch-show-get-messages-ids)  or ))
  +(if separator
  +   (mapconcat 'identity message-ids separator)
  +  message-ids)))
   
   ;; dme: Would it make sense to use a macro for many of these?
   
  @@ -1633,7 +1633,7 @@ (defun notmuch-show-tag-all (rest tag-changes)
   
   TAG-CHANGES is a list of tag operations for `notmuch-tag'.
 (interactive (notmuch-read-tag-changes nil notmuch-show-thread-id))
  -  (apply 'notmuch-tag (notmuch-show-get-messages-ids-search) tag-changes)
  +  (apply 'notmuch-tag (notmuch-show-get-messages-ids  or ) tag-changes)
 (notmuch-show-mapc t
  (lambda ()
(let* ((current-tags (notmuch-show-get-tags))
  -- 
  1.7.8.1
  


Peace

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


Re: [PATCH 6/6] emacs: `notmuch-show-tag-all' sans prefix arg only tags open messages

2012-02-24 Thread Pieter Praet
On Fri, 24 Feb 2012 14:47:30 +0400, Dmitry Kurochkin 
dmitry.kuroch...@gmail.com wrote:
 On Fri, 24 Feb 2012 00:09:14 +0100, Pieter Praet pie...@praet.org wrote:
  * emacs/notmuch-show.el
  
(notmuch-show-get-messages-ids):
  New optional argument ONLY-OPEN.  If non-nil, only return
  Message-Id's for messages which are currently visible.
  
(notmuch-show-tag-all):
  New optional argument IGNORE-VISIBILITY, of which the inverse is
  passed as ONLY-OPEN argument to `notmuch-show-get-messages-ids':
  If called with a prefix arg, affect *all* messages in the current
  buffer.  Otherwise, only change tags of visible messages.
  
(notmuch-show-archive-thread):
  Update wrt changes to `notmuch-show-tag-all'.
  
  * test/emacs
  
- Subtest notmuch-show: change tags of open messages in current buffer
  is no longer broken.
  ---
   emacs/notmuch-show.el |   28 
   test/emacs|1 -
   2 files changed, 20 insertions(+), 9 deletions(-)
  
  diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
  index 4b37c77..4499fcd 100644
  --- a/emacs/notmuch-show.el
  +++ b/emacs/notmuch-show.el
  @@ -1334,13 +1334,17 @@ (defun notmuch-show-get-message-id ()
 Return the message id of the current message.
 (concat id:\ (notmuch-show-get-prop :id) \))
   
  -(defun notmuch-show-get-messages-ids (optional separator)
  +(defun notmuch-show-get-messages-ids (optional only-open separator)
 Return a list of Message-Id's of all messages in the current buffer.
   
  +If optional argument ONLY-OPEN is non-nil, only return
  +Message-Id's for messages which are currently visible.
  +
   If provided with optional argument SEPARATOR, return a string
   instead, consisting of all Message-Id's separated by SEPARATOR.
 (let ((message-ids))
  -(notmuch-show-mapc t
  +(notmuch-show-mapc
  + `(if only-open (notmuch-show-message-visible-p) t)
 
 How about changing ONLY-OPEN to a general optional PREDICATE argument
 and pass it as is to `notmuch-show-mapc'?  Please make it the last
 argument.


Done.


 Regards,
   Dmitry
 
(lambda () (push (notmuch-show-get-message-id) message-ids)))
   (if separator
  (mapconcat 'identity message-ids separator)
  @@ -1628,13 +1632,21 @@ (defun notmuch-show-tag (optional initial-input)
initial-input (notmuch-show-get-message-id
   (apply 'notmuch-show-tag-message tag-changes)))
   
  -(defun notmuch-show-tag-all (rest tag-changes)
  -  Change tags for all messages in the current thread.
  +(defun notmuch-show-tag-all (optional ignore-visibility rest tag-changes)
  +  Change tags of all open messages in the current buffer.
  +
  +If optional arg IGNORE-VISIBILITY is non-nil, change tags of
  +*all* messages in the current buffer, independent of their
  +visibility.
   
   TAG-CHANGES is a list of tag operations for `notmuch-tag'.
  -  (interactive (notmuch-read-tag-changes nil notmuch-show-thread-id))
  -  (apply 'notmuch-tag (notmuch-show-get-messages-ids  or ) tag-changes)
  -  (notmuch-show-mapc t
  +  (interactive (cons current-prefix-arg
  +(notmuch-read-tag-changes nil notmuch-show-thread-id)))
  +  (apply 'notmuch-tag
  +(notmuch-show-get-messages-ids (not ignore-visibility)  or )
  +tag-changes)
  +  (notmuch-show-mapc
  +   `(if ignore-visibility t (notmuch-show-message-visible-p))
  (lambda ()
(let* ((current-tags (notmuch-show-get-tags))
  (new-tags (notmuch-update-tags current-tags tag-changes)))
  @@ -1719,7 +1731,7 @@ (defun notmuch-show-archive-thread (optional 
  unarchive)
   buffer.
 (interactive P)
 (let ((op (if unarchive + -)))
  -(notmuch-show-tag-all (concat op inbox
  +(notmuch-show-tag-all t (concat op inbox
   
   (defun notmuch-show-archive-thread-then-next ()
 Archive each message in thread, then show next thread from search.
  diff --git a/test/emacs b/test/emacs
  index 644ef59..c286ff5 100755
  --- a/test/emacs
  +++ b/test/emacs
  @@ -152,7 +152,6 @@ notmuch tag +$del_tag -$add_tag -- $query # 
  revert tag changes
   test_expect_equal $count_changed $count_total # assert that CHANGED == 
  TOTAL
   
   test_begin_subtest notmuch-show: change tags of open messages in current 
  buffer
  -test_subtest_known_broken
   query=$os_x_darwin_thread
   filter=from:Jiang
   add_tag=notmuch-show-tag-all
  -- 
  1.7.8.1
  


Peace

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


Re: [PATCH v5 00/12] emacs: more flexible and consistent tagging operations

2012-02-24 Thread Pieter Praet
On Fri, 24 Feb 2012 14:30:29 +0400, Dmitry Kurochkin 
dmitry.kuroch...@gmail.com wrote:
 On Fri, 24 Feb 2012 00:07:27 +0100, Pieter Praet pie...@praet.org wrote:
  On Wed, 08 Feb 2012 11:58:32 -0400, David Bremner da...@tethera.net wrote:
   On Sun,  5 Feb 2012 11:13:41 +0400, Dmitry Kurochkin 
   dmitry.kuroch...@gmail.com wrote:
Changes:

v4:

* rebased on master, no conflicts so no need for another review

   
   I pushed this series.  
   
   Maybe this was discussed already, but I think ideally * would apply only
   to open messages. So consider that a feature request if someone is
   looking for a project.
  
  
  How about if '*' applies to all messages (as it currently does),
  but 'C-u *' only to open messages?  That would make more sense IMHO.
  
  But, conforming to your original request, I've implemented the inverse.
  
 
 I personally do like '*' as is and do not want to change it's behavior.
 Though I am not against adding a prefix argument for it.


Same here.  In v2 [1], '*' tags all and 'C-u *' tags only open.

One can always swap the keybindings if so inclined.


 Regards,
   Dmitry
 
  Patches follow.
  
  
   d
   ___
   notmuch mailing list
   notmuch@notmuchmail.org
   http://notmuchmail.org/mailman/listinfo/notmuch
  
  
  Peace
  
  -- 
  Pieter
 ___
 notmuch mailing list
 notmuch@notmuchmail.org
 http://notmuchmail.org/mailman/listinfo/notmuch


Peace

-- 
Pieter

[1] id:1330122640-18895-1-git-send-email-pie...@praet.org
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH v5 00/12] emacs: more flexible and consistent tagging operations

2012-02-24 Thread Pieter Praet
On Fri, 24 Feb 2012 14:33:35 +0400, Dmitry Kurochkin 
dmitry.kuroch...@gmail.com wrote:
 On Fri, 24 Feb 2012 14:30:29 +0400, Dmitry Kurochkin 
 dmitry.kuroch...@gmail.com wrote:
  On Fri, 24 Feb 2012 00:07:27 +0100, Pieter Praet pie...@praet.org wrote:
   On Wed, 08 Feb 2012 11:58:32 -0400, David Bremner da...@tethera.net 
   wrote:
On Sun,  5 Feb 2012 11:13:41 +0400, Dmitry Kurochkin 
dmitry.kuroch...@gmail.com wrote:
 Changes:
 
 v4:
 
 * rebased on master, no conflicts so no need for another review
 

I pushed this series.  

Maybe this was discussed already, but I think ideally * would apply only
to open messages. So consider that a feature request if someone is
looking for a project.
   
   
   How about if '*' applies to all messages (as it currently does),
   but 'C-u *' only to open messages?  That would make more sense IMHO.
   
   But, conforming to your original request, I've implemented the inverse.
   
  
  I personally do like '*' as is and do not want to change it's behavior.
  Though I am not against adding a prefix argument for it.
  
 
 Also can you please send new patches (and patch series) in a new
 separate thread?  If they are related to another thread, you can add a
 reference.  But having multiple patch series with multiple versions in a
 single thread is very confusing IMO.


Since I've already soiled this thread with my initial series,
I've sent v2 [1] in reply to David's request as well, but will
make sure to start a fresh thread from now on.


 Regards,
   Dmitry
 
  Regards,
Dmitry
  
   Patches follow.
   
   
d
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch
   
   
   Peace
   
   -- 
   Pieter

Thanks for all your comments!


Peace

-- 
Pieter

[1] id:1330122640-18895-1-git-send-email-pie...@praet.org
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH v5 00/12] emacs: more flexible and consistent tagging operations

2012-02-24 Thread Pieter Praet
On Fri, 24 Feb 2012 23:38:20 +0100, Pieter Praet pie...@praet.org wrote:
 [...]
 Same here.  In v2 [1], '*' tags all and 'C-u *' tags only open.
 
 One can always swap the keybindings if so inclined.


Did I really say that?

There's only a single keybinding, so swap it with *what* ?!?  Itself ?

This should work though:

  #+begin_src emacs-lisp
(define-key notmuch-show-mode-map *
  (lambda (prefix rest tag-changes)
(interactive
 (cons
  (not current-prefix-arg)
  (notmuch-read-tag-changes nil notmuch-show-thread-id)))
(apply 'notmuch-show-tag-all prefix tag-changes)))
  #+end_src

 [...]


Peace

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


Re: [PATCH v5 00/12] emacs: more flexible and consistent tagging operations

2012-02-23 Thread Pieter Praet
On Wed, 08 Feb 2012 11:58:32 -0400, David Bremner da...@tethera.net wrote:
 On Sun,  5 Feb 2012 11:13:41 +0400, Dmitry Kurochkin 
 dmitry.kuroch...@gmail.com wrote:
  Changes:
  
  v4:
  
  * rebased on master, no conflicts so no need for another review
  
 
 I pushed this series.  
 
 Maybe this was discussed already, but I think ideally * would apply only
 to open messages. So consider that a feature request if someone is
 looking for a project.


How about if '*' applies to all messages (as it currently does),
but 'C-u *' only to open messages?  That would make more sense IMHO.

But, conforming to your original request, I've implemented the inverse.

Patches follow.


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


Peace

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


[PATCH 1/6] test: emacs: new tests notmuch-show: {add, remove} multiple tags {to, from} single message

2012-02-23 Thread Pieter Praet
* test/emacs:

  - Rename subtests {Add,Remove} tag from notmuch-show view to
notmuch-show: {add,remove} single tag {to,from} single message
to be consistent with the following tests.

  - New subtest notmuch-show: add multiple tags to single message:
`notmuch-show-add-tag' (+) can add multiple tags to a message.

  - New subtest notmuch-show: remove multiple tags from single message:
`notmuch-show-remove-tag' (-) can remove multiple tags from a message.
---
 test/emacs |   16 ++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/test/emacs b/test/emacs
index b74cfa9..ec1dbb0 100755
--- a/test/emacs
+++ b/test/emacs
@@ -112,18 +112,30 @@ test_emacs (notmuch-search \$os_x_darwin_thread\)
 output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
 test_expect_equal $output thread:XXX   2009-11-18 [4/4] Jjgod Jiang, 
Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox 
unread)
 
-test_begin_subtest Add tag from notmuch-show view
+test_begin_subtest notmuch-show: add single tag to single message
 test_emacs (notmuch-show \$os_x_darwin_thread\)
(execute-kbd-macro \+tag-from-show-view\)
 output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
 test_expect_equal $output thread:XXX   2009-11-18 [4/4] Jjgod Jiang, 
Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox 
tag-from-show-view unread)
 
-test_begin_subtest Remove tag from notmuch-show view
+test_begin_subtest notmuch-show: remove single tag from single message
 test_emacs (notmuch-show \$os_x_darwin_thread\)
(execute-kbd-macro \-tag-from-show-view\)
 output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
 test_expect_equal $output thread:XXX   2009-11-18 [4/4] Jjgod Jiang, 
Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox 
unread)
 
+test_begin_subtest notmuch-show: add multiple tags to single message
+test_emacs (notmuch-show \$os_x_darwin_thread\)
+   (execute-kbd-macro \+tag1-from-show-view +tag2-from-show-view\)
+output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
+test_expect_equal $output thread:XXX   2009-11-18 [4/4] Jjgod Jiang, 
Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox 
tag1-from-show-view tag2-from-show-view unread)
+
+test_begin_subtest notmuch-show: remove multiple tags from single message
+test_emacs (notmuch-show \$os_x_darwin_thread\)
+   (execute-kbd-macro \-tag1-from-show-view -tag2-from-show-view\)
+output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
+test_expect_equal $output thread:XXX   2009-11-18 [4/4] Jjgod Jiang, 
Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox 
unread)
+
 test_begin_subtest Message with .. in Message-Id:
 add_message [id]=123..456@example '[subject]=Message with .. in Message-Id'
 test_emacs '(notmuch-search id:\123..456@example\)
-- 
1.7.8.1

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


[PATCH 2/6] test: emacs: new test notmuch-show: change tags of all messages in current buffer

2012-02-23 Thread Pieter Praet
* test/emacs:

  New subtest notmuch-show: change tags of all messages in current buffer:
  `notmuch-show-tag-all' (*) changes tags of *all* messages in current buffer.
---
 test/emacs |   15 +++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/test/emacs b/test/emacs
index ec1dbb0..d2dbafc 100755
--- a/test/emacs
+++ b/test/emacs
@@ -136,6 +136,21 @@ test_emacs (notmuch-show \$os_x_darwin_thread\)
 output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
 test_expect_equal $output thread:XXX   2009-11-18 [4/4] Jjgod Jiang, 
Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox 
unread)
 
+test_begin_subtest notmuch-show: change tags of all messages in current 
buffer
+query=$os_x_darwin_thread
+filter=from:Jiang
+add_tag=notmuch-show-tag-all
+del_tag=inbox
+count_total=$(notmuch count -- $query)   # = 4
+count_match=$(notmuch count -- $query AND $filter) # = 2
+test_emacs (notmuch-search \$query AND $filter\)
+(notmuch-test-wait)
+(notmuch-search-show-thread)
+(execute-kbd-macro \*+$add_tag -$del_tag\)
+count_changed=$(notmuch count -- $query AND tag:$add_tag AND NOT 
tag:$del_tag)
+notmuch tag +$del_tag -$add_tag -- $query # revert tag changes
+test_expect_equal $count_changed $count_total # assert that CHANGED == 
TOTAL
+
 test_begin_subtest Message with .. in Message-Id:
 add_message [id]=123..456@example '[subject]=Message with .. in Message-Id'
 test_emacs '(notmuch-search id:\123..456@example\)
-- 
1.7.8.1

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


[PATCH 3/6] test: emacs: `notmuch-show-tag-all' sans prefix arg should only tag open messages

2012-02-23 Thread Pieter Praet
* test/emacs:

  - Alter subtest notmuch-show: change tags of all messages in current buffer:
Pass a prefix arg to `notmuch-show-tag-all' (*).

  - New subtest notmuch-show: change tags of open messages in current buffer:
When called *without* a prefix arg, `notmuch-show-tag-all' (*) should only
change the tags of *open* messages.  Currently broken, fix follows later.
---
 test/emacs |   18 +-
 1 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/test/emacs b/test/emacs
index d2dbafc..644ef59 100755
--- a/test/emacs
+++ b/test/emacs
@@ -146,11 +146,27 @@ count_match=$(notmuch count -- $query AND $filter) # 
= 2
 test_emacs (notmuch-search \$query AND $filter\)
 (notmuch-test-wait)
 (notmuch-search-show-thread)
-(execute-kbd-macro \*+$add_tag -$del_tag\)
+(execute-kbd-macro \*+$add_tag -$del_tag\)
 count_changed=$(notmuch count -- $query AND tag:$add_tag AND NOT 
tag:$del_tag)
 notmuch tag +$del_tag -$add_tag -- $query # revert tag changes
 test_expect_equal $count_changed $count_total # assert that CHANGED == 
TOTAL
 
+test_begin_subtest notmuch-show: change tags of open messages in current 
buffer
+test_subtest_known_broken
+query=$os_x_darwin_thread
+filter=from:Jiang
+add_tag=notmuch-show-tag-all
+del_tag=inbox
+count_total=$(notmuch count -- $query)   # = 4
+count_match=$(notmuch count -- $query AND $filter) # = 2
+test_emacs (notmuch-search \$query AND $filter\)
+(notmuch-test-wait)
+(notmuch-search-show-thread)
+(execute-kbd-macro \*+$add_tag -$del_tag\)
+count_changed=$(notmuch count -- $query AND tag:$add_tag AND NOT 
tag:$del_tag)
+notmuch tag +$del_tag -$add_tag -- $query # revert tag changes
+test_expect_equal $count_changed $count_match # assert that CHANGED == 
MATCHING
+
 test_begin_subtest Message with .. in Message-Id:
 add_message [id]=123..456@example '[subject]=Message with .. in Message-Id'
 test_emacs '(notmuch-search id:\123..456@example\)
-- 
1.7.8.1

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


[PATCH 6/6] emacs: `notmuch-show-tag-all' sans prefix arg only tags open messages

2012-02-23 Thread Pieter Praet
* emacs/notmuch-show.el

  (notmuch-show-get-messages-ids):
New optional argument ONLY-OPEN.  If non-nil, only return
Message-Id's for messages which are currently visible.

  (notmuch-show-tag-all):
New optional argument IGNORE-VISIBILITY, of which the inverse is
passed as ONLY-OPEN argument to `notmuch-show-get-messages-ids':
If called with a prefix arg, affect *all* messages in the current
buffer.  Otherwise, only change tags of visible messages.

  (notmuch-show-archive-thread):
Update wrt changes to `notmuch-show-tag-all'.

* test/emacs

  - Subtest notmuch-show: change tags of open messages in current buffer
is no longer broken.
---
 emacs/notmuch-show.el |   28 
 test/emacs|1 -
 2 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 4b37c77..4499fcd 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1334,13 +1334,17 @@ (defun notmuch-show-get-message-id ()
   Return the message id of the current message.
   (concat id:\ (notmuch-show-get-prop :id) \))
 
-(defun notmuch-show-get-messages-ids (optional separator)
+(defun notmuch-show-get-messages-ids (optional only-open separator)
   Return a list of Message-Id's of all messages in the current buffer.
 
+If optional argument ONLY-OPEN is non-nil, only return
+Message-Id's for messages which are currently visible.
+
 If provided with optional argument SEPARATOR, return a string
 instead, consisting of all Message-Id's separated by SEPARATOR.
   (let ((message-ids))
-(notmuch-show-mapc t
+(notmuch-show-mapc
+ `(if only-open (notmuch-show-message-visible-p) t)
  (lambda () (push (notmuch-show-get-message-id) message-ids)))
 (if separator
(mapconcat 'identity message-ids separator)
@@ -1628,13 +1632,21 @@ (defun notmuch-show-tag (optional initial-input)
  initial-input (notmuch-show-get-message-id
 (apply 'notmuch-show-tag-message tag-changes)))
 
-(defun notmuch-show-tag-all (rest tag-changes)
-  Change tags for all messages in the current thread.
+(defun notmuch-show-tag-all (optional ignore-visibility rest tag-changes)
+  Change tags of all open messages in the current buffer.
+
+If optional arg IGNORE-VISIBILITY is non-nil, change tags of
+*all* messages in the current buffer, independent of their
+visibility.
 
 TAG-CHANGES is a list of tag operations for `notmuch-tag'.
-  (interactive (notmuch-read-tag-changes nil notmuch-show-thread-id))
-  (apply 'notmuch-tag (notmuch-show-get-messages-ids  or ) tag-changes)
-  (notmuch-show-mapc t
+  (interactive (cons current-prefix-arg
+(notmuch-read-tag-changes nil notmuch-show-thread-id)))
+  (apply 'notmuch-tag
+(notmuch-show-get-messages-ids (not ignore-visibility)  or )
+tag-changes)
+  (notmuch-show-mapc
+   `(if ignore-visibility t (notmuch-show-message-visible-p))
(lambda ()
  (let* ((current-tags (notmuch-show-get-tags))
(new-tags (notmuch-update-tags current-tags tag-changes)))
@@ -1719,7 +1731,7 @@ (defun notmuch-show-archive-thread (optional unarchive)
 buffer.
   (interactive P)
   (let ((op (if unarchive + -)))
-(notmuch-show-tag-all (concat op inbox
+(notmuch-show-tag-all t (concat op inbox
 
 (defun notmuch-show-archive-thread-then-next ()
   Archive each message in thread, then show next thread from search.
diff --git a/test/emacs b/test/emacs
index 644ef59..c286ff5 100755
--- a/test/emacs
+++ b/test/emacs
@@ -152,7 +152,6 @@ notmuch tag +$del_tag -$add_tag -- $query # revert 
tag changes
 test_expect_equal $count_changed $count_total # assert that CHANGED == 
TOTAL
 
 test_begin_subtest notmuch-show: change tags of open messages in current 
buffer
-test_subtest_known_broken
 query=$os_x_darwin_thread
 filter=from:Jiang
 add_tag=notmuch-show-tag-all
-- 
1.7.8.1

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


[PATCH] emacs: correct `notmuch-search-mode's docstring wrt `notmuch-search-tag-all'

2012-02-22 Thread Pieter Praet
* emacs/notmuch.el (notmuch-search-mode):
  `notmuch-search-tag-all' currently uses the current query string
  instead of `notmuch-search-find-thread-id-region-search', which
  might cause a race condition.
---
 emacs/notmuch.el |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index f851c6f..0a9fffd 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -435,8 +435,9 @@ (defun notmuch-search-mode ()
 Pressing \\[notmuch-search-show-thread] on any line displays that thread. The 
'\\[notmuch-search-add-tag]' and '\\[notmuch-search-remove-tag]'
 keys can be used to add or remove tags from a thread. The 
'\\[notmuch-search-archive-thread]' key
 is a convenience for archiving a thread (removing the \"inbox\"
-tag). The '\\[notmuch-search-tag-all]' key can be used to add or remove a tag 
from all
-threads in the current buffer.
+tag). The '\\[notmuch-search-tag-all]' key can be used to add and/or remove 
tags from all
+messages (as opposed to threads) that match the current query.  Use with 
caution, as this
+will also tag matching messages that arrived *after* constructing the buffer.

 Other useful commands are '\\[notmuch-search-filter]' for filtering the 
current search
 based on an additional query string, '\\[notmuch-search-filter-by-tag]' for 
filtering to include
-- 
1.7.8.1



[PATCH] emacs: Mention race condition safety in user visible documentation

2012-02-22 Thread Pieter Praet
On Tue, 21 Feb 2012 10:15:08 +0100, Michal Sojka  wrote:
> [...]
> OK, at least one supporter here :) The updated patch follows:
> 
> -- >8 --
> Subject: [PATCH] emacs: Clarify description of thread manipulating functions
> 
> It is not clear whether the term "thread" refers to the thread in the
> database or to the thread currently shown in a buffer. Those two
> meanings may refer to different sets of messages, e.g. when a new email
> is added to the database while the buffer shows the state before the new
> email arrived.
> 
> This patch replaces the term thread with the term current buffer, which
> is hopefully less ambiguous.
> ---

+1


Also, the inverse is true for the comment about `notmuch-search-tag-all'
in `notmuch-search-mode's docstring.  Patch follows.


Peace

-- 
Pieter


[PATCH v3 0/3] Fix refreshing with state and make it the default

2012-02-22 Thread Pieter Praet
On Tue, 21 Feb 2012 10:42:30 -0500, Austin Clements  wrote:
> Third time's the charm.  This fixes show refresh to not mark anything
> read when keeping state while refreshing and makes it the default.
> 

LGTM.


Peace

-- 
Pieter


[PATCH v3] test: emacs: new test "notmuch-search: change tags of all matching messages"

2012-02-22 Thread Pieter Praet
`notmuch-search-tag-all' (bound to "*") adds and removes tags
to/from all messages which match the query used to populate the
current search buffer.
---
 test/emacs |   38 ++
 1 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/test/emacs b/test/emacs
index b74cfa9..d64dcd0 100755
--- a/test/emacs
+++ b/test/emacs
@@ -124,6 +124,44 @@ test_emacs "(notmuch-show \"$os_x_darwin_thread\")
 output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
 test_expect_equal "$output" "thread:XXX   2009-11-18 [4/4] Jjgod Jiang, 
Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox 
unread)"

+
+test_begin_subtest "notmuch-search: change tags of all matching messages"
+old_tag="inbox"
+new_tag="xobni"
+filter="AND from:cworth"
+
+# Get initial tag counts and prevent false positives/negatives
+old_tag_count_1=$(notmuch count tag:"${old_tag}" "${filter}")
+new_tag_count_1=$(notmuch count tag:"${new_tag}" "${filter}")
+test "${old_tag_count_1}" = "0" && old_tag_count_1="Need >0 matches!"
+test "${new_tag_count_1}" = "0" || new_tag_count_1="Need 0 matches!"
+
+# Change tags of all matching messages and get tag counts
+test_emacs "(notmuch-search \"tag:${old_tag} ${filter}\")
+   (notmuch-test-wait)
+   (notmuch-search-tag-all \"-${old_tag}\" \"+${new_tag}\")"
+old_tag_count_2=$(notmuch count tag:"${old_tag}" "${filter}")
+new_tag_count_2=$(notmuch count tag:"${new_tag}" "${filter}")
+
+# Revert tag changes and get tag counts
+test_emacs "(notmuch-search \"tag:${new_tag} ${filter}\")
+   (notmuch-test-wait)
+   (notmuch-search-tag-all \"+${old_tag}\" \"-${new_tag}\")"
+old_tag_count_3=$(notmuch count tag:"${old_tag}" "${filter}")
+new_tag_count_3=$(notmuch count tag:"${new_tag}" "${filter}")
+
+# ... and verify the results
+output="
+before:   old:${old_tag_count_1} new:${new_tag_count_1}
+after:old:${old_tag_count_2} new:${new_tag_count_2}
+restored: old:${old_tag_count_3} new:${new_tag_count_3}"
+expected="
+before:   old:${old_tag_count_1} new:0
+after:old:0 new:${old_tag_count_1}
+restored: old:${old_tag_count_1} new:0"
+test_expect_equal "$output" "$expected"
+
+
 test_begin_subtest "Message with .. in Message-Id:"
 add_message [id]=123..456 at example '[subject]="Message with .. in 
Message-Id"'
 test_emacs '(notmuch-search "id:\"123..456 at example\"")
-- 
1.7.8.1



[PATCH v2 4/4] test: emacs: new test "notmuch-search: change tags of all matching messages"

2012-02-22 Thread Pieter Praet
On Mon, 20 Feb 2012 16:25:05 +0400, Dmitry Kurochkin  wrote:
> On Sun, 19 Feb 2012 21:38:28 +0100, Pieter Praet  wrote:
> > `notmuch-search-tag-all' (bound to "*") adds and removes tags
> > to/from all messages which match the query used to populate the
> > current search buffer.
> 
> LGTM.  But since you will need to send a new version to address Tomi's
> comments anyway, below are few minor comments.
> 
> Regards,
>   Dmitry
> 
> > ---
> >  test/emacs |   32 
> >  1 files changed, 32 insertions(+), 0 deletions(-)
> > 
> > diff --git a/test/emacs b/test/emacs
> > index b0fb760..1db8540 100755
> > --- a/test/emacs
> > +++ b/test/emacs
> > @@ -124,6 +124,38 @@ test_emacs "(notmuch-show \"$os_x_darwin_thread\")
> >  output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
> >  test_expect_equal "$output" "thread:XXX   2009-11-18 [4/4] Jjgod Jiang, 
> > Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues 
> > (inbox unread)"
> >  
> > +test_begin_subtest "notmuch-search: change tags of all matching messages"
> > +old_tag="inbox"
> > +new_tag="xobni"
> > +filter="AND from:cworth"
> > +# Get initial tag counts and prevent false positives/negatives
> > +old_tag_count_1=$(notmuch count tag:"${old_tag}" "${filter}")
> > +new_tag_count_1=$(notmuch count tag:"${new_tag}" "${filter}")
> > +test "${old_tag_count_1}" == "0" && old_tag_count_1="Need 1+ matches!"
> 
> Consider s/1+/>0/.
> 
> > +test "${new_tag_count_1}" == "0" || new_tag_count_1="Need 0 matches!"
> > +# Change tags of all matching messages and get tag counts
> > +test_emacs "(notmuch-search \"tag:${old_tag} ${filter}\")
> > +   (notmuch-test-wait)
> > +   (notmuch-search-tag-all \"-${old_tag}\" \"+${new_tag}\")"
> > +old_tag_count_2=$(notmuch count tag:"${old_tag}" "${filter}")
> > +new_tag_count_2=$(notmuch count tag:"${new_tag}" "${filter}")
> > +# Revert tag changes and get tag counts
> > +test_emacs "(notmuch-search \"tag:${new_tag} ${filter}\")
> > +   (notmuch-test-wait)
> > +   (notmuch-search-tag-all \"+${old_tag}\" \"-${new_tag}\")"
> > +old_tag_count_3=$(notmuch count tag:"${old_tag}" "${filter}")
> > +new_tag_count_3=$(notmuch count tag:"${new_tag}" "${filter}")
> > +# ... and verify the results
> > +output="
> > +before:   old:${old_tag_count_1} new:${new_tag_count_1}
> > +after:old:${old_tag_count_2} new:${new_tag_count_2}
> > +restored: old:${old_tag_count_3} new:${new_tag_count_3}"
> > +expected="
> > +before:   old:${old_tag_count_1} new:0
> > +after:old:0 new:${old_tag_count_1}
> > +restored: old:${old_tag_count_1} new:0"
> > +test_expect_equal "$output" "$expected"
> > +
> 
> I would add a newline before every commented block.
>

Agreed, on all accounts.


> Regards,
>   Dmitry
> 
> >  test_begin_subtest "Message with .. in Message-Id:"
> >  add_message [id]=123..456 at example '[subject]="Message with .. in 
> > Message-Id"'
> >  test_emacs '(notmuch-search "id:\"123..456 at example\"")
> > -- 
> > 1.7.8.1
> > 


Peace

-- 
Pieter


[PATCH v2 4/4] test: emacs: new test "notmuch-search: change tags of all matching messages"

2012-02-22 Thread Pieter Praet
On Sun, 19 Feb 2012 23:08:30 +0200, Tomi Ollila  wrote:
> On Sun, 19 Feb 2012 21:38:28 +0100, Pieter Praet  wrote:
> > `notmuch-search-tag-all' (bound to "*") adds and removes tags
> > to/from all messages which match the query used to populate the
> > current search buffer.
> > ---
> >  test/emacs |   32 
> >  1 files changed, 32 insertions(+), 0 deletions(-)
> > 
> 
> [ ... ]
> 
> > +old_tag_count_1=$(notmuch count tag:"${old_tag}" "${filter}")
> > +new_tag_count_1=$(notmuch count tag:"${new_tag}" "${filter}")
> > +test "${old_tag_count_1}" == "0" && old_tag_count_1="Need 1+ matches!"
> > +test "${new_tag_count_1}" == "0" || new_tag_count_1="Need 0 matches!"
> > +# Change tags of all matching messages and get tag counts
> > +test_emacs "(notmuch-search \"tag:${old_tag} ${filter}\")
> 
> Small nit: string equality comparison operator is '='. 
> Use  grep '==' test/*  to confirm (or man test).
>

Argh...  Nice catch!


> [ ... ]
> 
> Tomi


Peace

-- 
Pieter


[PATCH v2 3/4] test: emacs: new test "notmuch-search: when reply is sent, parent message should be tagged 'replied'"

2012-02-22 Thread Pieter Praet
On Mon, 20 Feb 2012 16:20:28 +0400, Dmitry Kurochkin  wrote:
> On Sun, 19 Feb 2012 21:38:27 +0100, Pieter Praet  wrote:
> > When a message is replied to, it should be tagged `replied'.
> > ---
> >  test/emacs |5 +
> >  1 files changed, 5 insertions(+), 0 deletions(-)
> > 
> > diff --git a/test/emacs b/test/emacs
> > index 0f4f42b..b0fb760 100755
> > --- a/test/emacs
> > +++ b/test/emacs
> > @@ -314,6 +314,11 @@ Reply to a message via Emacs with fake SMTP
> >  EOF
> >  test_expect_equal_file OUTPUT EXPECTED
> >  
> > +test_begin_subtest "notmuch-search: when reply is sent, the parent message 
> > should be tagged 'replied'"
> > +# depends on subtest "notmuch-search: replying to a thread (sending)"
> > +output=$(notmuch search 'tag:replied' | notmuch_search_sanitize)
> 
> Add subject:"testing message sent via SMTP" to the query to avoid
> potential collisions with other tests.
>

Good point.

Depends on the previous test though, which is postponed [1],
so I won't submit a v3 of this for the time being.


> Regards,
>   Dmitry
> 
> > +test_expect_equal "$output" "thread:XXX   2000-01-01 [1/2] Notmuch Test 
> > Suite; Testing message sent via SMTP (inbox replied)"
> > +
> >  test_begin_subtest "Quote MML tags in reply"
> >  message_id='test-emacs-mml-quoting at message.id'
> >  add_message [id]="$message_id" \
> > -- 
> > 1.7.8.1
> > 


Peace

-- 
Pieter

[1] id:"87k43e8zxb.fsf at praet.org"


[PATCH v2 2/4] test: emacs: new test "notmuch-search: replying to a thread (sending)"

2012-02-22 Thread Pieter Praet
On Mon, 20 Feb 2012 16:44:32 +0400, Dmitry Kurochkin  wrote:
> On Sun, 19 Feb 2012 21:38:26 +0100, Pieter Praet  wrote:
> > As pointed out in the previous commit, the test for replying from
> > within Emacs didn't actually submit the reply. This one does.
> > ---
> >  test/emacs |   41 +
> >  1 files changed, 41 insertions(+), 0 deletions(-)
> > 
> > diff --git a/test/emacs b/test/emacs
> > index 308d749..0f4f42b 100755
> > --- a/test/emacs
> > +++ b/test/emacs
> > @@ -273,6 +273,47 @@ On 01 Jan 2000 12:00:00 -, Notmuch Test Suite 
> >  w
> >  EOF
> >  test_expect_equal_file OUTPUT EXPECTED
> >  
> > +test_begin_subtest "notmuch-search: replying to a thread (sending)"
> > +$TEST_DIRECTORY/smtp-dummy sent_message &
> > +smtp_dummy_pid=$!
> > +test_emacs \
> > +'(let ((message-send-mail-function '\''message-smtpmail-send-it)
> > +   (smtpmail-smtp-server "localhost")
> > +   (smtpmail-smtp-service "25025"))
> > +  (notmuch-search "subject:\"testing message sent via SMTP\"")
> > +  (notmuch-test-wait)
> > +  (notmuch-search-reply-to-thread)
> > +  (end-of-buffer)
> > +  (newline)
> > +  (insert "Reply to a message via Emacs with fake SMTP")
> > +  (message-send-and-exit))' >/dev/null 2>&1
> > +wait ${smtp_dummy_pid}
> > +notmuch new >/dev/null
> > +sed \
> > +-e s',^User-Agent: Notmuch/.* Emacs/.*,User-Agent: Notmuch/XXX 
> > Emacs/XXX,' \
> > +-e s',^Message-ID: <.*>$,Message-ID: ,' \
> > +-e s',^In-Reply-To: <.*>$,In-Reply-To: ,' \
> > +-e s',^References: <.*>$,References: ,' \
> > +-e s',^Date: .*$,Date: Fri\, 29 Mar 1974 10:05:00 -,' < 
> > sent_message >OUTPUT
> 
> This sed command is a (partial) copy past from "Sending a message via
> (fake) SMTP" test.  [...]

Aye, that's the one.


> [...] I suggest adding notmuch_sent_message_sanitize
> function which would replace common headers with XXX.
> 
> Replace Date with XXX for Date for consistency with other headers,
> AFAICT a valid date value is not needed here.
>

Agreed.

Will have another look at it when Tomi's refactoring is done [1,2].


> Regards,
>   Dmitry
> 
> > +cat <EXPECTED
> > +From: Notmuch Test Suite 
> > +To: user at example.com
> > +Subject: Re: Testing message sent via SMTP
> > +In-Reply-To: 
> > +References: 
> > +User-Agent: Notmuch/XXX Emacs/XXX
> > +Date: Fri, 29 Mar 1974 10:05:00 -
> > +Message-ID: 
> > +MIME-Version: 1.0
> > +Content-Type: text/plain; charset=us-ascii
> > +
> > +On 01 Jan 2000 12:00:00 -, Notmuch Test Suite  > notmuchmail.org> wrote:
> > +> This is a test that messages are sent via SMTP
> > +
> > +Reply to a message via Emacs with fake SMTP
> > +EOF
> > +test_expect_equal_file OUTPUT EXPECTED
> > +
> >  test_begin_subtest "Quote MML tags in reply"
> >  message_id='test-emacs-mml-quoting at message.id'
> >  add_message [id]="$message_id" \
> > -- 
> > 1.7.8.1
> > 


Peace

-- 
Pieter

[1] id:"m239a6wn4p.fsf at guru.guru-group.fi"
[2] id:"87mx8a900t.fsf at praet.org"


[PATCH v2 2/4] test: emacs: new test "notmuch-search: replying to a thread (sending)"

2012-02-22 Thread Pieter Praet
On Sun, 19 Feb 2012 23:04:38 +0200, Tomi Ollila  wrote:
> On Sun, 19 Feb 2012 21:38:26 +0100, Pieter Praet  wrote:
> > As pointed out in the previous commit, the test for replying from
> > within Emacs didn't actually submit the reply. This one does.
> > ---
> >  test/emacs |   41 +
> >  1 files changed, 41 insertions(+), 0 deletions(-)
> > 
> > diff --git a/test/emacs b/test/emacs
> > index 308d749..0f4f42b 100755
> > --- a/test/emacs
> > +++ b/test/emacs
> > @@ -273,6 +273,47 @@ On 01 Jan 2000 12:00:00 -, Notmuch Test Suite 
> >  w
> >  EOF
> >  test_expect_equal_file OUTPUT EXPECTED
> >  
> > +test_begin_subtest "notmuch-search: replying to a thread (sending)"
> > +$TEST_DIRECTORY/smtp-dummy sent_message &
> > +smtp_dummy_pid=$!
> > +test_emacs \
> > +'(let ((message-send-mail-function '\''message-smtpmail-send-it)
> > +   (smtpmail-smtp-server "localhost")
> > +   (smtpmail-smtp-service "25025"))
> > +  (notmuch-search "subject:\"testing message sent via SMTP\"")
> > +  (notmuch-test-wait)
> > +  (notmuch-search-reply-to-thread)
> > +  (end-of-buffer)
> > +  (newline)
> > +  (insert "Reply to a message via Emacs with fake SMTP")
> > +  (message-send-and-exit))' >/dev/null 2>&1
> > +wait ${smtp_dummy_pid}
> > +notmuch new >/dev/null
> 
> The above part smells like CopyPasteProgramming; (old version of) 
> emacs_deliver_message copied (old as this version is lacking
> opportunistic quit). 
>

Nope, "Sending a message via (fake) SMTP", around 2011-05 to be exact [1].

My main intention was to get a bugfix [2] applied (still isn't BTW),
which might have been expedited by providing a test which checks
whether messages are properly tagged 'replied' when and *only* when
applicable, and for that I needed a quick way to test replying to a
thread, so I lazily repurposed an existing test.  Not much point in
reinventing the wheel, is there?

Still haven't gotten around to writing the actual test to demonstrate
that messages are tagged 'replied' prematurely, but this should be the
gist of it:

  #+begin_src emacs-lisp
;; ask for confirmation (using `y-or-n-p') before sending
(let ((message-confirm-send t))
  ;; temporarily redefine `y-or-n-p', immediately returns nil
  (flet ((y-or-n-p ( args) nil))
;; then try to send message (which will fail)
(message-send-and-exit)))

;; Parent message should NOT be tagged 'replied' now, yet it is,
;; since `notmuch-message-mark-replied' is added to `message-send-hook'
;; instead of `message-sent-hook'.
  #+end_src


> Maybe the functionality of emacs_deliver_message needs to be
> split into 3 parts: initialization, sending and finalization.
> then other uses can use initialization and finalization parts
> and provide their own sending part.
>

That would be *much* better, indeed.


> I have work-in-progress code for initialization and finalization
> parts of that and I don't want to do the changes in 2 places...
>

OK.  I'll mark this patch (and the next, which depends on it) as 'wip',
and pick them up again when your refactoring efforts hit mainline.


> Tomi


Peace

-- 
Pieter

[1] id:"1305299270-4316-1-git-send-email-pieter at praet.org"
[2] id:"1305275652-22956-1-git-send-email-pieter at praet.org"


[PATCH v2 7/7] emacs: `notmuch-show-toggle-visibility-messages' with prefix arg filters by tag

2012-02-22 Thread Pieter Praet
* emacs/notmuch-show.el (notmuch-show-toggle-visibility-messages):
  When provided with a prefix arg, prompt the user for a tag.
  Show all messages that have it and hide those that don't.
---
 emacs/notmuch-show.el |   13 ++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 82d4265..b5e482b 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -38,6 +38,7 @@

 (declare-function notmuch-call-notmuch-process "notmuch" ( args))
 (declare-function notmuch-fontify-headers "notmuch" nil)
+(declare-function notmuch-select-tag-with-completion "notmuch" (prompt  
search-terms))
 (declare-function notmuch-read-tag-changes "notmuch" ( initial-input 
 search-terms))
 (declare-function notmuch-search-next-thread "notmuch" nil)
 (declare-function notmuch-search-show-thread "notmuch" nil)
@@ -1670,13 +1671,19 @@ (defun notmuch-show-toggle-visibility-message ()

 (defun notmuch-show-toggle-visibility-messages ()
   "Toggle the visibility of all messages in the current thread.
-If the current message is visible, hide all messages -- and vice versa."
+If the current message is visible, hide all messages -- and vice versa.
+
+With a prefix argument, prompt for a tag and only show messages which have it."
   (interactive)
-  (let ((visible-p (notmuch-show-message-visible-p)))
+  (let ((visible-p (notmuch-show-message-visible-p))
+   (filter (if current-prefix-arg
+   (notmuch-select-tag-with-completion "Filter by tag: "
 (notmuch-show-mapc
  (lambda () (notmuch-show-message-visible
 (notmuch-show-get-message-properties)
-(not visible-p)
+(if current-prefix-arg
+(member filter (notmuch-show-get-tags))
+  (not visible-p))

   ;; Put the current message properly into focus, but don't
   ;; obscure the presence of previous messages in the thread.
-- 
1.7.8.1



[PATCH v2 6/7] emacs: make `notmuch-show-toggle-visibility-messages' live up to its new name

2012-02-22 Thread Pieter Praet
* emacs/notmuch-show.el (notmuch-show-toggle-visibility-messages):
  Toggle visibility of all messages in current thread based on visibility
  of the current message, instead of setting visibility based on whether
  or not a prefix arg was supplied.

  Also move current buffer line to the 2nd window line so the current
  message is put properly into focus, whilst making the presence of
  previous messages in the thread obvious.

Same functionality, less effort (reaching for 'C-u' is a pain)...
---
 emacs/notmuch-show.el |   20 
 test/emacs|6 +++---
 2 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index e4d1f9c..82d4265 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1669,15 +1669,19 @@ (defun notmuch-show-toggle-visibility-message ()
   (force-window-update))

 (defun notmuch-show-toggle-visibility-messages ()
-  "Set the visibility all of the messages in the current thread.
-By default make all of the messages visible. With a prefix
-argument, hide all of the messages."
+  "Toggle the visibility of all messages in the current thread.
+If the current message is visible, hide all messages -- and vice versa."
   (interactive)
-  (save-excursion
-(goto-char (point-min))
-(loop do (notmuch-show-message-visible 
(notmuch-show-get-message-properties)
-  (not current-prefix-arg))
- until (not (notmuch-show-goto-message-next
+  (let ((visible-p (notmuch-show-message-visible-p)))
+(notmuch-show-mapc
+ (lambda () (notmuch-show-message-visible
+(notmuch-show-get-message-properties)
+(not visible-p)
+
+  ;; Put the current message properly into focus, but don't
+  ;; obscure the presence of previous messages in the thread.
+  (recenter-top-bottom 1)
+
   (force-window-update))

 (defun notmuch-show-next-button ()
diff --git a/test/emacs b/test/emacs
index 29fdec0..5c61743 100755
--- a/test/emacs
+++ b/test/emacs
@@ -410,14 +410,14 @@ test_expect_equal_file OUTPUT 
$EXPECTED/notmuch-show-message-with-headers-hidden

 test_begin_subtest "notmuch-show: collapse all messages in thread"
 test_emacs '(notmuch-show "id:f35dbb950911171435ieecd458o853c873e35f4be95 at 
mail.gmail.com")
-   (let ((current-prefix-arg t))
- (notmuch-show-toggle-visibility-messages)
- (test-visible-output))'
+   (notmuch-show-toggle-visibility-messages)
+   (test-visible-output)'
 test_expect_equal_file OUTPUT 
$EXPECTED/notmuch-show-thread-with-all-messages-collapsed

 test_begin_subtest "notmuch-show: uncollapse all messages in thread"
 test_emacs '(notmuch-show "id:f35dbb950911171435ieecd458o853c873e35f4be95 at 
mail.gmail.com")
(notmuch-show-toggle-visibility-messages)
+   (notmuch-show-toggle-visibility-messages)
(test-visible-output)'
 test_expect_equal_file OUTPUT 
$EXPECTED/notmuch-show-thread-with-all-messages-uncollapsed

-- 
1.7.8.1



[PATCH v2 5/7] emacs: rename `notmuch-show-open-or-close-all' to `notmuch-show-toggle-visibility-messages'

2012-02-22 Thread Pieter Praet
* emacs/notmuch-show.el

  (notmuch-show-open-or-close-all):
Rename to `notmuch-show-toggle-visibility-messages'.

  (notmuch-show-mode-map):
Update "M-RET" binding wrt renamed `notmuch-show-open-or-close-all'.

* test/emacs:

  Update subtests wrt renamed `notmuch-show-open-or-close-all':
  - "notmuch-show: collapse all messages in thread"
  - "notmuch-show: uncollapse all messages in thread"
---
 emacs/notmuch-show.el |4 ++--
 test/emacs|4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 9b879c7..e4d1f9c 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1182,8 +1182,8 @@ (defvar notmuch-show-mode-map
(define-key map "p" 'notmuch-show-previous-open-message)
(define-key map (kbd "DEL") 'notmuch-show-rewind)
(define-key map " " 'notmuch-show-advance-and-archive)
-   (define-key map (kbd "M-RET") 'notmuch-show-open-or-close-all)
(define-key map (kbd "RET") 'notmuch-show-toggle-visibility-message)
+   (define-key map (kbd "M-RET") 'notmuch-show-toggle-visibility-messages)
(define-key map "#" 'notmuch-show-print-message)
(define-key map "!" 'notmuch-show-toggle-elide-non-matching)
(define-key map "$" 'notmuch-show-toggle-process-crypto)
@@ -1668,7 +1668,7 @@ (defun notmuch-show-toggle-visibility-message ()
  (not (plist-get props :message-visible
   (force-window-update))

-(defun notmuch-show-open-or-close-all ()
+(defun notmuch-show-toggle-visibility-messages ()
   "Set the visibility all of the messages in the current thread.
 By default make all of the messages visible. With a prefix
 argument, hide all of the messages."
diff --git a/test/emacs b/test/emacs
index 6f14895..29fdec0 100755
--- a/test/emacs
+++ b/test/emacs
@@ -411,13 +411,13 @@ test_expect_equal_file OUTPUT 
$EXPECTED/notmuch-show-message-with-headers-hidden
 test_begin_subtest "notmuch-show: collapse all messages in thread"
 test_emacs '(notmuch-show "id:f35dbb950911171435ieecd458o853c873e35f4be95 at 
mail.gmail.com")
(let ((current-prefix-arg t))
- (notmuch-show-open-or-close-all)
+ (notmuch-show-toggle-visibility-messages)
  (test-visible-output))'
 test_expect_equal_file OUTPUT 
$EXPECTED/notmuch-show-thread-with-all-messages-collapsed

 test_begin_subtest "notmuch-show: uncollapse all messages in thread"
 test_emacs '(notmuch-show "id:f35dbb950911171435ieecd458o853c873e35f4be95 at 
mail.gmail.com")
-   (notmuch-show-open-or-close-all)
+   (notmuch-show-toggle-visibility-messages)
(test-visible-output)'
 test_expect_equal_file OUTPUT 
$EXPECTED/notmuch-show-thread-with-all-messages-uncollapsed

-- 
1.7.8.1



[PATCH v2 4/7] emacs: rename `notmuch-show-toggle-message' to `notmuch-show-toggle-visibility-message'

2012-02-22 Thread Pieter Praet
* emacs/notmuch-show.el

  (notmuch-show-toggle-message):
Rename to `notmuch-show-toggle-visibility-message'.

  (notmuch-show-mode-map):
Update "RET" binding wrt renamed `notmuch-show-toggle-message'.

* test/emacs:

  Update subtests wrt renamed `notmuch-show-toggle-message':
  - "Hiding message in notmuch-show view"
  - "Hiding message with visible citation in notmuch-show view"
  - "Refresh modified show buffer"
---
 emacs/notmuch-show.el |4 ++--
 test/emacs|8 
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 861018d..9b879c7 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1183,7 +1183,7 @@ (defvar notmuch-show-mode-map
(define-key map (kbd "DEL") 'notmuch-show-rewind)
(define-key map " " 'notmuch-show-advance-and-archive)
(define-key map (kbd "M-RET") 'notmuch-show-open-or-close-all)
-   (define-key map (kbd "RET") 'notmuch-show-toggle-message)
+   (define-key map (kbd "RET") 'notmuch-show-toggle-visibility-message)
(define-key map "#" 'notmuch-show-print-message)
(define-key map "!" 'notmuch-show-toggle-elide-non-matching)
(define-key map "$" 'notmuch-show-toggle-process-crypto)
@@ -1659,7 +1659,7 @@ (defun notmuch-show-toggle-visibility-headers ()
  (not (plist-get props :headers-visible
   (force-window-update))

-(defun notmuch-show-toggle-message ()
+(defun notmuch-show-toggle-visibility-message ()
   "Toggle the visibility of the current message."
   (interactive)
   (let ((props (notmuch-show-get-message-properties)))
diff --git a/test/emacs b/test/emacs
index f17efbd..6f14895 100755
--- a/test/emacs
+++ b/test/emacs
@@ -371,7 +371,7 @@ test_expect_equal_file OUTPUT EXPECTED

 test_begin_subtest "Hiding message in notmuch-show view"
 test_emacs '(notmuch-show "id:f35dbb950911171438k5df6eb56k77b6c0944e2e79ae at 
mail.gmail.com")
-   (notmuch-show-toggle-message)
+   (notmuch-show-toggle-visibility-message)
(test-visible-output)'
 test_expect_equal_file OUTPUT 
$EXPECTED/notmuch-show-thread-with-hidden-messages

@@ -379,7 +379,7 @@ test_begin_subtest "Hiding message with visible citation in 
notmuch-show view"
 test_emacs '(notmuch-show "id:f35dbb950911171438k5df6eb56k77b6c0944e2e79ae at 
mail.gmail.com")
(search-forward "Click/Enter to show.")
(button-activate (button-at (point)))
-   (notmuch-show-toggle-message)
+   (notmuch-show-toggle-visibility-message)
(test-visible-output)'
 test_expect_equal_file OUTPUT 
$EXPECTED/notmuch-show-thread-with-hidden-messages

@@ -496,9 +496,9 @@ test_expect_equal_file OUTPUT EXPECTED
 test_begin_subtest "Refresh modified show buffer"
 test_subtest_known_broken
 test_emacs '(notmuch-show "id:f35dbb950911171438k5df6eb56k77b6c0944e2e79ae at 
mail.gmail.com")
-   (notmuch-show-toggle-message)
+   (notmuch-show-toggle-visibility-message)
(notmuch-show-next-message)
-   (notmuch-show-toggle-message)
+   (notmuch-show-toggle-visibility-message)
(test-visible-output "EXPECTED")
(notmuch-show-refresh-view)
(test-visible-output)'
-- 
1.7.8.1



[PATCH v2 3/7] emacs: rename `notmuch-show-toggle-headers' to `notmuch-show-toggle-visibility-headers'

2012-02-22 Thread Pieter Praet
* emacs/notmuch-show.el

  (notmuch-show-toggle-headers):
Rename to `notmuch-show-toggle-visibility-headers'.

  (notmuch-show-mode-map):
Update "h" binding wrt renamed `notmuch-show-toggle-headers'.

  (notmuch-message-headers):
Update docstring wrt renamed `notmuch-show-toggle-headers'.

  (notmuch-message-headers-visible):
Update docstring wrt renamed `notmuch-show-toggle-headers'.
Also fixed a small typo.

* test/emacs:

  Update subtest wrt renamed `notmuch-show-toggle-headers':
  - "notmuch-show: hide message headers (w/ notmuch-show-toggle-headers)"
---
 emacs/notmuch-show.el |   12 ++--
 test/emacs|4 ++--
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index aa9ccee..861018d 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -48,8 +48,8 @@ (defcustom notmuch-message-headers '("Subject" "To" "Cc" 
"Date")

 For an open message, all of these headers will be made visible
 according to `notmuch-message-headers-visible' or can be toggled
-with `notmuch-show-toggle-headers'. For a closed message, only
-the first header in the list will be visible."
+with `notmuch-show-toggle-visibility-headers'. For a closed message,
+only the first header in the list will be visible."
   :type '(repeat string)
   :group 'notmuch-show)

@@ -59,8 +59,8 @@ (defcustom notmuch-message-headers-visible t
 If this value is non-nil, then all of the headers defined in
 `notmuch-message-headers' will be visible by default in the display
 of each message. Otherwise, these headers will be hidden and
-`notmuch-show-toggle-headers' can be used to make the visible for
-any given message."
+`notmuch-show-toggle-visibility-headers' can be used to make them
+visible for any given message."
   :type 'boolean
   :group 'notmuch-show)

@@ -1168,7 +1168,7 @@ (defvar notmuch-show-mode-map
(define-key map "v" 'notmuch-show-view-all-mime-parts)
(define-key map "c" 'notmuch-show-stash-map)
(define-key map "=" 'notmuch-show-refresh-view)
-   (define-key map "h" 'notmuch-show-toggle-headers)
+   (define-key map "h" 'notmuch-show-toggle-visibility-headers)
(define-key map "*" 'notmuch-show-tag-all)
(define-key map "-" 'notmuch-show-remove-tag)
(define-key map "+" 'notmuch-show-add-tag)
@@ -1650,7 +1650,7 @@ (defun notmuch-show-remove-tag ()
   (interactive)
   (notmuch-show-tag "-"))

-(defun notmuch-show-toggle-headers ()
+(defun notmuch-show-toggle-visibility-headers ()
   "Toggle the visibility of the current message headers."
   (interactive)
   (let ((props (notmuch-show-get-message-properties)))
diff --git a/test/emacs b/test/emacs
index 7d6e6ee..f17efbd 100755
--- a/test/emacs
+++ b/test/emacs
@@ -399,12 +399,12 @@ test_emacs \
   (test-visible-output))'
 test_expect_equal_file OUTPUT 
$EXPECTED/notmuch-show-message-with-headers-hidden

-test_begin_subtest "notmuch-show: hide message headers (w/ 
notmuch-show-toggle-headers)"
+test_begin_subtest "notmuch-show: hide message headers (w/ 
notmuch-show-toggle-visibility-headers)"
 test_emacs \
'(let ((notmuch-message-headers '\''("Subject" "To" "Cc" "Date"))
   (notmuch-message-headers-visible t))
   (notmuch-show "id:f35dbb950911171438k5df6eb56k77b6c0944e2e79ae at 
mail.gmail.com")
-  (notmuch-show-toggle-headers)
+  (notmuch-show-toggle-visibility-headers)
   (test-visible-output))'
 test_expect_equal_file OUTPUT 
$EXPECTED/notmuch-show-message-with-headers-hidden

-- 
1.7.8.1



[PATCH v2 2/7] test: emacs: new tests "notmuch-show: {, un}collapse all messages in thread"

2012-02-22 Thread Pieter Praet
* test/emacs:

  - New subtest "notmuch-show: collapse all messages in thread":
`notmuch-show-open-or-close-all' with prefix arg ("C-u M-RET")
collapses all messages in thread.

  - New subtest "notmuch-show: uncollapse all messages in thread":
`notmuch-show-open-or-close-all' without prefix arg ("M-RET")
uncollapses all messages in thread.
---
 test/emacs |   13 +++
 ...notmuch-show-thread-with-all-messages-collapsed |4 +
 ...tmuch-show-thread-with-all-messages-uncollapsed |   79 
 3 files changed, 96 insertions(+), 0 deletions(-)
 create mode 100644 
test/emacs.expected-output/notmuch-show-thread-with-all-messages-collapsed
 create mode 100644 
test/emacs.expected-output/notmuch-show-thread-with-all-messages-uncollapsed

diff --git a/test/emacs b/test/emacs
index f9ea1c3..7d6e6ee 100755
--- a/test/emacs
+++ b/test/emacs
@@ -408,6 +408,19 @@ test_emacs \
   (test-visible-output))'
 test_expect_equal_file OUTPUT 
$EXPECTED/notmuch-show-message-with-headers-hidden

+test_begin_subtest "notmuch-show: collapse all messages in thread"
+test_emacs '(notmuch-show "id:f35dbb950911171435ieecd458o853c873e35f4be95 at 
mail.gmail.com")
+   (let ((current-prefix-arg t))
+ (notmuch-show-open-or-close-all)
+ (test-visible-output))'
+test_expect_equal_file OUTPUT 
$EXPECTED/notmuch-show-thread-with-all-messages-collapsed
+
+test_begin_subtest "notmuch-show: uncollapse all messages in thread"
+test_emacs '(notmuch-show "id:f35dbb950911171435ieecd458o853c873e35f4be95 at 
mail.gmail.com")
+   (notmuch-show-open-or-close-all)
+   (test-visible-output)'
+test_expect_equal_file OUTPUT 
$EXPECTED/notmuch-show-thread-with-all-messages-uncollapsed
+
 test_begin_subtest "Stashing in notmuch-show"
 add_message '[date]="Sat, 01 Jan 2000 12:00:00 -"' \
 '[from]="Some One "' \
diff --git 
a/test/emacs.expected-output/notmuch-show-thread-with-all-messages-collapsed 
b/test/emacs.expected-output/notmuch-show-thread-with-all-messages-collapsed
new file mode 100644
index 000..73b0e60
--- /dev/null
+++ b/test/emacs.expected-output/notmuch-show-thread-with-all-messages-collapsed
@@ -0,0 +1,4 @@
+Jan Janak  (2009-11-17) (inbox)
+Subject: [notmuch] What a great idea!
+ Jan Janak  (2009-11-17) (inbox)
+ Carl Worth  (2009-11-18) (inbox unread)
diff --git 
a/test/emacs.expected-output/notmuch-show-thread-with-all-messages-uncollapsed 
b/test/emacs.expected-output/notmuch-show-thread-with-all-messages-uncollapsed
new file mode 100644
index 000..bd5598e
--- /dev/null
+++ 
b/test/emacs.expected-output/notmuch-show-thread-with-all-messages-uncollapsed
@@ -0,0 +1,79 @@
+Jan Janak  (2009-11-17) (inbox)
+Subject: [notmuch] What a great idea!
+To: notmuch at notmuchmail.org
+Date: Tue, 17 Nov 2009 23:35:30 +0100
+
+Hello,
+
+First of all, notmuch is a wonderful idea, both the cmdline tool and
+the emacs interface! Thanks a lot for writing it, I was really excited
+when I read the announcement today.
+
+Have you considered sending an announcement to the org-mode mailing list?
+http://org-mode.org
+
+Various ways of searching/referencing emails from emacs were discussed
+there several times and none of them were as elegant as notmuch (not
+even close). Maybe notmuch would attract some of the developers
+there..
+
+   -- Jan
+ Jan Janak  (2009-11-17) (inbox)
+ Subject: [notmuch] What a great idea!
+ To: notmuch at notmuchmail.org
+ Date: Tue, 17 Nov 2009 23:38:47 +0100
+
+ On Tue, Nov 17, 2009 at 11:35 PM, Jan Janak  wrote:
+ > Hello,
+ >
+ > First of all, notmuch is a wonderful idea, both the cmdline tool and
+ [ 2 more citation lines. Click/Enter to show. ]
+ >
+ > Have you considered sending an announcement to the org-mode mailing list?
+ > http://org-mode.org
+
+ Sorry, wrong URL, the correct one is: http://orgmode.org
+
+ > Various ways of searching/referencing emails from emacs were discussed
+ > there several times and none of them were as elegant as notmuch (not
+ > even close). Maybe notmuch would attract some of the developers
+ > there..
+
+   -- Jan
+ Carl Worth  (2009-11-18) (inbox unread)
+ Subject: [notmuch] What a great idea!
+ To: notmuch at notmuchmail.org
+ Date: Wed, 18 Nov 2009 02:49:52 -0800
+
+ On Tue, 17 Nov 2009 23:35:30 +0100, Jan Janak  wrote:
+ > First of all, notmuch is a wonderful idea, both the cmdline tool and
+ > the emacs interface! Thanks a lot for writing it, I was really excited
+ > when I read the announcement today.
+
+ Ah, here's where I planned a nice welcome. So welcome (again), Jan! :-)
+
+ I've been having a lot of fun with notmuch already, (though there have
+ been some days of pain before it was functional enough and my
+ email-reply latency went way up). But regardless---I got through that,
+ and I'm able to work more efficiently with notmuch now than I could with
+ sup before. So I'm happy.
+
+ And I'm delighted when other people find this interesting as well.
+
+ > Have you 

[PATCH v2 1/7] test: emacs: new tests "notmuch-show: {show, hide} message headers"

2012-02-22 Thread Pieter Praet
* test/emacs:

  - New subtest "notmuch-show: show message headers":
Setting `notmuch-message-headers-visible' to t causes all headers
defined in `notmuch-message-headers' to be shown.

  - New subtest "notmuch-show: hide message headers":
Setting `notmuch-message-headers-visible' to nil causes all headers
defined in `notmuch-message-headers' to be hidden.
("Subject:" may be an exception;  See the use of `headers-start' in
`notmuch-show-insert-msg')

  - New subtest "notmuch-show: hide message headers (w/ 
notmuch-show-toggle-headers)":
Setting `notmuch-message-headers-visible' to t causes all headers
defined in `notmuch-message-headers' to be shown, but they can be
hidden for the current message by running `notmuch-show-toggle-headers'.
---
 test/emacs |   25 
 .../notmuch-show-message-with-headers-hidden   |   22 +
 .../notmuch-show-message-with-headers-visible  |   25 
 3 files changed, 72 insertions(+), 0 deletions(-)
 create mode 100644 
test/emacs.expected-output/notmuch-show-message-with-headers-hidden
 create mode 100644 
test/emacs.expected-output/notmuch-show-message-with-headers-visible

diff --git a/test/emacs b/test/emacs
index b74cfa9..f9ea1c3 100755
--- a/test/emacs
+++ b/test/emacs
@@ -383,6 +383,31 @@ test_emacs '(notmuch-show 
"id:f35dbb950911171438k5df6eb56k77b6c0944e2e79ae at mail.
(test-visible-output)'
 test_expect_equal_file OUTPUT 
$EXPECTED/notmuch-show-thread-with-hidden-messages

+test_begin_subtest "notmuch-show: show message headers"
+test_emacs \
+   '(let ((notmuch-message-headers '\''("Subject" "To" "Cc" "Date"))
+  (notmuch-message-headers-visible t))
+  (notmuch-show "id:f35dbb950911171438k5df6eb56k77b6c0944e2e79ae at 
mail.gmail.com")
+  (test-visible-output))'
+test_expect_equal_file OUTPUT 
$EXPECTED/notmuch-show-message-with-headers-visible
+
+test_begin_subtest "notmuch-show: hide message headers"
+test_emacs \
+   '(let ((notmuch-message-headers '\''("Subject" "To" "Cc" "Date"))
+  (notmuch-message-headers-visible nil))
+  (notmuch-show "id:f35dbb950911171438k5df6eb56k77b6c0944e2e79ae at 
mail.gmail.com")
+  (test-visible-output))'
+test_expect_equal_file OUTPUT 
$EXPECTED/notmuch-show-message-with-headers-hidden
+
+test_begin_subtest "notmuch-show: hide message headers (w/ 
notmuch-show-toggle-headers)"
+test_emacs \
+   '(let ((notmuch-message-headers '\''("Subject" "To" "Cc" "Date"))
+  (notmuch-message-headers-visible t))
+  (notmuch-show "id:f35dbb950911171438k5df6eb56k77b6c0944e2e79ae at 
mail.gmail.com")
+  (notmuch-show-toggle-headers)
+  (test-visible-output))'
+test_expect_equal_file OUTPUT 
$EXPECTED/notmuch-show-message-with-headers-hidden
+
 test_begin_subtest "Stashing in notmuch-show"
 add_message '[date]="Sat, 01 Jan 2000 12:00:00 -"' \
 '[from]="Some One "' \
diff --git 
a/test/emacs.expected-output/notmuch-show-message-with-headers-hidden 
b/test/emacs.expected-output/notmuch-show-message-with-headers-hidden
new file mode 100644
index 000..9d7f91b
--- /dev/null
+++ b/test/emacs.expected-output/notmuch-show-message-with-headers-hidden
@@ -0,0 +1,22 @@
+Jan Janak  (2009-11-17) (inbox unread)
+Subject: [notmuch] What a great idea!
+ Jan Janak  (2009-11-17) (inbox)
+
+ On Tue, Nov 17, 2009 at 11:35 PM, Jan Janak  wrote:
+ > Hello,
+ >
+ > First of all, notmuch is a wonderful idea, both the cmdline tool and
+ [ 2 more citation lines. Click/Enter to show. ]
+ >
+ > Have you considered sending an announcement to the org-mode mailing list?
+ > http://org-mode.org
+
+ Sorry, wrong URL, the correct one is: http://orgmode.org
+
+ > Various ways of searching/referencing emails from emacs were discussed
+ > there several times and none of them were as elegant as notmuch (not
+ > even close). Maybe notmuch would attract some of the developers
+ > there..
+
+   -- Jan
+ Carl Worth  (2009-11-18) (inbox unread)
diff --git 
a/test/emacs.expected-output/notmuch-show-message-with-headers-visible 
b/test/emacs.expected-output/notmuch-show-message-with-headers-visible
new file mode 100644
index 000..8efbd60
--- /dev/null
+++ b/test/emacs.expected-output/notmuch-show-message-with-headers-visible
@@ -0,0 +1,25 @@
+Jan Janak  (2009-11-17) (inbox unread)
+Subject: [notmuch] What a great idea!
+ Jan Janak  (2009-11-17) (inbox)
+ Subject: [notmuch] What a great idea!
+ To: notmuch at notmuchmail.org
+ Date: Tue, 17 Nov 2009 23:38:47 +0100
+
+ On Tue, Nov 17, 2009 at 11:35 PM, Jan Janak  wrote:
+ > Hello,
+ >
+ > First of all, notmuch is a wonderful idea, both the cmdline tool and
+ [ 2 more citation lines. Click/Enter to show. ]
+ >
+ > Have you considered sending an announcement to the org-mode mailing list?
+ > http://org-mode.org
+
+ Sorry, wrong URL, the correct one is: http://orgmode.org
+
+ > Various 

[PATCH] emacs: make `notmuch-show-open-or-close-all' toggle visibility

2012-02-22 Thread Pieter Praet
On Mon, 13 Feb 2012 14:51:17 +0400, Dmitry Kurochkin  wrote:
> Hi Pieter.
> 
> On Wed, 25 Jan 2012 06:25:39 +0100, Pieter Praet  wrote:
> > * emacs/notmuch-show.el (notmuch-show-open-or-close-all):
> >   Rename to `notmuch-show-toggle-all-messages', and make it toggle
> >   visibility of all messages based on the visibility of the current
> >   message, instead of setting visibility based on whether or not a
> >   prefix arg was supplied.
> > 
> > Same functionality, less effort (reaching for 'C-u' is a pain)...
> > 
> > ---
> >  emacs/notmuch-show.el |   22 --
> >  1 files changed, 12 insertions(+), 10 deletions(-)
> > 
> > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> > index e6a5b31..2d17f74 100644
> > --- a/emacs/notmuch-show.el
> > +++ b/emacs/notmuch-show.el
> > @@ -1050,8 +1050,8 @@ thread id.  If a prefix is given, crypto processing 
> > is toggled."
> > (define-key map "p" 'notmuch-show-previous-open-message)
> > (define-key map (kbd "DEL") 'notmuch-show-rewind)
> > (define-key map " " 'notmuch-show-advance-and-archive)
> > -   (define-key map (kbd "M-RET") 'notmuch-show-open-or-close-all)
> > (define-key map (kbd "RET") 'notmuch-show-toggle-message)
> > +   (define-key map (kbd "M-RET") 'notmuch-show-toggle-all-messages)
> 
> Should the function name include "visible" or "visibility" to make it
> clear what is toggled?  E.g. `notmuch-show-toggle-visibility-all'.
> 
> Also, consider changing "all-messages" to just "all" or "thread".  That
> seems to be more consistent with other functions.
>

Good point, but we also have `notmuch-show-toggle-message' and
`notmuch-show-toggle-headers', so `notmuch-show-toggle-visibility-all'
would imply that both messages as well as headers are toggled.

Also, `notmuch-show-toggle-visibility-thread' sounds to me like
it would toggle the thread itself instead of the messages of
which it is composed, so my personal expectation would be that
it just blanks the entire buffer. (what's in a name)

How about renaming the relevant functions like so:
- `notmuch-show-toggle-headers'-> `notmuch-show-toggle-visibility-headers'
- `notmuch-show-toggle-message'-> `notmuch-show-toggle-visibility-message'
- `notmuch-show-open-or-close-all' -> `notmuch-show-toggle-visibility-messages'

> > (define-key map "#" 'notmuch-show-print-message)
> > map)
> >"Keymap for \"notmuch show\" buffers.")
> > @@ -1502,16 +1502,18 @@ the result."
> >   (not (plist-get props :message-visible
> >(force-window-update))
> >  
> > -(defun notmuch-show-open-or-close-all ()
> > -  "Set the visibility all of the messages in the current thread.
> > -By default make all of the messages visible. With a prefix
> > -argument, hide all of the messages."
> > +(defun notmuch-show-toggle-all-messages ()
> > +  "Toggle the visibility of all messages in the current thread.
> > +If the current message is visible, hide all messages -- and vice versa."
> >(interactive)
> > -  (save-excursion
> > -(goto-char (point-min))
> > -(loop do (notmuch-show-message-visible 
> > (notmuch-show-get-message-properties)
> > -  (not current-prefix-arg))
> > - until (not (notmuch-show-goto-message-next
> > +  (let ((toggle (notmuch-show-message-visible-p)))
> 
> Please rename "toggle" to "visible-p".  That would make it more clear
> what the variable means, and is consistent with
> `notmuch-show-message-visible-p'.
>

AFAIK the '-p' suffix is "reserved" for predicate functions, and
using it for a variable could be confusing.  But I'm not aware of
any guidelines on indicating the variable type except when it
stores one or more functions [1,2]...

Perhaps we could call it `visible-bool' ?

Anyways, I've gone with your suggestion: `visible-p' it is...

> > +(save-excursion
> > +  (goto-char (point-min))
> > +  (loop do (notmuch-show-message-visible
> > +   (notmuch-show-get-message-properties)
> > +   (not toggle))
> > +   until (not (notmuch-show-goto-message-next)
> 
> A new `notmuch-show-mapc' function was introduced in a recent commit.
> Please use it here instead of a custom loop.
>

Nice!

> > +  (recenter-top-bottom 1)
> 
> There was no `recenter-top-bottom' call before.  Why is it needed now?
> It seems like an independent change and, if it is needed, would be
>

Re: [PATCH] emacs: make `notmuch-show-open-or-close-all' toggle visibility

2012-02-22 Thread Pieter Praet
On Mon, 13 Feb 2012 14:51:17 +0400, Dmitry Kurochkin 
dmitry.kuroch...@gmail.com wrote:
 Hi Pieter.
 
 On Wed, 25 Jan 2012 06:25:39 +0100, Pieter Praet pie...@praet.org wrote:
  * emacs/notmuch-show.el (notmuch-show-open-or-close-all):
Rename to `notmuch-show-toggle-all-messages', and make it toggle
visibility of all messages based on the visibility of the current
message, instead of setting visibility based on whether or not a
prefix arg was supplied.
  
  Same functionality, less effort (reaching for 'C-u' is a pain)...
  
  ---
   emacs/notmuch-show.el |   22 --
   1 files changed, 12 insertions(+), 10 deletions(-)
  
  diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
  index e6a5b31..2d17f74 100644
  --- a/emacs/notmuch-show.el
  +++ b/emacs/notmuch-show.el
  @@ -1050,8 +1050,8 @@ thread id.  If a prefix is given, crypto processing 
  is toggled.
  (define-key map p 'notmuch-show-previous-open-message)
  (define-key map (kbd DEL) 'notmuch-show-rewind)
  (define-key map   'notmuch-show-advance-and-archive)
  -   (define-key map (kbd M-RET) 'notmuch-show-open-or-close-all)
  (define-key map (kbd RET) 'notmuch-show-toggle-message)
  +   (define-key map (kbd M-RET) 'notmuch-show-toggle-all-messages)
 
 Should the function name include visible or visibility to make it
 clear what is toggled?  E.g. `notmuch-show-toggle-visibility-all'.
 
 Also, consider changing all-messages to just all or thread.  That
 seems to be more consistent with other functions.


Good point, but we also have `notmuch-show-toggle-message' and
`notmuch-show-toggle-headers', so `notmuch-show-toggle-visibility-all'
would imply that both messages as well as headers are toggled.

Also, `notmuch-show-toggle-visibility-thread' sounds to me like
it would toggle the thread itself instead of the messages of
which it is composed, so my personal expectation would be that
it just blanks the entire buffer. (what's in a name)

How about renaming the relevant functions like so:
- `notmuch-show-toggle-headers'- `notmuch-show-toggle-visibility-headers'
- `notmuch-show-toggle-message'- `notmuch-show-toggle-visibility-message'
- `notmuch-show-open-or-close-all' - `notmuch-show-toggle-visibility-messages'

  (define-key map # 'notmuch-show-print-message)
  map)
 Keymap for \notmuch show\ buffers.)
  @@ -1502,16 +1502,18 @@ the result.
(not (plist-get props :message-visible
 (force-window-update))
   
  -(defun notmuch-show-open-or-close-all ()
  -  Set the visibility all of the messages in the current thread.
  -By default make all of the messages visible. With a prefix
  -argument, hide all of the messages.
  +(defun notmuch-show-toggle-all-messages ()
  +  Toggle the visibility of all messages in the current thread.
  +If the current message is visible, hide all messages -- and vice versa.
 (interactive)
  -  (save-excursion
  -(goto-char (point-min))
  -(loop do (notmuch-show-message-visible 
  (notmuch-show-get-message-properties)
  -  (not current-prefix-arg))
  - until (not (notmuch-show-goto-message-next
  +  (let ((toggle (notmuch-show-message-visible-p)))
 
 Please rename toggle to visible-p.  That would make it more clear
 what the variable means, and is consistent with
 `notmuch-show-message-visible-p'.


AFAIK the '-p' suffix is reserved for predicate functions, and
using it for a variable could be confusing.  But I'm not aware of
any guidelines on indicating the variable type except when it
stores one or more functions [1,2]...

Perhaps we could call it `visible-bool' ?

Anyways, I've gone with your suggestion: `visible-p' it is...

  +(save-excursion
  +  (goto-char (point-min))
  +  (loop do (notmuch-show-message-visible
  +   (notmuch-show-get-message-properties)
  +   (not toggle))
  +   until (not (notmuch-show-goto-message-next)
 
 A new `notmuch-show-mapc' function was introduced in a recent commit.
 Please use it here instead of a custom loop.


Nice!

  +  (recenter-top-bottom 1)
 
 There was no `recenter-top-bottom' call before.  Why is it needed now?
 It seems like an independent change and, if it is needed, would be
 better as a separate patch.  At the very least, it's worth mentioning in
 the preamble and perhaps in a comment.


It ensures that the message being uncollapsed is put properly in view
(instead of starting somewhere in the middle of the buffer) whilst also
making it obvious that/if/when there's previous messages in the thread
(due to its argument being 1 instead of 0).

I thought about using `notmuch-show-message-adjust' instead, but that
obscures the fact that there's previous messages.

As it's quite essential in making the function DTRT, I've opted to
clarify it in a comment as well as the commit message instead of
splitting it out into a separate patch.

 Regards,
   Dmitry
 
 (force-window-update))
   
   (defun

[PATCH v2 2/7] test: emacs: new tests notmuch-show: {, un}collapse all messages in thread

2012-02-22 Thread Pieter Praet
* test/emacs:

  - New subtest notmuch-show: collapse all messages in thread:
`notmuch-show-open-or-close-all' with prefix arg (C-u M-RET)
collapses all messages in thread.

  - New subtest notmuch-show: uncollapse all messages in thread:
`notmuch-show-open-or-close-all' without prefix arg (M-RET)
uncollapses all messages in thread.
---
 test/emacs |   13 +++
 ...notmuch-show-thread-with-all-messages-collapsed |4 +
 ...tmuch-show-thread-with-all-messages-uncollapsed |   79 
 3 files changed, 96 insertions(+), 0 deletions(-)
 create mode 100644 
test/emacs.expected-output/notmuch-show-thread-with-all-messages-collapsed
 create mode 100644 
test/emacs.expected-output/notmuch-show-thread-with-all-messages-uncollapsed

diff --git a/test/emacs b/test/emacs
index f9ea1c3..7d6e6ee 100755
--- a/test/emacs
+++ b/test/emacs
@@ -408,6 +408,19 @@ test_emacs \
   (test-visible-output))'
 test_expect_equal_file OUTPUT 
$EXPECTED/notmuch-show-message-with-headers-hidden
 
+test_begin_subtest notmuch-show: collapse all messages in thread
+test_emacs '(notmuch-show 
id:f35dbb950911171435ieecd458o853c873e35f4b...@mail.gmail.com)
+   (let ((current-prefix-arg t))
+ (notmuch-show-open-or-close-all)
+ (test-visible-output))'
+test_expect_equal_file OUTPUT 
$EXPECTED/notmuch-show-thread-with-all-messages-collapsed
+
+test_begin_subtest notmuch-show: uncollapse all messages in thread
+test_emacs '(notmuch-show 
id:f35dbb950911171435ieecd458o853c873e35f4b...@mail.gmail.com)
+   (notmuch-show-open-or-close-all)
+   (test-visible-output)'
+test_expect_equal_file OUTPUT 
$EXPECTED/notmuch-show-thread-with-all-messages-uncollapsed
+
 test_begin_subtest Stashing in notmuch-show
 add_message '[date]=Sat, 01 Jan 2000 12:00:00 -' \
 '[from]=Some One some...@somewhere.org' \
diff --git 
a/test/emacs.expected-output/notmuch-show-thread-with-all-messages-collapsed 
b/test/emacs.expected-output/notmuch-show-thread-with-all-messages-collapsed
new file mode 100644
index 000..73b0e60
--- /dev/null
+++ b/test/emacs.expected-output/notmuch-show-thread-with-all-messages-collapsed
@@ -0,0 +1,4 @@
+Jan Janak j...@ryngle.com (2009-11-17) (inbox)
+Subject: [notmuch] What a great idea!
+ Jan Janak j...@ryngle.com (2009-11-17) (inbox)
+ Carl Worth cwo...@cworth.org (2009-11-18) (inbox unread)
diff --git 
a/test/emacs.expected-output/notmuch-show-thread-with-all-messages-uncollapsed 
b/test/emacs.expected-output/notmuch-show-thread-with-all-messages-uncollapsed
new file mode 100644
index 000..bd5598e
--- /dev/null
+++ 
b/test/emacs.expected-output/notmuch-show-thread-with-all-messages-uncollapsed
@@ -0,0 +1,79 @@
+Jan Janak j...@ryngle.com (2009-11-17) (inbox)
+Subject: [notmuch] What a great idea!
+To: notmuch@notmuchmail.org
+Date: Tue, 17 Nov 2009 23:35:30 +0100
+
+Hello,
+
+First of all, notmuch is a wonderful idea, both the cmdline tool and
+the emacs interface! Thanks a lot for writing it, I was really excited
+when I read the announcement today.
+
+Have you considered sending an announcement to the org-mode mailing list?
+http://org-mode.org
+
+Various ways of searching/referencing emails from emacs were discussed
+there several times and none of them were as elegant as notmuch (not
+even close). Maybe notmuch would attract some of the developers
+there..
+
+   -- Jan
+ Jan Janak j...@ryngle.com (2009-11-17) (inbox)
+ Subject: [notmuch] What a great idea!
+ To: notmuch@notmuchmail.org
+ Date: Tue, 17 Nov 2009 23:38:47 +0100
+
+ On Tue, Nov 17, 2009 at 11:35 PM, Jan Janak jan at ryngle.com wrote:
+  Hello,
+ 
+  First of all, notmuch is a wonderful idea, both the cmdline tool and
+ [ 2 more citation lines. Click/Enter to show. ]
+ 
+  Have you considered sending an announcement to the org-mode mailing list?
+  http://org-mode.org
+
+ Sorry, wrong URL, the correct one is: http://orgmode.org
+
+  Various ways of searching/referencing emails from emacs were discussed
+  there several times and none of them were as elegant as notmuch (not
+  even close). Maybe notmuch would attract some of the developers
+  there..
+
+   -- Jan
+ Carl Worth cwo...@cworth.org (2009-11-18) (inbox unread)
+ Subject: [notmuch] What a great idea!
+ To: notmuch@notmuchmail.org
+ Date: Wed, 18 Nov 2009 02:49:52 -0800
+
+ On Tue, 17 Nov 2009 23:35:30 +0100, Jan Janak jan at ryngle.com wrote:
+  First of all, notmuch is a wonderful idea, both the cmdline tool and
+  the emacs interface! Thanks a lot for writing it, I was really excited
+  when I read the announcement today.
+
+ Ah, here's where I planned a nice welcome. So welcome (again), Jan! :-)
+
+ I've been having a lot of fun with notmuch already, (though there have
+ been some days of pain before it was functional enough and my
+ email-reply latency went way up). But regardless---I got through that,
+ and I'm able to work more efficiently with notmuch now than I could with
+ sup before. So 

[PATCH v2 1/7] test: emacs: new tests notmuch-show: {show, hide} message headers

2012-02-22 Thread Pieter Praet
* test/emacs:

  - New subtest notmuch-show: show message headers:
Setting `notmuch-message-headers-visible' to t causes all headers
defined in `notmuch-message-headers' to be shown.

  - New subtest notmuch-show: hide message headers:
Setting `notmuch-message-headers-visible' to nil causes all headers
defined in `notmuch-message-headers' to be hidden.
(Subject: may be an exception;  See the use of `headers-start' in
`notmuch-show-insert-msg')

  - New subtest notmuch-show: hide message headers (w/ 
notmuch-show-toggle-headers):
Setting `notmuch-message-headers-visible' to t causes all headers
defined in `notmuch-message-headers' to be shown, but they can be
hidden for the current message by running `notmuch-show-toggle-headers'.
---
 test/emacs |   25 
 .../notmuch-show-message-with-headers-hidden   |   22 +
 .../notmuch-show-message-with-headers-visible  |   25 
 3 files changed, 72 insertions(+), 0 deletions(-)
 create mode 100644 
test/emacs.expected-output/notmuch-show-message-with-headers-hidden
 create mode 100644 
test/emacs.expected-output/notmuch-show-message-with-headers-visible

diff --git a/test/emacs b/test/emacs
index b74cfa9..f9ea1c3 100755
--- a/test/emacs
+++ b/test/emacs
@@ -383,6 +383,31 @@ test_emacs '(notmuch-show 
id:f35dbb950911171438k5df6eb56k77b6c0944e2e79ae@mail.
(test-visible-output)'
 test_expect_equal_file OUTPUT 
$EXPECTED/notmuch-show-thread-with-hidden-messages
 
+test_begin_subtest notmuch-show: show message headers
+test_emacs \
+   '(let ((notmuch-message-headers '\''(Subject To Cc Date))
+  (notmuch-message-headers-visible t))
+  (notmuch-show 
id:f35dbb950911171438k5df6eb56k77b6c0944e2e7...@mail.gmail.com)
+  (test-visible-output))'
+test_expect_equal_file OUTPUT 
$EXPECTED/notmuch-show-message-with-headers-visible
+
+test_begin_subtest notmuch-show: hide message headers
+test_emacs \
+   '(let ((notmuch-message-headers '\''(Subject To Cc Date))
+  (notmuch-message-headers-visible nil))
+  (notmuch-show 
id:f35dbb950911171438k5df6eb56k77b6c0944e2e7...@mail.gmail.com)
+  (test-visible-output))'
+test_expect_equal_file OUTPUT 
$EXPECTED/notmuch-show-message-with-headers-hidden
+
+test_begin_subtest notmuch-show: hide message headers (w/ 
notmuch-show-toggle-headers)
+test_emacs \
+   '(let ((notmuch-message-headers '\''(Subject To Cc Date))
+  (notmuch-message-headers-visible t))
+  (notmuch-show 
id:f35dbb950911171438k5df6eb56k77b6c0944e2e7...@mail.gmail.com)
+  (notmuch-show-toggle-headers)
+  (test-visible-output))'
+test_expect_equal_file OUTPUT 
$EXPECTED/notmuch-show-message-with-headers-hidden
+
 test_begin_subtest Stashing in notmuch-show
 add_message '[date]=Sat, 01 Jan 2000 12:00:00 -' \
 '[from]=Some One some...@somewhere.org' \
diff --git 
a/test/emacs.expected-output/notmuch-show-message-with-headers-hidden 
b/test/emacs.expected-output/notmuch-show-message-with-headers-hidden
new file mode 100644
index 000..9d7f91b
--- /dev/null
+++ b/test/emacs.expected-output/notmuch-show-message-with-headers-hidden
@@ -0,0 +1,22 @@
+Jan Janak j...@ryngle.com (2009-11-17) (inbox unread)
+Subject: [notmuch] What a great idea!
+ Jan Janak j...@ryngle.com (2009-11-17) (inbox)
+
+ On Tue, Nov 17, 2009 at 11:35 PM, Jan Janak jan at ryngle.com wrote:
+  Hello,
+ 
+  First of all, notmuch is a wonderful idea, both the cmdline tool and
+ [ 2 more citation lines. Click/Enter to show. ]
+ 
+  Have you considered sending an announcement to the org-mode mailing list?
+  http://org-mode.org
+
+ Sorry, wrong URL, the correct one is: http://orgmode.org
+
+  Various ways of searching/referencing emails from emacs were discussed
+  there several times and none of them were as elegant as notmuch (not
+  even close). Maybe notmuch would attract some of the developers
+  there..
+
+   -- Jan
+ Carl Worth cwo...@cworth.org (2009-11-18) (inbox unread)
diff --git 
a/test/emacs.expected-output/notmuch-show-message-with-headers-visible 
b/test/emacs.expected-output/notmuch-show-message-with-headers-visible
new file mode 100644
index 000..8efbd60
--- /dev/null
+++ b/test/emacs.expected-output/notmuch-show-message-with-headers-visible
@@ -0,0 +1,25 @@
+Jan Janak j...@ryngle.com (2009-11-17) (inbox unread)
+Subject: [notmuch] What a great idea!
+ Jan Janak j...@ryngle.com (2009-11-17) (inbox)
+ Subject: [notmuch] What a great idea!
+ To: notmuch@notmuchmail.org
+ Date: Tue, 17 Nov 2009 23:38:47 +0100
+
+ On Tue, Nov 17, 2009 at 11:35 PM, Jan Janak jan at ryngle.com wrote:
+  Hello,
+ 
+  First of all, notmuch is a wonderful idea, both the cmdline tool and
+ [ 2 more citation lines. Click/Enter to show. ]
+ 
+  Have you considered sending an announcement to the org-mode mailing list?
+  http://org-mode.org
+
+ Sorry, wrong URL, the 

[PATCH v2 4/7] emacs: rename `notmuch-show-toggle-message' to `notmuch-show-toggle-visibility-message'

2012-02-22 Thread Pieter Praet
* emacs/notmuch-show.el

  (notmuch-show-toggle-message):
Rename to `notmuch-show-toggle-visibility-message'.

  (notmuch-show-mode-map):
Update RET binding wrt renamed `notmuch-show-toggle-message'.

* test/emacs:

  Update subtests wrt renamed `notmuch-show-toggle-message':
  - Hiding message in notmuch-show view
  - Hiding message with visible citation in notmuch-show view
  - Refresh modified show buffer
---
 emacs/notmuch-show.el |4 ++--
 test/emacs|8 
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 861018d..9b879c7 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1183,7 +1183,7 @@ (defvar notmuch-show-mode-map
(define-key map (kbd DEL) 'notmuch-show-rewind)
(define-key map   'notmuch-show-advance-and-archive)
(define-key map (kbd M-RET) 'notmuch-show-open-or-close-all)
-   (define-key map (kbd RET) 'notmuch-show-toggle-message)
+   (define-key map (kbd RET) 'notmuch-show-toggle-visibility-message)
(define-key map # 'notmuch-show-print-message)
(define-key map ! 'notmuch-show-toggle-elide-non-matching)
(define-key map $ 'notmuch-show-toggle-process-crypto)
@@ -1659,7 +1659,7 @@ (defun notmuch-show-toggle-visibility-headers ()
  (not (plist-get props :headers-visible
   (force-window-update))
 
-(defun notmuch-show-toggle-message ()
+(defun notmuch-show-toggle-visibility-message ()
   Toggle the visibility of the current message.
   (interactive)
   (let ((props (notmuch-show-get-message-properties)))
diff --git a/test/emacs b/test/emacs
index f17efbd..6f14895 100755
--- a/test/emacs
+++ b/test/emacs
@@ -371,7 +371,7 @@ test_expect_equal_file OUTPUT EXPECTED
 
 test_begin_subtest Hiding message in notmuch-show view
 test_emacs '(notmuch-show 
id:f35dbb950911171438k5df6eb56k77b6c0944e2e7...@mail.gmail.com)
-   (notmuch-show-toggle-message)
+   (notmuch-show-toggle-visibility-message)
(test-visible-output)'
 test_expect_equal_file OUTPUT 
$EXPECTED/notmuch-show-thread-with-hidden-messages
 
@@ -379,7 +379,7 @@ test_begin_subtest Hiding message with visible citation in 
notmuch-show view
 test_emacs '(notmuch-show 
id:f35dbb950911171438k5df6eb56k77b6c0944e2e7...@mail.gmail.com)
(search-forward Click/Enter to show.)
(button-activate (button-at (point)))
-   (notmuch-show-toggle-message)
+   (notmuch-show-toggle-visibility-message)
(test-visible-output)'
 test_expect_equal_file OUTPUT 
$EXPECTED/notmuch-show-thread-with-hidden-messages
 
@@ -496,9 +496,9 @@ test_expect_equal_file OUTPUT EXPECTED
 test_begin_subtest Refresh modified show buffer
 test_subtest_known_broken
 test_emacs '(notmuch-show 
id:f35dbb950911171438k5df6eb56k77b6c0944e2e7...@mail.gmail.com)
-   (notmuch-show-toggle-message)
+   (notmuch-show-toggle-visibility-message)
(notmuch-show-next-message)
-   (notmuch-show-toggle-message)
+   (notmuch-show-toggle-visibility-message)
(test-visible-output EXPECTED)
(notmuch-show-refresh-view)
(test-visible-output)'
-- 
1.7.8.1

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


[PATCH v2 6/7] emacs: make `notmuch-show-toggle-visibility-messages' live up to its new name

2012-02-22 Thread Pieter Praet
* emacs/notmuch-show.el (notmuch-show-toggle-visibility-messages):
  Toggle visibility of all messages in current thread based on visibility
  of the current message, instead of setting visibility based on whether
  or not a prefix arg was supplied.

  Also move current buffer line to the 2nd window line so the current
  message is put properly into focus, whilst making the presence of
  previous messages in the thread obvious.

Same functionality, less effort (reaching for 'C-u' is a pain)...
---
 emacs/notmuch-show.el |   20 
 test/emacs|6 +++---
 2 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index e4d1f9c..82d4265 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1669,15 +1669,19 @@ (defun notmuch-show-toggle-visibility-message ()
   (force-window-update))
 
 (defun notmuch-show-toggle-visibility-messages ()
-  Set the visibility all of the messages in the current thread.
-By default make all of the messages visible. With a prefix
-argument, hide all of the messages.
+  Toggle the visibility of all messages in the current thread.
+If the current message is visible, hide all messages -- and vice versa.
   (interactive)
-  (save-excursion
-(goto-char (point-min))
-(loop do (notmuch-show-message-visible 
(notmuch-show-get-message-properties)
-  (not current-prefix-arg))
- until (not (notmuch-show-goto-message-next
+  (let ((visible-p (notmuch-show-message-visible-p)))
+(notmuch-show-mapc
+ (lambda () (notmuch-show-message-visible
+(notmuch-show-get-message-properties)
+(not visible-p)
+
+  ;; Put the current message properly into focus, but don't
+  ;; obscure the presence of previous messages in the thread.
+  (recenter-top-bottom 1)
+
   (force-window-update))
 
 (defun notmuch-show-next-button ()
diff --git a/test/emacs b/test/emacs
index 29fdec0..5c61743 100755
--- a/test/emacs
+++ b/test/emacs
@@ -410,14 +410,14 @@ test_expect_equal_file OUTPUT 
$EXPECTED/notmuch-show-message-with-headers-hidden
 
 test_begin_subtest notmuch-show: collapse all messages in thread
 test_emacs '(notmuch-show 
id:f35dbb950911171435ieecd458o853c873e35f4b...@mail.gmail.com)
-   (let ((current-prefix-arg t))
- (notmuch-show-toggle-visibility-messages)
- (test-visible-output))'
+   (notmuch-show-toggle-visibility-messages)
+   (test-visible-output)'
 test_expect_equal_file OUTPUT 
$EXPECTED/notmuch-show-thread-with-all-messages-collapsed
 
 test_begin_subtest notmuch-show: uncollapse all messages in thread
 test_emacs '(notmuch-show 
id:f35dbb950911171435ieecd458o853c873e35f4b...@mail.gmail.com)
(notmuch-show-toggle-visibility-messages)
+   (notmuch-show-toggle-visibility-messages)
(test-visible-output)'
 test_expect_equal_file OUTPUT 
$EXPECTED/notmuch-show-thread-with-all-messages-uncollapsed
 
-- 
1.7.8.1

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


[PATCH v2 7/7] emacs: `notmuch-show-toggle-visibility-messages' with prefix arg filters by tag

2012-02-22 Thread Pieter Praet
* emacs/notmuch-show.el (notmuch-show-toggle-visibility-messages):
  When provided with a prefix arg, prompt the user for a tag.
  Show all messages that have it and hide those that don't.
---
 emacs/notmuch-show.el |   13 ++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 82d4265..b5e482b 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -38,6 +38,7 @@
 
 (declare-function notmuch-call-notmuch-process notmuch (rest args))
 (declare-function notmuch-fontify-headers notmuch nil)
+(declare-function notmuch-select-tag-with-completion notmuch (prompt rest 
search-terms))
 (declare-function notmuch-read-tag-changes notmuch (optional initial-input 
rest search-terms))
 (declare-function notmuch-search-next-thread notmuch nil)
 (declare-function notmuch-search-show-thread notmuch nil)
@@ -1670,13 +1671,19 @@ (defun notmuch-show-toggle-visibility-message ()
 
 (defun notmuch-show-toggle-visibility-messages ()
   Toggle the visibility of all messages in the current thread.
-If the current message is visible, hide all messages -- and vice versa.
+If the current message is visible, hide all messages -- and vice versa.
+
+With a prefix argument, prompt for a tag and only show messages which have it.
   (interactive)
-  (let ((visible-p (notmuch-show-message-visible-p)))
+  (let ((visible-p (notmuch-show-message-visible-p))
+   (filter (if current-prefix-arg
+   (notmuch-select-tag-with-completion Filter by tag: 
 (notmuch-show-mapc
  (lambda () (notmuch-show-message-visible
 (notmuch-show-get-message-properties)
-(not visible-p)
+(if current-prefix-arg
+(member filter (notmuch-show-get-tags))
+  (not visible-p))
 
   ;; Put the current message properly into focus, but don't
   ;; obscure the presence of previous messages in the thread.
-- 
1.7.8.1

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


[PATCH v2 3/7] emacs: rename `notmuch-show-toggle-headers' to `notmuch-show-toggle-visibility-headers'

2012-02-22 Thread Pieter Praet
* emacs/notmuch-show.el

  (notmuch-show-toggle-headers):
Rename to `notmuch-show-toggle-visibility-headers'.

  (notmuch-show-mode-map):
Update h binding wrt renamed `notmuch-show-toggle-headers'.

  (notmuch-message-headers):
Update docstring wrt renamed `notmuch-show-toggle-headers'.

  (notmuch-message-headers-visible):
Update docstring wrt renamed `notmuch-show-toggle-headers'.
Also fixed a small typo.

* test/emacs:

  Update subtest wrt renamed `notmuch-show-toggle-headers':
  - notmuch-show: hide message headers (w/ notmuch-show-toggle-headers)
---
 emacs/notmuch-show.el |   12 ++--
 test/emacs|4 ++--
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index aa9ccee..861018d 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -48,8 +48,8 @@ (defcustom notmuch-message-headers '(Subject To Cc 
Date)
 
 For an open message, all of these headers will be made visible
 according to `notmuch-message-headers-visible' or can be toggled
-with `notmuch-show-toggle-headers'. For a closed message, only
-the first header in the list will be visible.
+with `notmuch-show-toggle-visibility-headers'. For a closed message,
+only the first header in the list will be visible.
   :type '(repeat string)
   :group 'notmuch-show)
 
@@ -59,8 +59,8 @@ (defcustom notmuch-message-headers-visible t
 If this value is non-nil, then all of the headers defined in
 `notmuch-message-headers' will be visible by default in the display
 of each message. Otherwise, these headers will be hidden and
-`notmuch-show-toggle-headers' can be used to make the visible for
-any given message.
+`notmuch-show-toggle-visibility-headers' can be used to make them
+visible for any given message.
   :type 'boolean
   :group 'notmuch-show)
 
@@ -1168,7 +1168,7 @@ (defvar notmuch-show-mode-map
(define-key map v 'notmuch-show-view-all-mime-parts)
(define-key map c 'notmuch-show-stash-map)
(define-key map = 'notmuch-show-refresh-view)
-   (define-key map h 'notmuch-show-toggle-headers)
+   (define-key map h 'notmuch-show-toggle-visibility-headers)
(define-key map * 'notmuch-show-tag-all)
(define-key map - 'notmuch-show-remove-tag)
(define-key map + 'notmuch-show-add-tag)
@@ -1650,7 +1650,7 @@ (defun notmuch-show-remove-tag ()
   (interactive)
   (notmuch-show-tag -))
 
-(defun notmuch-show-toggle-headers ()
+(defun notmuch-show-toggle-visibility-headers ()
   Toggle the visibility of the current message headers.
   (interactive)
   (let ((props (notmuch-show-get-message-properties)))
diff --git a/test/emacs b/test/emacs
index 7d6e6ee..f17efbd 100755
--- a/test/emacs
+++ b/test/emacs
@@ -399,12 +399,12 @@ test_emacs \
   (test-visible-output))'
 test_expect_equal_file OUTPUT 
$EXPECTED/notmuch-show-message-with-headers-hidden
 
-test_begin_subtest notmuch-show: hide message headers (w/ 
notmuch-show-toggle-headers)
+test_begin_subtest notmuch-show: hide message headers (w/ 
notmuch-show-toggle-visibility-headers)
 test_emacs \
'(let ((notmuch-message-headers '\''(Subject To Cc Date))
   (notmuch-message-headers-visible t))
   (notmuch-show 
id:f35dbb950911171438k5df6eb56k77b6c0944e2e7...@mail.gmail.com)
-  (notmuch-show-toggle-headers)
+  (notmuch-show-toggle-visibility-headers)
   (test-visible-output))'
 test_expect_equal_file OUTPUT 
$EXPECTED/notmuch-show-message-with-headers-hidden
 
-- 
1.7.8.1

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


Re: [PATCH v2 2/4] test: emacs: new test notmuch-search: replying to a thread (sending)

2012-02-22 Thread Pieter Praet
On Sun, 19 Feb 2012 23:04:38 +0200, Tomi Ollila tomi.oll...@iki.fi wrote:
 On Sun, 19 Feb 2012 21:38:26 +0100, Pieter Praet pie...@praet.org wrote:
  As pointed out in the previous commit, the test for replying from
  within Emacs didn't actually submit the reply. This one does.
  ---
   test/emacs |   41 +
   1 files changed, 41 insertions(+), 0 deletions(-)
  
  diff --git a/test/emacs b/test/emacs
  index 308d749..0f4f42b 100755
  --- a/test/emacs
  +++ b/test/emacs
  @@ -273,6 +273,47 @@ On 01 Jan 2000 12:00:00 -, Notmuch Test Suite 
  test_su...@notmuchmail.org w
   EOF
   test_expect_equal_file OUTPUT EXPECTED
   
  +test_begin_subtest notmuch-search: replying to a thread (sending)
  +$TEST_DIRECTORY/smtp-dummy sent_message 
  +smtp_dummy_pid=$!
  +test_emacs \
  +'(let ((message-send-mail-function '\''message-smtpmail-send-it)
  +   (smtpmail-smtp-server localhost)
  +   (smtpmail-smtp-service 25025))
  +  (notmuch-search subject:\testing message sent via SMTP\)
  +  (notmuch-test-wait)
  +  (notmuch-search-reply-to-thread)
  +  (end-of-buffer)
  +  (newline)
  +  (insert Reply to a message via Emacs with fake SMTP)
  +  (message-send-and-exit))' /dev/null 21
  +wait ${smtp_dummy_pid}
  +notmuch new /dev/null
 
 The above part smells like CopyPasteProgramming; (old version of) 
 emacs_deliver_message copied (old as this version is lacking
 opportunistic quit). 


Nope, Sending a message via (fake) SMTP, around 2011-05 to be exact [1].

My main intention was to get a bugfix [2] applied (still isn't BTW),
which might have been expedited by providing a test which checks
whether messages are properly tagged 'replied' when and *only* when
applicable, and for that I needed a quick way to test replying to a
thread, so I lazily repurposed an existing test.  Not much point in
reinventing the wheel, is there?

Still haven't gotten around to writing the actual test to demonstrate
that messages are tagged 'replied' prematurely, but this should be the
gist of it:

  #+begin_src emacs-lisp
;; ask for confirmation (using `y-or-n-p') before sending
(let ((message-confirm-send t))
  ;; temporarily redefine `y-or-n-p', immediately returns nil
  (flet ((y-or-n-p (rest args) nil))
;; then try to send message (which will fail)
(message-send-and-exit)))

;; Parent message should NOT be tagged 'replied' now, yet it is,
;; since `notmuch-message-mark-replied' is added to `message-send-hook'
;; instead of `message-sent-hook'.
  #+end_src


 Maybe the functionality of emacs_deliver_message needs to be
 split into 3 parts: initialization, sending and finalization.
 then other uses can use initialization and finalization parts
 and provide their own sending part.


That would be *much* better, indeed.


 I have work-in-progress code for initialization and finalization
 parts of that and I don't want to do the changes in 2 places...


OK.  I'll mark this patch (and the next, which depends on it) as 'wip',
and pick them up again when your refactoring efforts hit mainline.


 Tomi


Peace

-- 
Pieter

[1] id:1305299270-4316-1-git-send-email-pie...@praet.org
[2] id:1305275652-22956-1-git-send-email-pie...@praet.org
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH v2 2/4] test: emacs: new test notmuch-search: replying to a thread (sending)

2012-02-22 Thread Pieter Praet
On Mon, 20 Feb 2012 16:44:32 +0400, Dmitry Kurochkin 
dmitry.kuroch...@gmail.com wrote:
 On Sun, 19 Feb 2012 21:38:26 +0100, Pieter Praet pie...@praet.org wrote:
  As pointed out in the previous commit, the test for replying from
  within Emacs didn't actually submit the reply. This one does.
  ---
   test/emacs |   41 +
   1 files changed, 41 insertions(+), 0 deletions(-)
  
  diff --git a/test/emacs b/test/emacs
  index 308d749..0f4f42b 100755
  --- a/test/emacs
  +++ b/test/emacs
  @@ -273,6 +273,47 @@ On 01 Jan 2000 12:00:00 -, Notmuch Test Suite 
  test_su...@notmuchmail.org w
   EOF
   test_expect_equal_file OUTPUT EXPECTED
   
  +test_begin_subtest notmuch-search: replying to a thread (sending)
  +$TEST_DIRECTORY/smtp-dummy sent_message 
  +smtp_dummy_pid=$!
  +test_emacs \
  +'(let ((message-send-mail-function '\''message-smtpmail-send-it)
  +   (smtpmail-smtp-server localhost)
  +   (smtpmail-smtp-service 25025))
  +  (notmuch-search subject:\testing message sent via SMTP\)
  +  (notmuch-test-wait)
  +  (notmuch-search-reply-to-thread)
  +  (end-of-buffer)
  +  (newline)
  +  (insert Reply to a message via Emacs with fake SMTP)
  +  (message-send-and-exit))' /dev/null 21
  +wait ${smtp_dummy_pid}
  +notmuch new /dev/null
  +sed \
  +-e s',^User-Agent: Notmuch/.* Emacs/.*,User-Agent: Notmuch/XXX 
  Emacs/XXX,' \
  +-e s',^Message-ID: .*$,Message-ID: XXX,' \
  +-e s',^In-Reply-To: .*$,In-Reply-To: XXX,' \
  +-e s',^References: .*$,References: XXX,' \
  +-e s',^Date: .*$,Date: Fri\, 29 Mar 1974 10:05:00 -,'  
  sent_message OUTPUT
 
 This sed command is a (partial) copy past from Sending a message via
 (fake) SMTP test.  [...]

Aye, that's the one.


 [...] I suggest adding notmuch_sent_message_sanitize
 function which would replace common headers with XXX.
 
 Replace Date with XXX for Date for consistency with other headers,
 AFAICT a valid date value is not needed here.


Agreed.

Will have another look at it when Tomi's refactoring is done [1,2].


 Regards,
   Dmitry
 
  +cat EOF EXPECTED
  +From: Notmuch Test Suite test_su...@notmuchmail.org
  +To: u...@example.com
  +Subject: Re: Testing message sent via SMTP
  +In-Reply-To: XXX
  +References: XXX
  +User-Agent: Notmuch/XXX Emacs/XXX
  +Date: Fri, 29 Mar 1974 10:05:00 -
  +Message-ID: XXX
  +MIME-Version: 1.0
  +Content-Type: text/plain; charset=us-ascii
  +
  +On 01 Jan 2000 12:00:00 -, Notmuch Test Suite 
  test_su...@notmuchmail.org wrote:
  + This is a test that messages are sent via SMTP
  +
  +Reply to a message via Emacs with fake SMTP
  +EOF
  +test_expect_equal_file OUTPUT EXPECTED
  +
   test_begin_subtest Quote MML tags in reply
   message_id='test-emacs-mml-quot...@message.id'
   add_message [id]=$message_id \
  -- 
  1.7.8.1
  


Peace

-- 
Pieter

[1] id:m239a6wn4p@guru.guru-group.fi
[2] id:87mx8a900t@praet.org
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH v2 4/4] test: emacs: new test notmuch-search: change tags of all matching messages

2012-02-22 Thread Pieter Praet
On Sun, 19 Feb 2012 23:08:30 +0200, Tomi Ollila tomi.oll...@iki.fi wrote:
 On Sun, 19 Feb 2012 21:38:28 +0100, Pieter Praet pie...@praet.org wrote:
  `notmuch-search-tag-all' (bound to *) adds and removes tags
  to/from all messages which match the query used to populate the
  current search buffer.
  ---
   test/emacs |   32 
   1 files changed, 32 insertions(+), 0 deletions(-)
  
 
 [ ... ]
 
  +old_tag_count_1=$(notmuch count tag:${old_tag} ${filter})
  +new_tag_count_1=$(notmuch count tag:${new_tag} ${filter})
  +test ${old_tag_count_1} == 0  old_tag_count_1=Need 1+ matches!
  +test ${new_tag_count_1} == 0 || new_tag_count_1=Need 0 matches!
  +# Change tags of all matching messages and get tag counts
  +test_emacs (notmuch-search \tag:${old_tag} ${filter}\)
 
 Small nit: string equality comparison operator is '='. 
 Use  grep '==' test/*  to confirm (or man test).


Argh...  Nice catch!


 [ ... ]
 
 Tomi


Peace

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


Re: [PATCH v2 4/4] test: emacs: new test notmuch-search: change tags of all matching messages

2012-02-22 Thread Pieter Praet
On Mon, 20 Feb 2012 16:25:05 +0400, Dmitry Kurochkin 
dmitry.kuroch...@gmail.com wrote:
 On Sun, 19 Feb 2012 21:38:28 +0100, Pieter Praet pie...@praet.org wrote:
  `notmuch-search-tag-all' (bound to *) adds and removes tags
  to/from all messages which match the query used to populate the
  current search buffer.
 
 LGTM.  But since you will need to send a new version to address Tomi's
 comments anyway, below are few minor comments.
 
 Regards,
   Dmitry
 
  ---
   test/emacs |   32 
   1 files changed, 32 insertions(+), 0 deletions(-)
  
  diff --git a/test/emacs b/test/emacs
  index b0fb760..1db8540 100755
  --- a/test/emacs
  +++ b/test/emacs
  @@ -124,6 +124,38 @@ test_emacs (notmuch-show \$os_x_darwin_thread\)
   output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
   test_expect_equal $output thread:XXX   2009-11-18 [4/4] Jjgod Jiang, 
  Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues 
  (inbox unread)
   
  +test_begin_subtest notmuch-search: change tags of all matching messages
  +old_tag=inbox
  +new_tag=xobni
  +filter=AND from:cworth
  +# Get initial tag counts and prevent false positives/negatives
  +old_tag_count_1=$(notmuch count tag:${old_tag} ${filter})
  +new_tag_count_1=$(notmuch count tag:${new_tag} ${filter})
  +test ${old_tag_count_1} == 0  old_tag_count_1=Need 1+ matches!
 
 Consider s/1+/0/.
 
  +test ${new_tag_count_1} == 0 || new_tag_count_1=Need 0 matches!
  +# Change tags of all matching messages and get tag counts
  +test_emacs (notmuch-search \tag:${old_tag} ${filter}\)
  +   (notmuch-test-wait)
  +   (notmuch-search-tag-all \-${old_tag}\ \+${new_tag}\)
  +old_tag_count_2=$(notmuch count tag:${old_tag} ${filter})
  +new_tag_count_2=$(notmuch count tag:${new_tag} ${filter})
  +# Revert tag changes and get tag counts
  +test_emacs (notmuch-search \tag:${new_tag} ${filter}\)
  +   (notmuch-test-wait)
  +   (notmuch-search-tag-all \+${old_tag}\ \-${new_tag}\)
  +old_tag_count_3=$(notmuch count tag:${old_tag} ${filter})
  +new_tag_count_3=$(notmuch count tag:${new_tag} ${filter})
  +# ... and verify the results
  +output=
  +before:   old:${old_tag_count_1} new:${new_tag_count_1}
  +after:old:${old_tag_count_2} new:${new_tag_count_2}
  +restored: old:${old_tag_count_3} new:${new_tag_count_3}
  +expected=
  +before:   old:${old_tag_count_1} new:0
  +after:old:0 new:${old_tag_count_1}
  +restored: old:${old_tag_count_1} new:0
  +test_expect_equal $output $expected
  +
 
 I would add a newline before every commented block.


Agreed, on all accounts.


 Regards,
   Dmitry
 
   test_begin_subtest Message with .. in Message-Id:
   add_message [id]=123..456@example '[subject]=Message with .. in 
  Message-Id'
   test_emacs '(notmuch-search id:\123..456@example\)
  -- 
  1.7.8.1
  


Peace

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


[PATCH v3] test: emacs: new test notmuch-search: change tags of all matching messages

2012-02-22 Thread Pieter Praet
`notmuch-search-tag-all' (bound to *) adds and removes tags
to/from all messages which match the query used to populate the
current search buffer.
---
 test/emacs |   38 ++
 1 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/test/emacs b/test/emacs
index b74cfa9..d64dcd0 100755
--- a/test/emacs
+++ b/test/emacs
@@ -124,6 +124,44 @@ test_emacs (notmuch-show \$os_x_darwin_thread\)
 output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
 test_expect_equal $output thread:XXX   2009-11-18 [4/4] Jjgod Jiang, 
Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox 
unread)
 
+
+test_begin_subtest notmuch-search: change tags of all matching messages
+old_tag=inbox
+new_tag=xobni
+filter=AND from:cworth
+
+# Get initial tag counts and prevent false positives/negatives
+old_tag_count_1=$(notmuch count tag:${old_tag} ${filter})
+new_tag_count_1=$(notmuch count tag:${new_tag} ${filter})
+test ${old_tag_count_1} = 0  old_tag_count_1=Need 0 matches!
+test ${new_tag_count_1} = 0 || new_tag_count_1=Need 0 matches!
+
+# Change tags of all matching messages and get tag counts
+test_emacs (notmuch-search \tag:${old_tag} ${filter}\)
+   (notmuch-test-wait)
+   (notmuch-search-tag-all \-${old_tag}\ \+${new_tag}\)
+old_tag_count_2=$(notmuch count tag:${old_tag} ${filter})
+new_tag_count_2=$(notmuch count tag:${new_tag} ${filter})
+
+# Revert tag changes and get tag counts
+test_emacs (notmuch-search \tag:${new_tag} ${filter}\)
+   (notmuch-test-wait)
+   (notmuch-search-tag-all \+${old_tag}\ \-${new_tag}\)
+old_tag_count_3=$(notmuch count tag:${old_tag} ${filter})
+new_tag_count_3=$(notmuch count tag:${new_tag} ${filter})
+
+# ... and verify the results
+output=
+before:   old:${old_tag_count_1} new:${new_tag_count_1}
+after:old:${old_tag_count_2} new:${new_tag_count_2}
+restored: old:${old_tag_count_3} new:${new_tag_count_3}
+expected=
+before:   old:${old_tag_count_1} new:0
+after:old:0 new:${old_tag_count_1}
+restored: old:${old_tag_count_1} new:0
+test_expect_equal $output $expected
+
+
 test_begin_subtest Message with .. in Message-Id:
 add_message [id]=123..456@example '[subject]=Message with .. in Message-Id'
 test_emacs '(notmuch-search id:\123..456@example\)
-- 
1.7.8.1

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


Re: [PATCH] emacs: Mention race condition safety in user visible documentation

2012-02-22 Thread Pieter Praet
On Tue, 21 Feb 2012 10:15:08 +0100, Michal Sojka sojk...@fel.cvut.cz wrote:
 [...]
 OK, at least one supporter here :) The updated patch follows:
 
 -- 8 --
 Subject: [PATCH] emacs: Clarify description of thread manipulating functions
 
 It is not clear whether the term thread refers to the thread in the
 database or to the thread currently shown in a buffer. Those two
 meanings may refer to different sets of messages, e.g. when a new email
 is added to the database while the buffer shows the state before the new
 email arrived.
 
 This patch replaces the term thread with the term current buffer, which
 is hopefully less ambiguous.
 ---

+1


Also, the inverse is true for the comment about `notmuch-search-tag-all'
in `notmuch-search-mode's docstring.  Patch follows.


Peace

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


[PATCH] emacs: correct `notmuch-search-mode's docstring wrt `notmuch-search-tag-all'

2012-02-22 Thread Pieter Praet
* emacs/notmuch.el (notmuch-search-mode):
  `notmuch-search-tag-all' currently uses the current query string
  instead of `notmuch-search-find-thread-id-region-search', which
  might cause a race condition.
---
 emacs/notmuch.el |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index f851c6f..0a9fffd 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -435,8 +435,9 @@ (defun notmuch-search-mode ()
 Pressing \\[notmuch-search-show-thread] on any line displays that thread. The 
'\\[notmuch-search-add-tag]' and '\\[notmuch-search-remove-tag]'
 keys can be used to add or remove tags from a thread. The 
'\\[notmuch-search-archive-thread]' key
 is a convenience for archiving a thread (removing the \inbox\
-tag). The '\\[notmuch-search-tag-all]' key can be used to add or remove a tag 
from all
-threads in the current buffer.
+tag). The '\\[notmuch-search-tag-all]' key can be used to add and/or remove 
tags from all
+messages (as opposed to threads) that match the current query.  Use with 
caution, as this
+will also tag matching messages that arrived *after* constructing the buffer.
 
 Other useful commands are '\\[notmuch-search-filter]' for filtering the 
current search
 based on an additional query string, '\\[notmuch-search-filter-by-tag]' for 
filtering to include
-- 
1.7.8.1

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


[PATCH 3/3] test: emacs: toggle thread content indentation in `notmuch-show'

2012-02-19 Thread Pieter Praet
See commit c205e8ff.
---
 test/emacs |9 ++
 .../notmuch-show-indent-thread-content-off |   79 
 2 files changed, 88 insertions(+), 0 deletions(-)
 create mode 100644 
test/emacs.expected-output/notmuch-show-indent-thread-content-off

diff --git a/test/emacs b/test/emacs
index 320057a..357ac73 100755
--- a/test/emacs
+++ b/test/emacs
@@ -591,5 +591,14 @@ test_emacs '(let ((notmuch-show-only-matching-messages 
nil))
(test-visible-output))'
 test_expect_equal_file OUTPUT 
$EXPECTED/notmuch-show-elide-non-matching-messages-on

+test_begin_subtest "notmuch-show: disable indentation of thread content (w/ 
notmuch-show-toggle-thread-indentation)"
+test_emacs '(notmuch-search "from:lars at seas.harvard.edu and 
subject:\"Maildir storage\"")
+   (notmuch-test-wait)
+   (notmuch-search-show-thread)
+   (notmuch-test-wait)
+   (notmuch-show-toggle-thread-indentation)
+   (test-visible-output)'
+test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-indent-thread-content-off
+

 test_done
diff --git a/test/emacs.expected-output/notmuch-show-indent-thread-content-off 
b/test/emacs.expected-output/notmuch-show-indent-thread-content-off
new file mode 100644
index 000..37b4f7d
--- /dev/null
+++ b/test/emacs.expected-output/notmuch-show-indent-thread-content-off
@@ -0,0 +1,79 @@
+Lars Kellogg-Stedman  (2009-11-17) (inbox signed)
+Subject: [notmuch] Working with Maildir storage?
+To: notmuch at notmuchmail.org
+Date: Tue, 17 Nov 2009 14:00:54 -0500
+
+[ multipart/mixed ]
+[ multipart/signed ]
+[ text/plain ]
+I saw the LWN article and decided to take a look at notmuch.  I'm
+currently using mutt and mairix to index and read a collection of
+Maildir mail folders (around 40,000 messages total).
+
+notmuch indexed the messages without complaint, but my attempt at
+searching bombed out. Running, for example:
+
+  notmuch search storage
+
+Resulted in 4604 lines of errors along the lines of:
+
+  Error opening
+  
/home/lars/Mail/read-messages.2008/cur/1246413773.24928_27334.hostname,U=3026:2,S:
+  Too many open files
+
+I'm curious if this is expected behavior (i.e., notmuch does not work
+with Maildir) or if something else is going on.
+
+Cheers,
+
+[ 4-line signature. Click/Enter to show. ]
+[ application/pgp-signature ]
+[ text/plain ]
+[ 4-line signature. Click/Enter to show. ]
+ Mikhail Gusarov  (2009-11-17) (inbox signed 
unread)
+  Lars Kellogg-Stedman  (2009-11-17) (inbox signed)
+Subject: Re: [notmuch] Working with Maildir storage?
+To: Mikhail Gusarov 
+Cc: notmuch at notmuchmail.org
+Date: Tue, 17 Nov 2009 15:33:01 -0500
+
+[ multipart/mixed ]
+[ multipart/signed ]
+[ text/plain ]
+> See the patch just posted here.
+
+Is the list archived anywhere?  The obvious archives
+(http://notmuchmail.org/pipermail/notmuch/) aren't available, and I
+think I subscribed too late to get the patch (I only just saw the
+discussion about it).
+
+It doesn't look like the patch is in git yet.
+
+-- Lars
+
+[ 4-line signature. Click/Enter to show. ]
+[ application/pgp-signature ]
+[ text/plain ]
+[ 4-line signature. Click/Enter to show. ]
+   Mikhail Gusarov  (2009-11-17) (inbox unread)
+   Keith Packard  (2009-11-17) (inbox unread)
+Lars Kellogg-Stedman  (2009-11-18) (inbox signed 
unread)
+Subject: Re: [notmuch] Working with Maildir storage?
+To: Keith Packard 
+Cc: notmuch at notmuchmail.org
+Date: Tue, 17 Nov 2009 19:50:40 -0500
+
+[ multipart/mixed ]
+[ multipart/signed ]
+[ text/plain ]
+> I've also pushed a slightly more complicated (and complete) fix to my
+> private notmuch repository
+
+The version of lib/messages.cc in your repo doesn't build because it's
+missing "#include " (for the uint32_t on line 466).
+
+[ 4-line signature. Click/Enter to show. ]
+[ application/pgp-signature ]
+[ text/plain ]
+[ 4-line signature. Click/Enter to show. ]
+ Carl Worth  (2009-11-18) (inbox unread)
-- 
1.7.8.1



[PATCH 2/3] test: emacs: toggle eliding of non-matching messages in `notmuch-show'

2012-02-19 Thread Pieter Praet
See commits 44a544ed, 866ce8b1, 668b66ec.
---
 test/emacs |   38 ++
 .../notmuch-show-elide-non-matching-messages-off   |   79 
 .../notmuch-show-elide-non-matching-messages-on|   75 +++
 3 files changed, 192 insertions(+), 0 deletions(-)
 create mode 100644 
test/emacs.expected-output/notmuch-show-elide-non-matching-messages-off
 create mode 100644 
test/emacs.expected-output/notmuch-show-elide-non-matching-messages-on

diff --git a/test/emacs b/test/emacs
index b207d20..320057a 100755
--- a/test/emacs
+++ b/test/emacs
@@ -553,5 +553,43 @@ test_emacs '(let ((notmuch-crypto-process-mime nil))
(test-visible-output))'
 test_expect_equal_file OUTPUT 
$EXPECTED/notmuch-show-process-crypto-mime-parts-on

+test_begin_subtest "notmuch-show: don't elide non-matching messages"
+test_emacs '(let ((notmuch-show-only-matching-messages nil))
+   (notmuch-search "from:lars at seas.harvard.edu and subject:\"Maildir 
storage\"")
+   (notmuch-test-wait)
+   (notmuch-search-show-thread)
+   (notmuch-test-wait)
+   (test-visible-output))'
+test_expect_equal_file OUTPUT 
$EXPECTED/notmuch-show-elide-non-matching-messages-off
+
+test_begin_subtest "notmuch-show: elide non-matching messages"
+test_emacs '(let ((notmuch-show-only-matching-messages t))
+   (notmuch-search "from:lars at seas.harvard.edu and subject:\"Maildir 
storage\"")
+   (notmuch-test-wait)
+   (notmuch-search-show-thread)
+   (notmuch-test-wait)
+   (test-visible-output))'
+test_expect_equal_file OUTPUT 
$EXPECTED/notmuch-show-elide-non-matching-messages-on
+
+test_begin_subtest "notmuch-show: elide non-matching messages (w/ 
notmuch-show-toggle-elide-non-matching)"
+test_emacs '(let ((notmuch-show-only-matching-messages nil))
+   (notmuch-search "from:lars at seas.harvard.edu and subject:\"Maildir 
storage\"")
+   (notmuch-test-wait)
+   (notmuch-search-show-thread)
+   (notmuch-test-wait)
+   (notmuch-show-toggle-elide-non-matching)
+   (test-visible-output))'
+test_expect_equal_file OUTPUT 
$EXPECTED/notmuch-show-elide-non-matching-messages-on
+
+test_begin_subtest "notmuch-show: elide non-matching messages (w/ prefix arg 
to notmuch-show)"
+test_emacs '(let ((notmuch-show-only-matching-messages nil))
+   (notmuch-search "from:lars at seas.harvard.edu and subject:\"Maildir 
storage\"")
+   (notmuch-test-wait)
+   (let ((current-prefix-arg t))
+ (notmuch-search-show-thread))
+   (notmuch-test-wait)
+   (test-visible-output))'
+test_expect_equal_file OUTPUT 
$EXPECTED/notmuch-show-elide-non-matching-messages-on
+

 test_done
diff --git 
a/test/emacs.expected-output/notmuch-show-elide-non-matching-messages-off 
b/test/emacs.expected-output/notmuch-show-elide-non-matching-messages-off
new file mode 100644
index 000..b31fe62
--- /dev/null
+++ b/test/emacs.expected-output/notmuch-show-elide-non-matching-messages-off
@@ -0,0 +1,79 @@
+Lars Kellogg-Stedman  (2009-11-17) (inbox signed)
+Subject: [notmuch] Working with Maildir storage?
+To: notmuch at notmuchmail.org
+Date: Tue, 17 Nov 2009 14:00:54 -0500
+
+[ multipart/mixed ]
+[ multipart/signed ]
+[ text/plain ]
+I saw the LWN article and decided to take a look at notmuch.  I'm
+currently using mutt and mairix to index and read a collection of
+Maildir mail folders (around 40,000 messages total).
+
+notmuch indexed the messages without complaint, but my attempt at
+searching bombed out. Running, for example:
+
+  notmuch search storage
+
+Resulted in 4604 lines of errors along the lines of:
+
+  Error opening
+  
/home/lars/Mail/read-messages.2008/cur/1246413773.24928_27334.hostname,U=3026:2,S:
+  Too many open files
+
+I'm curious if this is expected behavior (i.e., notmuch does not work
+with Maildir) or if something else is going on.
+
+Cheers,
+
+[ 4-line signature. Click/Enter to show. ]
+[ application/pgp-signature ]
+[ text/plain ]
+[ 4-line signature. Click/Enter to show. ]
+ Mikhail Gusarov  (2009-11-17) (inbox signed 
unread)
+  Lars Kellogg-Stedman  (2009-11-17) (inbox signed)
+  Subject: Re: [notmuch] Working with Maildir storage?
+  To: Mikhail Gusarov 
+  Cc: notmuch at notmuchmail.org
+  Date: Tue, 17 Nov 2009 15:33:01 -0500
+
+  [ multipart/mixed ]
+  [ multipart/signed ]
+  [ text/plain ]
+  > See the patch just posted here.
+
+  Is the list archived anywhere?  The obvious archives
+  (http://notmuchmail.org/pipermail/notmuch/) aren't available, and I
+  think I subscribed too late to get the patch (I only just saw the
+  discussion about it).
+
+  It doesn't look like the patch is in git yet.
+
+  -- Lars
+
+  [ 4-line signature. Click/Enter to show. ]
+  [ application/pgp-signature ]
+  [ text/plain ]
+  [ 4-line signature. Click/Enter to show. ]
+   Mikhail Gusarov  (2009-11-17) (inbox unread)
+   Keith Packard  (2009-11-17) (inbox unread)
+Lars Kellogg-Stedman  (2009-11-18) (inbox signed 
unread)
+  

[PATCH 1/3] test: emacs: toggle processing of cryptographic MIME parts in `notmuch-show'

2012-02-19 Thread Pieter Praet
See commit 19ec74c5.
---
 test/emacs |   20 
 .../notmuch-show-process-crypto-mime-parts-off |   31 +++
 .../notmuch-show-process-crypto-mime-parts-on  |   32 
 3 files changed, 83 insertions(+), 0 deletions(-)
 create mode 100644 
test/emacs.expected-output/notmuch-show-process-crypto-mime-parts-off
 create mode 100644 
test/emacs.expected-output/notmuch-show-process-crypto-mime-parts-on

diff --git a/test/emacs b/test/emacs
index b74cfa9..b207d20 100755
--- a/test/emacs
+++ b/test/emacs
@@ -534,4 +534,24 @@ counter=$(test_emacs \
 )
 test_expect_equal "$counter" 2

+test_begin_subtest "notmuch-show: don't process cryptographic MIME parts"
+test_emacs '(let ((notmuch-crypto-process-mime nil))
+   (notmuch-show "id:20091117203301.GV3165 at dottiness.seas.harvard.edu")
+   (test-visible-output))'
+test_expect_equal_file OUTPUT 
$EXPECTED/notmuch-show-process-crypto-mime-parts-off
+
+test_begin_subtest "notmuch-show: process cryptographic MIME parts"
+test_emacs '(let ((notmuch-crypto-process-mime t))
+   (notmuch-show "id:20091117203301.GV3165 at dottiness.seas.harvard.edu")
+   (test-visible-output))'
+test_expect_equal_file OUTPUT 
$EXPECTED/notmuch-show-process-crypto-mime-parts-on
+
+test_begin_subtest "notmuch-show: process cryptographic MIME parts (w/ 
notmuch-show-toggle-process-crypto)"
+test_emacs '(let ((notmuch-crypto-process-mime nil))
+   (notmuch-show "id:20091117203301.GV3165 at dottiness.seas.harvard.edu")
+   (notmuch-show-toggle-process-crypto)
+   (test-visible-output))'
+test_expect_equal_file OUTPUT 
$EXPECTED/notmuch-show-process-crypto-mime-parts-on
+
+
 test_done
diff --git 
a/test/emacs.expected-output/notmuch-show-process-crypto-mime-parts-off 
b/test/emacs.expected-output/notmuch-show-process-crypto-mime-parts-off
new file mode 100644
index 000..076083a
--- /dev/null
+++ b/test/emacs.expected-output/notmuch-show-process-crypto-mime-parts-off
@@ -0,0 +1,31 @@
+Lars Kellogg-Stedman  (2009-11-17) (inbox signed)
+Subject: [notmuch] Working with Maildir storage?
+ Mikhail Gusarov  (2009-11-17) (inbox signed 
unread)
+  Lars Kellogg-Stedman  (2009-11-17) (inbox signed)
+  Subject: Re: [notmuch] Working with Maildir storage?
+  To: Mikhail Gusarov 
+  Cc: notmuch at notmuchmail.org
+  Date: Tue, 17 Nov 2009 15:33:01 -0500
+
+  [ multipart/mixed ]
+  [ multipart/signed ]
+  [ text/plain ]
+  > See the patch just posted here.
+
+  Is the list archived anywhere?  The obvious archives
+  (http://notmuchmail.org/pipermail/notmuch/) aren't available, and I
+  think I subscribed too late to get the patch (I only just saw the
+  discussion about it).
+
+  It doesn't look like the patch is in git yet.
+
+  -- Lars
+
+  [ 4-line signature. Click/Enter to show. ]
+  [ application/pgp-signature ]
+  [ text/plain ]
+  [ 4-line signature. Click/Enter to show. ]
+   Mikhail Gusarov  (2009-11-17) (inbox unread)
+   Keith Packard  (2009-11-17) (inbox unread)
+Lars Kellogg-Stedman  (2009-11-18) (inbox signed 
unread)
+ Carl Worth  (2009-11-18) (inbox unread)
diff --git 
a/test/emacs.expected-output/notmuch-show-process-crypto-mime-parts-on 
b/test/emacs.expected-output/notmuch-show-process-crypto-mime-parts-on
new file mode 100644
index 000..588f38f
--- /dev/null
+++ b/test/emacs.expected-output/notmuch-show-process-crypto-mime-parts-on
@@ -0,0 +1,32 @@
+Lars Kellogg-Stedman  (2009-11-17) (inbox signed)
+Subject: [notmuch] Working with Maildir storage?
+ Mikhail Gusarov  (2009-11-17) (inbox signed 
unread)
+  Lars Kellogg-Stedman  (2009-11-17) (inbox signed)
+  Subject: Re: [notmuch] Working with Maildir storage?
+  To: Mikhail Gusarov 
+  Cc: notmuch at notmuchmail.org
+  Date: Tue, 17 Nov 2009 15:33:01 -0500
+
+  [ multipart/mixed ]
+  [ multipart/signed ]
+  [ Unknown key ID 0xD74695063141ACD8 or unsupported algorithm ]
+  [ text/plain ]
+  > See the patch just posted here.
+
+  Is the list archived anywhere?  The obvious archives
+  (http://notmuchmail.org/pipermail/notmuch/) aren't available, and I
+  think I subscribed too late to get the patch (I only just saw the
+  discussion about it).
+
+  It doesn't look like the patch is in git yet.
+
+  -- Lars
+
+  [ 4-line signature. Click/Enter to show. ]
+  [ application/pgp-signature ]
+  [ text/plain ]
+  [ 4-line signature. Click/Enter to show. ]
+   Mikhail Gusarov  (2009-11-17) (inbox unread)
+   Keith Packard  (2009-11-17) (inbox unread)
+Lars Kellogg-Stedman  (2009-11-18) (inbox signed 
unread)
+ Carl Worth  (2009-11-18) (inbox unread)
-- 
1.7.8.1



[PATCH v8 0/8] reworked crypto toggle, plus a few other toggles

2012-02-19 Thread Pieter Praet
Great work!

Here's some tests.


Peace



[PATCH] STYLE: Initial draft of coding style document

2012-02-19 Thread Pieter Praet
On Sun, 12 Feb 2012 21:42:49 -0400, David Bremner  wrote:
> On Sun, 5 Feb 2012 23:42:05 -0500, Austin Clements  
> wrote:
> > 
> > Any indentation style this difficult to explain can't be a good idea.
> > How about,
> > 
> > * Indent is 4 spaces with mixed tab/spaces and a tab width of 8.
> >   (Specifically, a line should begin with zero or more tabs followed
> >   by fewer than eight spaces.)
> 
> Oh, I pushed the style guide, with Austin's suggested wording.
>

We could also borrow from the Cairo coding style guidelines [1].

Or perhaps we should get rid of the mixed tabs/spaces deal altogether?
Carl once mentioned he planned to convert to using mod-8 tabs only [2].
Linus agrees [3] :)

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


Peace

-- 
Pieter

[1] http://cgit.freedesktop.org/cairo/tree/CODING_STYLE
[2] id:"87ocmwok2w.fsf at yoom.home.cworth.org"
http://mid.gmane.org/87ocmwok2w.fsf at yoom.home.cworth.org
[3] http://www.kernel.org/doc/Documentation/CodingStyle


  1   2   3   4   5   6   7   >