[PATCH] doc/reply: Clarify how reply-to header is handled

2015-12-29 Thread Michal Sojka
Current documentation and comments in the code do not correspond to
the actual code and tests in the test suite ("Un-munging Reply-To" in
T230-reply-to-sender.sh). Fix it.
---
 doc/man1/notmuch-reply.rst | 6 --
 notmuch-reply.c| 2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/doc/man1/notmuch-reply.rst b/doc/man1/notmuch-reply.rst
index cfbd4ea..d73f8f1 100644
--- a/doc/man1/notmuch-reply.rst
+++ b/doc/man1/notmuch-reply.rst
@@ -13,8 +13,10 @@ DESCRIPTION
 Constructs a reply template for a set of messages.
 
 To make replying to email easier, **notmuch reply** takes an existing
-set of messages and constructs a suitable mail template. The Reply-to:
-header (if any, otherwise From:) is used for the To: address. Unless
+set of messages and constructs a suitable mail template. Its To:
+address is set according to the original email in this way: if the
+Reply-to: header is present and different from any To:/Cc: address it
+is used, otherwise From: header is used. Unless
 ``--reply-to=sender`` is specified, values from the To: and Cc: headers
 are copied, but not including any of the current user's email addresses
 (as configured in primary\_mail or other\_email in the .notmuch-config
diff --git a/notmuch-reply.c b/notmuch-reply.c
index 6df54fc..3c6d685 100644
--- a/notmuch-reply.c
+++ b/notmuch-reply.c
@@ -332,7 +332,7 @@ add_recipients_from_message (GMimeMessage *reply,
  * field and use the From header. This ensures the original sender
  * will get the reply even if not subscribed to the list. Note
  * that the address in the Reply-To header will always appear in
- * the reply.
+ * the reply if reply_all is true.
  */
 if (reply_to_header_is_redundant (message)) {
reply_to_map[0].header = "from";
-- 
2.6.4

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


Re: notmuch-reply doesn't use Reply-To

2015-12-29 Thread Michal Sojka
Hi all,

On Fri, Dec 04 2015, Jani Nikula wrote:
> On Fri, 04 Dec 2015, Damien Cassou  wrote:
>> David Bremner  writes:
>>
>>> Damien Cassou  writes:
>>>
"To" : "r...@inria.fr",
"Reply-To" : "r...@inria.fr",
"From" : "seas...@rmod.inria.fr",
"Subject" : "[rmod] [Mm10s] 2015-11-30",
"Date" : "Mon, 30 Nov 2015 07:00:01 +0100"
>>>
>>> A quick look at the code suggests this is falling victim to the
>>> "reply-to munging" detection code, which considers a reply-to field
>>> redudant if it duplicates one of the other fields. From the source
>>>
>>> /* Some mailing lists munge the Reply-To header despite it being A Bad
>>>  * Thing, see http://www.unicom.com/pw/reply-to-harmful.html
>>>  *
>>>  * The munging is easy to detect, because it results in a
>>>  * redundant reply-to header, (with an address that already exists
>>>  * in either To or Cc). So in this case, we ignore the Reply-To
>>>  * field and use the From header. This ensures the original sender
>>>  * will get the reply even if not subscribed to the list. Note
>>>  * that the address in the Reply-To header will always appear in
>>>  * the reply.
>>>  */
>>
>>
>> The last sentence seems to contradict my example:
>>
>> Note that the address in the Reply-To header will always appear in
>> the reply.
>>
>> Here is the reply message, and it does not contain the address in Reply-To.
>
> This was true way back when notmuch reply only knew about reply all. For
> --reply-to=sender, it's broken. The simplest "fix" might be

I don't think that this is broken for two reasons:

1. In tests/T230-reply-to-sender.sh, there is "Un-munging Reply-To"
   test, which checks the same combination of headers as in Damien's
   case and uses --reply-to=sender. The test passes and the reply has
   To=From.

2. When replying to mailing lists using reply-to munging, current
   notmuch behavior allows me to decide whether to reply 1) privately to
   the mail sender (--reply-to=sender) or 2) to the mailing list
   (--reply-to=all). The proposed change would make option 1) harder.

Therefore I suggest to fix this by applying the documentation patch from
the follow-up mail.

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


Re: file-error "not a regular file"

2015-12-29 Thread Peter Salazar
send-message-without-bullets simply turns off org-bullets-mode before doing
message-send, since org-bullets-mode seemed to be interfering with
org-mime-htmlize.

(defun send-message-without-bullets ()
  (interactive)
  (remove-hook 'org-mode-hook 'org-bullets-mode)
  (message-send)
  (add-hook 'org-mode-hook 'org-bullets-mode))

