Re: [patch v3 1/4] build: integrate building ruby bindings into notmuch build process

2015-06-14 Thread David Bremner
David Bremner  writes:

> David Bremner  writes:
>
>> Because ruby generates a Makefile, we have to use recursive make.
>> Because mkmf.rb hardcodes the name Makefile, put our Makefile{.local}
>> in the parent directory.
>
> Pushed the first patch in the series. Let's see if anything breaks.
>

It turned out the answer was "Mac", so I pushed the next two patches as
well. I threw in the actual tests, since that was the point of this
effort.

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


Re: [PATCH] lib, ruby: make use of -Wl,--no-undefined configurable

2015-06-14 Thread Jinwoo Lee
On Sun, Jun 14, 2015 at 11:34 AM, David Bremner  wrote:
> Jinwoo Lee  writes:
>
>> When I apply those 2 patches from you, things seem to work.  I still get
>> warnings like below, but they don't seem severe.  I'm not sure if the
>> ruby binding actually works though.
>>
>> ld: warning: ignoring file ../../lib/libnotmuch.dylib, file was built for 
>> x86_64 which is not the architecture being linked (i386): 
>> ../../lib/libnotmuch.dylib
>>
>
> That one is a bit worrying, but I don't know enough about OS X to know
> for sure. If you have time/interest, can you try running the tests in
>
> id:1433142542-2307-5-git-send-email-da...@tethera.net
>
> Just apply the patch and make tests. That should indicate if the
> bindings are basically working.

Do you mean `make test', not `make tests'?

`make test' errors saying that the bash version must be >= 4.0.  Bash on
my mac is 3.2.57, which is the default bash installed on Yosemite.

Error: The notmuch test suite requires a bash version >= 4.0
due to use of associative arrays within the test suite.
Please try again with a newer bash (or help us fix the
test suite to be more portable). Thanks.
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] lib, ruby: make use of -Wl,--no-undefined configurable

2015-06-14 Thread Jinwoo Lee
On Sun, Jun 14, 2015 at 11:34 AM, David Bremner  wrote:
> Jinwoo Lee  writes:
>
>> When I apply those 2 patches from you, things seem to work.  I still get
>> warnings like below, but they don't seem severe.  I'm not sure if the
>> ruby binding actually works though.
>>
>> ld: warning: ignoring file ../../lib/libnotmuch.dylib, file was built for 
>> x86_64 which is not the architecture being linked (i386): 
>> ../../lib/libnotmuch.dylib
>>
>
> That one is a bit worrying, but I don't know enough about OS X to know
> for sure. If you have time/interest, can you try running the tests in
>
> id:1433142542-2307-5-git-send-email-david at tethera.net
>
> Just apply the patch and make tests. That should indicate if the
> bindings are basically working.

Do you mean `make test', not `make tests'?

`make test' errors saying that the bash version must be >= 4.0.  Bash on
my mac is 3.2.57, which is the default bash installed on Yosemite.

Error: The notmuch test suite requires a bash version >= 4.0
due to use of associative arrays within the test suite.
Please try again with a newer bash (or help us fix the
test suite to be more portable). Thanks.


[PATCH] lib, ruby: make use of -Wl,--no-undefined configurable

2015-06-14 Thread David Bremner
Jinwoo Lee  writes:

> When I apply those 2 patches from you, things seem to work.  I still get
> warnings like below, but they don't seem severe.  I'm not sure if the
> ruby binding actually works though.
>
> ld: warning: ignoring file ../../lib/libnotmuch.dylib, file was built for 
> x86_64 which is not the architecture being linked (i386): 
> ../../lib/libnotmuch.dylib
>

That one is a bit worrying, but I don't know enough about OS X to know
for sure. If you have time/interest, can you try running the tests in

id:1433142542-2307-5-git-send-email-david at tethera.net

Just apply the patch and make tests. That should indicate if the
bindings are basically working.

d


Re: search query "replytoid:"

2015-06-14 Thread Suvayu Ali
Hi,

On Mon, Jun 15, 2015 at 12:30:57AM +0200, Gregor Zattler wrote:
> 
> This is a nice script.  The very first Message(-Id:) I tried was
> replied to by a message with this In-Reply-To: header:
> 
> In-Reply-To: <7e093509.51e.14ddb300091.coremail.chxp_m...@163.com> 
> (windy’s
>message of „Wed, 10 Jun 2015 09:57:45 +0800 (CST)“)
> 
> Since the script extracts Message-Id:s from In-Reply-To; headers via
> 
> > function strip_mid() {
> > sed -e 's/[<> ]//g'
> > }
> 
> the Message-Id:s did not match.  I therefore changed this to
> 
> function strip_mid() {
> egrep  -a -o "<[^[:space:]<>]+@[^@[:space:]<>]+>"|sed -e 's/[<> ]//g'
> }

It was a quick hack.  In fact, there is another limitation.  IIRC, I
think the In-Reply-To header can have multiple Message-Id-s.  That is
not handled at all!  

The correct logic to get the ids should probably be something that picks
out the content inside angular brackets, but non-greedily.  Note that,
the allowance of characters inside Message-ID-s is rather liberal.  I
think it can be anything other than whitespace or angular brackets.
What you do above is probably very close, but still not general enough.
In fact, I think the foo@domain structure you require is not mandatory!
In my opinion, one should use an email handling library, or better yet
use the python bindings.

For the sake of completeness, here is a pure sed solution:

  function strip_mid() {
  sed -e 's/ \+//g' -e 's/<\([^ <>]\+\)>/\1/g'
  }

;)

-- 
Suvayu

Open source is the future. It sets us free.
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: search query "replytoid:"

2015-06-14 Thread Gregor Zattler
Hi Suvayu, notmuch users and developers,
* Suvayu Ali  [14. Jun. 2015]:
> Try the attached script.  It accepts notmuch queries by message id.
> E.g. to get the responses to your OP, you can do:
> 
>   $ ./nm-ack 
> id:CAJhTkNhYew6H-bptACTew3gN3DLWg6agTYu8hAkdwFS=z4v...@mail.gmail.com
>   id:877fr79upd@maritornes.cs.unb.ca 
> id:20150613205552.gc17...@chitra.no-ip.org
> 
> The first one is David's response, the second one is mine.

This is a nice script.  The very first Message(-Id:) I tried was
replied to by a message with this In-Reply-To: header:

In-Reply-To: <7e093509.51e.14ddb300091.coremail.chxp_m...@163.com> 
(windy’s
   message of „Wed, 10 Jun 2015 09:57:45 +0800 (CST)“)

Since the script extracts Message-Id:s from In-Reply-To; headers via

> function strip_mid() {
> sed -e 's/[<> ]//g'
> }

the Message-Id:s did not match.  I therefore changed this to

function strip_mid() {
egrep  -a -o "<[^[:space:]<>]+@[^@[:space:]<>]+>"|sed -e 's/[<> ]//g'
}

this did the trick.


Thanx, Gregor
-- 
 -... --- .-. . -.. ..--.. ...-.-
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


search query "replytoid:"

2015-06-14 Thread Xu Wang
On Sun, Jun 14, 2015 at 4:22 AM, Suvayu Ali  
wrote:
> On Sat, Jun 13, 2015 at 10:55:52PM +0200, Suvayu Ali wrote:
>> On Sat, Jun 13, 2015 at 02:47:00PM -0400, Xu Wang wrote:
>> >
>> > Is it possible to search based on which message ID a message
>> > *responds* to? For example, suppose message id is MESSAGEID. I want to
>> > find all emails that responded to MESSAGEID. How to enter such a query
>> > into notmuch?
>>
>> AFAIK, this is not possible.  Notmuch does not allow searching special
>> headers.  You could probably write a script using the threads output
>> format to get the thread, and then use formail to find the responses.
>
> Try the attached script.  It accepts notmuch queries by message id.
> E.g. to get the responses to your OP, you can do:
>
>   $ ./nm-ack id:CAJhTkNhYew6H-bptACTew3gN3DLWg6agTYu8hAkdwFS=z4VFWg at 
> mail.gmail.com
>   id:877fr79upd.fsf at maritornes.cs.unb.ca id:20150613205552.GC17381 at 
> chitra.no-ip.org
>
> The first one is David's response, the second one is mine.
>
> Hope this helps,
>
> --
> Suvayu

These are exactly what I was looking for! I tried Suvayu's script with
success, and although I did not try the script referenced by David's
email, the goal is exactly my goal and thus it seems it should do as I
would like as well.

Thank you so very much to you for persisting in helping me, even
despite the lack of clarity in my messages. I highly appreciate you
and your time.

Happy regards,

Xu


Re: [PATCH] lib, ruby: make use of -Wl,--no-undefined configurable

2015-06-14 Thread David Bremner
Jinwoo Lee  writes:

> When I apply those 2 patches from you, things seem to work.  I still get
> warnings like below, but they don't seem severe.  I'm not sure if the
> ruby binding actually works though.
>
> ld: warning: ignoring file ../../lib/libnotmuch.dylib, file was built for 
> x86_64 which is not the architecture being linked (i386): 
> ../../lib/libnotmuch.dylib
>

That one is a bit worrying, but I don't know enough about OS X to know
for sure. If you have time/interest, can you try running the tests in

id:1433142542-2307-5-git-send-email-da...@tethera.net

Just apply the patch and make tests. That should indicate if the
bindings are basically working.

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


Re: search query "replytoid:"

2015-06-14 Thread Xu Wang
On Sun, Jun 14, 2015 at 4:22 AM, Suvayu Ali  wrote:
> On Sat, Jun 13, 2015 at 10:55:52PM +0200, Suvayu Ali wrote:
>> On Sat, Jun 13, 2015 at 02:47:00PM -0400, Xu Wang wrote:
>> >
>> > Is it possible to search based on which message ID a message
>> > *responds* to? For example, suppose message id is MESSAGEID. I want to
>> > find all emails that responded to MESSAGEID. How to enter such a query
>> > into notmuch?
>>
>> AFAIK, this is not possible.  Notmuch does not allow searching special
>> headers.  You could probably write a script using the threads output
>> format to get the thread, and then use formail to find the responses.
>
> Try the attached script.  It accepts notmuch queries by message id.
> E.g. to get the responses to your OP, you can do:
>
>   $ ./nm-ack 
> id:CAJhTkNhYew6H-bptACTew3gN3DLWg6agTYu8hAkdwFS=z4v...@mail.gmail.com
>   id:877fr79upd@maritornes.cs.unb.ca 
> id:20150613205552.gc17...@chitra.no-ip.org
>
> The first one is David's response, the second one is mine.
>
> Hope this helps,
>
> --
> Suvayu

These are exactly what I was looking for! I tried Suvayu's script with
success, and although I did not try the script referenced by David's
email, the goal is exactly my goal and thus it seems it should do as I
would like as well.

Thank you so very much to you for persisting in helping me, even
despite the lack of clarity in my messages. I highly appreciate you
and your time.

Happy regards,

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


search query "replytoid:"

2015-06-14 Thread Suvayu Ali
On Sat, Jun 13, 2015 at 10:55:52PM +0200, Suvayu Ali wrote:
> On Sat, Jun 13, 2015 at 02:47:00PM -0400, Xu Wang wrote:
> > 
> > Is it possible to search based on which message ID a message
> > *responds* to? For example, suppose message id is MESSAGEID. I want to
> > find all emails that responded to MESSAGEID. How to enter such a query
> > into notmuch?
> 
> AFAIK, this is not possible.  Notmuch does not allow searching special
> headers.  You could probably write a script using the threads output
> format to get the thread, and then use formail to find the responses.

Try the attached script.  It accepts notmuch queries by message id.
E.g. to get the responses to your OP, you can do:

  $ ./nm-ack id:CAJhTkNhYew6H-bptACTew3gN3DLWg6agTYu8hAkdwFS=z4VFWg at 
mail.gmail.com
  id:877fr79upd.fsf at maritornes.cs.unb.ca id:20150613205552.GC17381 at 
chitra.no-ip.org

The first one is David's response, the second one is mine.

Hope this helps,

-- 
Suvayu

Open source is the future. It sets us free.
-- next part --
#!/bin/bash

# Return responses to message id query
#
# $ nm-ack id:msgid at domain
# id:response1 at domain1 id:response2 at domain2 ...
#
# Author: Suvayu Ali

# debug
# set -o xtrace

declare query="$1" thread=$(notmuch search --output=threads -- "$1")
declare -a msgs=$(notmuch search --output=messages -- "$thread") responses

function strip_mid() {
sed -e 's/[<> ]//g'
}

for m in ${msgs[@]}; do
[[ $query == $m ]] && continue
r=id:$(notmuch show --format=raw -- $m | formail -x In-Reply-To: | 
strip_mid)
[[ $query == $r ]] && responses+=($m)
done

echo ${responses[@]}


[PATCH] lib, ruby: make use of -Wl,--no-undefined configurable

2015-06-14 Thread David Bremner
Jinwoo Lee  writes:

> There are 2 problems.
>
> 1. The file, bindings/Makefile.local still has lib/libnotmuch.so as the
>dependency of ruby-bindings.

this is fixed in

 id:1434263191-14171-1-git-send-email-david at tethera.net

an updated patch sent a few minutes ago.

>
>> cd bindings/ruby && \
>>  EXTRA_LDFLAGS="" \
>>  ruby extconf.rb --vendor
>> checking for notmuch_database_create in libnotmuch.so... no
>> *** extconf.rb failed ***

This should also be fixed by the same patch, since that test is
eliminated.

> ld: warning: ignoring file ../../lib/libnotmuch.dylib, file was built for 
> x86_64 which is not the architecture being linked (i386): 
> ../../lib/libnotmuch.dylib

On the other hand, this suggests there is still something broken with
building the ruby extensions on mac. I think if noone has a better idea,
and the updated versions of the two patches I sent to the list this
morning don't help, I'll just add a "--without-ruby" option to the
config script. In the long run, we probably want such an option anyway.  



[PATCH] build/ruby: use notmuch configure script values for shared lib

2015-06-14 Thread David Bremner
This is supposed to help build on systems like MacOS with different
conventions for naming shared libraries. We have already computed the
relevant names, so doing it again in ruby seems like a bad idea.
---
 bindings/Makefile.local  |  3 ++-
 bindings/ruby/extconf.rb | 13 +++--
 2 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/bindings/Makefile.local b/bindings/Makefile.local
index d236f01..4ecf839 100644
--- a/bindings/Makefile.local
+++ b/bindings/Makefile.local
@@ -3,10 +3,11 @@
 dir := bindings

 # force the shared library to be built
-ruby-bindings: lib/libnotmuch.so
+ruby-bindings: lib/$(LINKER_NAME)
 ifeq ($(HAVE_RUBY_DEV),1)
cd $(dir)/ruby && \
EXTRA_LDFLAGS="$(NO_UNDEFINED_LDFLAGS)" \
+   LIBNOTMUCH="../../lib/$(LINKER_NAME)" \
ruby extconf.rb --vendor
$(MAKE) -C $(dir)/ruby
 else
diff --git a/bindings/ruby/extconf.rb b/bindings/ruby/extconf.rb
index 6d5607e..ddaa684 100644
--- a/bindings/ruby/extconf.rb
+++ b/bindings/ruby/extconf.rb
@@ -14,19 +14,12 @@ if ENV['EXTRA_LDFLAGS']
   $LDFLAGS += " " + ENV['EXTRA_LDFLAGS']
 end

-def have_local_library(lib, path, func, headers = nil)
-  checking_for checking_message(func, lib) do
-lib = File.join(path, lib)
-if try_func(func, lib, headers)
-  $LOCAL_LIBS += lib
-end
-  end
-end
-
-if not have_local_library('libnotmuch.so', dir, 'notmuch_database_create', 
'notmuch.h')
+if not ENV['LIBNOTMUCH']
   exit 1
 end

+$LOCAL_LIBS += ENV['LIBNOTMUCH']
+
 # Create Makefile
 dir_config('notmuch')
 create_makefile('notmuch')
-- 
2.1.4



Re: [PATCH] lib, ruby: make use of -Wl,--no-undefined configurable

2015-06-14 Thread Jinwoo Lee
On Sat, Jun 13, 2015 at 11:53 PM, David Bremner  wrote:
> Jinwoo Lee  writes:
>
>> There are 2 problems.
>>
>> 1. The file, bindings/Makefile.local still has lib/libnotmuch.so as the
>>dependency of ruby-bindings.
>
> this is fixed in
>
>  id:1434263191-14171-1-git-send-email-da...@tethera.net
>
> an updated patch sent a few minutes ago.
>
>>
>>> cd bindings/ruby && \
>>> EXTRA_LDFLAGS="" \
>>> ruby extconf.rb --vendor
>>> checking for notmuch_database_create in libnotmuch.so... no
>>> *** extconf.rb failed ***
>
> This should also be fixed by the same patch, since that test is
> eliminated.
>
>> ld: warning: ignoring file ../../lib/libnotmuch.dylib, file was built for 
>> x86_64 which is not the architecture being linked (i386): 
>> ../../lib/libnotmuch.dylib
>
> On the other hand, this suggests there is still something broken with
> building the ruby extensions on mac. I think if noone has a better idea,
> and the updated versions of the two patches I sent to the list this
> morning don't help, I'll just add a "--without-ruby" option to the
> config script. In the long run, we probably want such an option anyway.  

When I apply those 2 patches from you, things seem to work.  I still get
warnings like below, but they don't seem severe.  I'm not sure if the
ruby binding actually works though.

ld: warning: directory not found for option '-L/usr/local/lib'
ld: warning: directory not found for option '-L/usr/local/lib'
ld: warning: ignoring file ../../lib/libnotmuch.dylib, file was built for 
x86_64 which is not the architecture being linked (i386): 
../../lib/libnotmuch.dylib

Thanks, David, for the quick fix!

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


[PATCH] lib, ruby: make use of -Wl,--no-undefined configurable

2015-06-14 Thread Jinwoo Lee
On Sat, Jun 13, 2015 at 11:53 PM, David Bremner  wrote:
> Jinwoo Lee  writes:
>
>> There are 2 problems.
>>
>> 1. The file, bindings/Makefile.local still has lib/libnotmuch.so as the
>>dependency of ruby-bindings.
>
> this is fixed in
>
>  id:1434263191-14171-1-git-send-email-david at tethera.net
>
> an updated patch sent a few minutes ago.
>
>>
>>> cd bindings/ruby && \
>>> EXTRA_LDFLAGS="" \
>>> ruby extconf.rb --vendor
>>> checking for notmuch_database_create in libnotmuch.so... no
>>> *** extconf.rb failed ***
>
> This should also be fixed by the same patch, since that test is
> eliminated.
>
>> ld: warning: ignoring file ../../lib/libnotmuch.dylib, file was built for 
>> x86_64 which is not the architecture being linked (i386): 
>> ../../lib/libnotmuch.dylib
>
> On the other hand, this suggests there is still something broken with
> building the ruby extensions on mac. I think if noone has a better idea,
> and the updated versions of the two patches I sent to the list this
> morning don't help, I'll just add a "--without-ruby" option to the
> config script. In the long run, we probably want such an option anyway.  

When I apply those 2 patches from you, things seem to work.  I still get
warnings like below, but they don't seem severe.  I'm not sure if the
ruby binding actually works though.

ld: warning: directory not found for option '-L/usr/local/lib'
ld: warning: directory not found for option '-L/usr/local/lib'
ld: warning: ignoring file ../../lib/libnotmuch.dylib, file was built for 
x86_64 which is not the architecture being linked (i386): 
../../lib/libnotmuch.dylib

Thanks, David, for the quick fix!

-jinwoo


[PATCH] lib, ruby: make use of -Wl,--no-undefined configurable

2015-06-14 Thread David Bremner
In particular this is supposed to help build on systems (presumably
using a non-gnu ld) where this flag is not available.
---
 bindings/Makefile.local  |  4 +++-
 bindings/ruby/extconf.rb |  5 +++--
 configure| 13 +
 lib/Makefile.local   |  2 +-
 4 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/bindings/Makefile.local b/bindings/Makefile.local
index 16817f5..d236f01 100644
--- a/bindings/Makefile.local
+++ b/bindings/Makefile.local
@@ -5,7 +5,9 @@ dir := bindings
 # force the shared library to be built
 ruby-bindings: lib/libnotmuch.so
 ifeq ($(HAVE_RUBY_DEV),1)
-   cd $(dir)/ruby && ruby extconf.rb --vendor
+   cd $(dir)/ruby && \
+   EXTRA_LDFLAGS="$(NO_UNDEFINED_LDFLAGS)" \
+   ruby extconf.rb --vendor
$(MAKE) -C $(dir)/ruby
 else
@echo Missing dependency, skipping ruby bindings
diff --git a/bindings/ruby/extconf.rb b/bindings/ruby/extconf.rb
index 6160db2..6d5607e 100644
--- a/bindings/ruby/extconf.rb
+++ b/bindings/ruby/extconf.rb
@@ -10,8 +10,9 @@ dir = File.join('..', '..', 'lib')
 # includes
 $INCFLAGS = "-I#{dir} #{$INCFLAGS}"

-# make sure there are no undefined symbols
-$LDFLAGS += ' -Wl,--no-undefined'
+if ENV['EXTRA_LDFLAGS']
+  $LDFLAGS += " " + ENV['EXTRA_LDFLAGS']
+end

 def have_local_library(lib, path, func, headers = nil)
   checking_for checking_message(func, lib) do
diff --git a/configure b/configure
index 13a8dca..b967a4e 100755
--- a/configure
+++ b/configure
@@ -751,6 +751,16 @@ else
 as_needed_ldflags=""
 fi

+printf "Checking for -Wl,--no-undefined... "
+if ${CC} -Wl,--no-undefined -o minimal minimal.c >/dev/null 2>&1
+then
+printf "Yes.\n"
+no_undefined_ldflags="-Wl,--no-undefined"
+else
+printf "No (nothing to worry about).\n"
+no_undefined_ldflags=""
+fi
+
 WARN_CXXFLAGS=""
 printf "Checking for available C++ compiler warning flags... "
 for flag in -Wall -Wextra -Wwrite-strings; do
@@ -955,6 +965,9 @@ RPATH_LDFLAGS = ${rpath_ldflags}
 # Flags needed to have linker link only to necessary libraries
 AS_NEEDED_LDFLAGS = ${as_needed_ldflags}

+# Flags to have the linker flag undefined symbols in object files
+NO_UNDEFINED_LDFLAGS = ${no_undefined_ldflags}
+
 # Whether valgrind header files are available
 HAVE_VALGRIND = ${have_valgrind}

diff --git a/lib/Makefile.local b/lib/Makefile.local
index f9ecd50..b58b4e8 100644
--- a/lib/Makefile.local
+++ b/lib/Makefile.local
@@ -33,7 +33,7 @@ LIBRARY_SUFFIX = so
 LINKER_NAME = libnotmuch.$(LIBRARY_SUFFIX)
 SONAME = $(LINKER_NAME).$(LIBNOTMUCH_VERSION_MAJOR)
 LIBNAME = $(SONAME).$(LIBNOTMUCH_VERSION_MINOR).$(LIBNOTMUCH_VERSION_RELEASE)
-LIBRARY_LINK_FLAG = -shared -Wl,--version-script=notmuch.sym,-soname=$(SONAME) 
-Wl,--no-undefined
+LIBRARY_LINK_FLAG = -shared -Wl,--version-script=notmuch.sym,-soname=$(SONAME) 
$(NO_UNDEFINED_LDFLAGS)
 ifeq ($(PLATFORM),OPENBSD)
 LIBRARY_LINK_FLAG += -lc
 endif
-- 
2.1.4



[patch v3 1/4] build: integrate building ruby bindings into notmuch build process

2015-06-14 Thread David Bremner
Jinwoo Lee  writes:


> ld: unknown option: --no-undefined
> clang: error: linker command failed with exit code 1 (use -v to see 
> invocation)

I wonder if this the actual relevant error. Can you try with the next
two patches in the series?

id:1433142542-2307-3-git-send-email-david at tethera.net
id:1433142542-2307-4-git-send-email-david at tethera.net

This first alone may fix it, but it would be good to know if the next
one breaks anything on Mac OS.





search query "replytoid:"

2015-06-14 Thread David Bremner
Xu Wang  writes:

> Dear David and Suvayu,
>
> Thank you for your ideas. My goal is to do something like the following:
> notmuch search tag:reply-required and not tag:replied
>
> which was discussed here:
> http://notmuchmail.org/pipermail/notmuch/2010/002558.html
>

This recent blog report looks related to your goal:

https://tomasz.buchert.pl/blog/2015/06/14/notmuch-response/


Re: search query "replytoid:"

2015-06-14 Thread Suvayu Ali
On Sat, Jun 13, 2015 at 10:55:52PM +0200, Suvayu Ali wrote:
> On Sat, Jun 13, 2015 at 02:47:00PM -0400, Xu Wang wrote:
> > 
> > Is it possible to search based on which message ID a message
> > *responds* to? For example, suppose message id is MESSAGEID. I want to
> > find all emails that responded to MESSAGEID. How to enter such a query
> > into notmuch?
> 
> AFAIK, this is not possible.  Notmuch does not allow searching special
> headers.  You could probably write a script using the threads output
> format to get the thread, and then use formail to find the responses.

Try the attached script.  It accepts notmuch queries by message id.
E.g. to get the responses to your OP, you can do:

  $ ./nm-ack 
id:CAJhTkNhYew6H-bptACTew3gN3DLWg6agTYu8hAkdwFS=z4v...@mail.gmail.com
  id:877fr79upd@maritornes.cs.unb.ca 
id:20150613205552.gc17...@chitra.no-ip.org

The first one is David's response, the second one is mine.

Hope this helps,

-- 
Suvayu

Open source is the future. It sets us free.
#!/bin/bash

# Return responses to message id query
#
# $ nm-ack id:msgid@domain
# id:response1@domain1 id:response2@domain2 ...
#
# Author: Suvayu Ali

# debug
# set -o xtrace

declare query="$1" thread=$(notmuch search --output=threads -- "$1")
declare -a msgs=$(notmuch search --output=messages -- "$thread") responses

function strip_mid() {
sed -e 's/[<> ]//g'
}

for m in ${msgs[@]}; do
[[ $query == $m ]] && continue
r=id:$(notmuch show --format=raw -- $m | formail -x In-Reply-To: | 
strip_mid)
[[ $query == $r ]] && responses+=($m)
done

echo ${responses[@]}
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Understanding the "replied" tag

2015-06-14 Thread Xu Wang
Dear Suvayu and Austin,

Thank you for your attempts to understand my goals. I apologize for
the lack in the clarity of my previous messages. Thank you kindly for
your persistence and thank you to Suvayu for suggestions on adding
more information.

I am indeed using mutt-kz, along with offlineimap, on Ubuntu 15.04. I
have written the following information the other email thread I
started (perhaps I should have added it as a reply here, but I thought
it might be sufficiently a different topic). I will copy the
information I gave there on my goal here:

My goal is to do something like the following:
notmuch search tag:reply-required and not tag:replied

which was discussed here:
http://notmuchmail.org/pipermail/notmuch/2010/002558.html

However, instead of conditioning on tag:reply-required, I would like
to look at this for a specific message. For example, if I write an
important message, I can do the following:
save the message id, and then in 5 days set a cron script to check
whether my message was responded to. If it was not responded to I will
take some action to notify myself (haven't decided what yet).
It is the "If it was not responded to" part that this email thread is
about. I am now realizing that I cannot use mutt's tag "replied"
because I often send and read email from gmail or other IMap clients
(e.g. phone). Because of this (I believe), the reply tag does not get
set when it should (well not "should" but rather "when I want it to").
For example, I often have

abc
->def
  -> ghi

where the message def does not have the "replied" tag, even though it
was replied to (ghi replied to it). I think the reason is what I
suggested above. Yes, indeed Austin was correct about where my
misunderstanding was. I do indeed want to see if *any* reply was to a
certain message id, but the "replied" tag is apparently for my own
replying.

Because I cannot use the "replied" tag (unless I have misunderstood),
I thought I could just check using the message id with 'notmuch search
repliedto:', but Suvayu points out that searching for this
is not supported.

Kind regards,

Xu

On Sat, Jun 13, 2015 at 7:12 PM, Austin Clements
 wrote:
> Hi Xu. I may be misunderstanding your email, but it sounds like you want to 
> know if a message has *any* reply message. That's not what the replied tag 
> indicates. The replied tag indicates that *you* have sent a reply to a 
> message. Mechanically, when you hit, say, r to start a reply and then send 
> that message, notmuch tags the message you hit r on as "replied". That's the 
> only time notmuch automatically sets this tag.
>
> On June 11, 2015 10:25:44 AM PDT, Xu Wang  wrote:
>>Dear all,
>>
>>First, I am extremely excited to be a part of this list now. notmuch
>>has really helped me. Thank you go all individuals working to improve
>>it and to help others to know how to use it.
>>
>>I would really like to know if a message has been replied to (e.g.
>>using a certain message id). It seems that all I need to do is check
>>for the "replied" tag. But often this tag is not there, even when
>>there has been a reply (I have confirmed this through the thread
>>display and checking the message that replied to the message to make
>>sure it indeed has header "replied-to:").
>>
>>I have looked in mutt, and also I see many situations where there is
>>no 'r' flag, especially for emails sent from me.
>>
>>The following returns true:
>>notmuch config get maildir.synchronize_flags
>>
>>So at least both are giving same answer, but I'm not sure why not
>>saying "replied" thread is correct.
>>
>>What is incorrect for my way of thinking about "replied"? Do I
>>misunderstand what it is supposed to do or am I not updating the flags
>>correctly?
>>
>>Kind regards,
>>
>>Xu
>>___
>>notmuch mailing list
>>notmuch at notmuchmail.org
>>http://notmuchmail.org/mailman/listinfo/notmuch
>