I also have this:

(setq message-send-hook (quote (org-mime-htmlize)))


On Tue, Dec 29, 2015 at 3:44 PM, David Bremner  wrote:

> Peter Salazar  writes:
>
>
> > Yes, following your steps, emacs -q followed by "M-x load-library
> 
> > notmuch", I was able to send an email without the error. It prompted me
> for
> > my smtp server, username, and password, then returned this:
> >
>
> [snip]
> > Does this give us any leads?
>
> It seems to be some interaction with your configuration. I'm not
> familiar with this "send-message-without-bullets" function. Perhaps you
> could point us to the source?
>
> d
>
>
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: file-error "not a regular file"

2015-12-29 Thread David Bremner
Peter Salazar  writes:


> Yes, following your steps, emacs -q followed by "M-x load-library 
> notmuch", I was able to send an email without the error. It prompted me for
> my smtp server, username, and password, then returned this:
>

[snip]
> Does this give us any leads?

It seems to be some interaction with your configuration. I'm not
familiar with this "send-message-without-bullets" function. Perhaps you
could point us to the source?

d

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


[PATCH v2] test: Unset ALTERNATE_EDITOR before running emacsclient

2015-12-29 Thread Michal Sojka
ALTERNATE_EDITOR causes emacsclient to run an alternate editor if the
emacs server is not ready. This can collide with intended
functionality in test-lib.sh.

If the ALTERNATE_EDITOR is set but empty, emacsclient runs emacs
daemon and tries to connect to it. When this happens the emacs run by
test-lib.sh fails to start the server and the subsequent attempts to
use the server fail because the daemon started by emacsclient does not
know about notmuch-test-progn. This leads to test suite failure due to
time out on any emacs test.
---
 test/test-lib.sh | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/test/test-lib.sh b/test/test-lib.sh
index 126911f..270c718 100644
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -82,6 +82,9 @@ unset CDPATH
 
 unset GREP_OPTIONS
 
+# For emacsclient
+unset ALTERNATE_EDITOR
+
 # Convenience
 #
 # A regexp to match 5 and 40 hexdigits
-- 
2.6.4

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


[PATCH] test: Always use paths without symlinks

2015-12-29 Thread Michal Sojka
When notmuch sources are at a symlinked path, some tests fail because
one part of the test uses physical path and another uses logical
path (with symlinks). For example the following test output is
produced when the test is started from /home/src/symlink-to-notmuch,
which is a symlink to /home/src/notmuch.

FAIL   notmuch-fcc-dirs set to a string
--- T310-emacs.26.OUTPUT2015-12-29 08:54:29.055878637 +
+++ T310-emacs.26.EXPECTED  2015-12-29 08:54:29.055878637 +
@@ -1,5 +1,5 @@
 From: Notmuch Test Suite 
 To:
 Subject:
-Fcc: /home/src/notmuch/test/tmp.T310-emacs/mail/sent-string
+Fcc: /home/src/symlink-to-notmuch/test/tmp.T310-emacs/mail/sent-string
 --text follows this line--
nil

This commit makes all paths in test scripts physical. With it, all
tests pass even when run from a symlinked directory.
---
 test/test-lib-common.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/test-lib-common.sh b/test/test-lib-common.sh
index 5eb618c..4e17b78 100644
--- a/test/test-lib-common.sh
+++ b/test/test-lib-common.sh
@@ -48,7 +48,7 @@ restore_database () {
 
 # Test the binaries we have just built.  The tests are kept in
 # test/ subdirectory and are run in 'trash directory' subdirectory.
-TEST_DIRECTORY=$(pwd)
+TEST_DIRECTORY=$(pwd -P)
 notmuch_path=`find_notmuch_path "$TEST_DIRECTORY"`
 
 # configure output
-- 
2.6.4

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


Re: [PATCH] lib: have two definitions of NOTMUCH_DEPRECATED macro

2015-12-29 Thread Jani Nikula
On Tue, 11 Aug 2015, Tomi Ollila  wrote:
> Some compilers (older than gcc 4.5 and clang 2.9) do support
> __attribute__ ((deprecated)) but not
> __attribute__ ((deprecated("message"))).
>
> Check (clang) and know (gcc) which versions support which variants
> and make two definitions of define NOTMUCH_DEPRECATED macro;
> one with and and one without the ("message") part.
>
> __has_extension() replacement was modeled after __has_attribute()
> definition in compat/function-attributes.h. Thanks Justus.
> ---
>  lib/notmuch.h | 14 ++
>  1 file changed, 14 insertions(+)
>
> diff --git a/lib/notmuch.h b/lib/notmuch.h
> index b1f5bfa..3f4621b 100644
> --- a/lib/notmuch.h
> +++ b/lib/notmuch.h
> @@ -59,8 +59,22 @@ NOTMUCH_BEGIN_DECLS
>  #define LIBNOTMUCH_MINOR_VERSION 3
>  #define LIBNOTMUCH_MICRO_VERSION 0
>  
> +/* clang provides this macro to test for support for language
> + * extensions. If it isn't defined, this provides a compatibility
> + * macro for other compilers.
> + */
> +#ifndef __has_extension
> +#define __has_extension(x) 0
> +#endif

This file is included by the users of the library, and thus this
definition leaks to our users. It might cause problems if the users have
different expectations for handling ifndef __has_extension. I don't
think we should define things outside of our namespace in notmuch.h.

BR,
Jani.

> +
> +#if __clang__ && __has_extension(attribute_deprecated_with_message) || \
> +__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 5
>  #define NOTMUCH_DEPRECATED(major,minor) \
>  __attribute__ ((deprecated ("function deprecated as of libnotmuch " 
> #major "." #minor)))
> +#else
> +#define NOTMUCH_DEPRECATED(major,minor) __attribute__ ((deprecated))
> +#endif
> +
>  #endif /* __DOXYGEN__ */
>  
>  /**
> -- 
> 2.4.3
>
> ___
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] test: Always use paths without symlinks

2015-12-29 Thread Tomi Ollila
On Tue, Dec 29 2015, Michal Sojka  wrote:

> When notmuch sources are at a symlinked path, some tests fail because
> one part of the test uses physical path and another uses logical
> path (with symlinks). For example the following test output is
> produced when the test is started from /home/src/symlink-to-notmuch,
> which is a symlink to /home/src/notmuch.
>
> FAIL   notmuch-fcc-dirs set to a string
> --- T310-emacs.26.OUTPUT2015-12-29 08:54:29.055878637 +
> +++ T310-emacs.26.EXPECTED  2015-12-29 08:54:29.055878637 +
> @@ -1,5 +1,5 @@
>  From: Notmuch Test Suite 
>  To:
>  Subject:
> -Fcc: /home/src/notmuch/test/tmp.T310-emacs/mail/sent-string
> +Fcc: 
> /home/src/symlink-to-notmuch/test/tmp.T310-emacs/mail/sent-string
>  --text follows this line--
> nil
>
> This commit makes all paths in test scripts physical. With it, all
> tests pass even when run from a symlinked directory.

Looks good, is portable (bash builtin) and seems also fix cases I thought
might have been a problem instead.

Tomi


> ---
>  test/test-lib-common.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/test/test-lib-common.sh b/test/test-lib-common.sh
> index 5eb618c..4e17b78 100644
> --- a/test/test-lib-common.sh
> +++ b/test/test-lib-common.sh
> @@ -48,7 +48,7 @@ restore_database () {
>  
>  # Test the binaries we have just built.  The tests are kept in
>  # test/ subdirectory and are run in 'trash directory' subdirectory.
> -TEST_DIRECTORY=$(pwd)
> +TEST_DIRECTORY=$(pwd -P)
>  notmuch_path=`find_notmuch_path "$TEST_DIRECTORY"`
>  
>  # configure output
> -- 
> 2.6.4
>
> ___
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH v2] test: Unset ALTERNATE_EDITOR before running emacsclient

2015-12-29 Thread Tomi Ollila
On Tue, Dec 29 2015, Michal Sojka  wrote:

> ALTERNATE_EDITOR causes emacsclient to run an alternate editor if the
> emacs server is not ready. This can collide with intended
> functionality in test-lib.sh.
>
> If the ALTERNATE_EDITOR is set but empty, emacsclient runs emacs
> daemon and tries to connect to it. When this happens the emacs run by
> test-lib.sh fails to start the server and the subsequent attempts to
> use the server fail because the daemon started by emacsclient does not
> know about notmuch-test-progn. This leads to test suite failure due to
> time out on any emacs test.
> ---

LGTM.
Tomi


>  test/test-lib.sh | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/test/test-lib.sh b/test/test-lib.sh
> index 126911f..270c718 100644
> --- a/test/test-lib.sh
> +++ b/test/test-lib.sh
> @@ -82,6 +82,9 @@ unset CDPATH
>  
>  unset GREP_OPTIONS
>  
> +# For emacsclient
> +unset ALTERNATE_EDITOR
> +
>  # Convenience
>  #
>  # A regexp to match 5 and 40 hexdigits
> -- 
> 2.6.4
>
> ___
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch