Re: [PATCH 1/3] test: shrink T590-thread-breakage test decription to one line

2017-03-04 Thread David Bremner
Jani Nikula  writes:

> The test description is used for log output, I think the intention is
> to keep it as a one-liner. Leave the rest of the long description as a
> comment.

pushed this one patch to master
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 1/2] lib: centralize query parsing, store results.

2017-03-04 Thread David Bremner
David Bremner  writes:

> The main goal is to prepare the way for non-destructive (or at least
> less destructive) exclude tag handling. It does this by having a
> pre-parsed query available for further processing. This also allows us
> to provide slightly more precise errorr messages.

series pushed to master, with the spelling errorr fixed.

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


Re: [PATCH] lib: use delete[] to free buffer allocated using new[]

2017-03-04 Thread David Bremner
Jani Nikula  writes:

> Fix warning caught by clang:
>
> lib/regexp-fields.cc:41:2: warning: 'delete' applied to a pointer that was 
> allocated
>   with 'new[]'; did you mean 'delete[]'? [-Wmismatched-new-delete]
> delete buffer;
> ^
>   []
> lib/regexp-fields.cc:37:17: note: allocated with 'new[]' here
> char *buffer = new char[len];
>^

bad me.

Pushed to master.

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


Re: [PATCH v3 1/2] Test: emacs: test for folding long headers.

2017-03-04 Thread David Bremner
Mark Walters  writes:

> Headers of more than 998 characters should be folded when sending.
> However, until recently, emacs did not do this.

series pushed to master

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


[PATCH v3 1/2] Test: emacs: test for folding long headers.

2017-03-04 Thread Mark Walters
Headers of more than 998 characters should be folded when sending.
However, until recently, emacs did not do this.

This adds a (known broken) test for this when sending messages in
emacs. We will backport the fix to notmuch-emacs in the next
changeset.
---
 test/T310-emacs.sh | 78 ++
 1 file changed, 78 insertions(+)

diff --git a/test/T310-emacs.sh b/test/T310-emacs.sh
index 01385ae..f626d9a 100755
--- a/test/T310-emacs.sh
+++ b/test/T310-emacs.sh
@@ -208,6 +208,84 @@ This is a test that messages are sent via SMTP
 EOF
 test_expect_equal_file OUTPUT EXPECTED
 
+test_begin_subtest "Folding a long header when sending via (fake) SMTP"
+long_subject="This is a long subject `echo {1..1000}`"
+emacs_deliver_message \
+"${long_subject}" \
+'This is a test that long headers are folded when messages are sent via 
SMTP' \
+'(message-goto-to)
+ (kill-whole-line)
+ (insert "To: u...@example.com\n")'
+sed \
+-e s',^Message-ID: <.*>$,Message-ID: ,' \
+-e s',^\(Content-Type: text/plain\); charset=us-ascii$,\1,' < sent_message 
>OUTPUT
+cat 

[PATCH v3 0/2] emacs: fold long headers when sending

2017-03-04 Thread Mark Walters
Version 2 of this series is at
id:1488649637-19006-1-git-send-email-markwalters1...@gmail.com

The change here is to split the folding headers function into an
explicit function as this makes managing the hook simpler.

Best wishes

Mark


Mark Walters (2):
  Test: emacs: test for folding long headers.
  emacs: compat: backport fix for folding long headers when sending

 emacs/notmuch-compat.el | 28 +++---
 test/T310-emacs.sh  | 78 +
 2 files changed, 102 insertions(+), 4 deletions(-)

-- 
2.1.4

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


[PATCH v3 2/2] emacs: compat: backport fix for folding long headers when sending

2017-03-04 Thread Mark Walters
This backports the fix from emacs master (commit
77bbca8c82f6e553c42abbfafca28f55fc995d00) to notmuch-emacs to wrap
long headers.

This fixes the test introduced in the previous changeset.
---
 emacs/notmuch-compat.el | 28 
 1 file changed, 24 insertions(+), 4 deletions(-)

diff --git a/emacs/notmuch-compat.el b/emacs/notmuch-compat.el
index c3d827a..2cedd39 100644
--- a/emacs/notmuch-compat.el
+++ b/emacs/notmuch-compat.el
@@ -1,8 +1,28 @@
-;; Compatibility functions for emacs 23 and 24 pre 24.4
+;; Compatibility functions for earlier versions of emacs
 
-;; The functions in this file are copied from eamcs 24.4 and are
-;; Copyright (C) 1985-1986, 1992, 1994-1995, 1999-2014 Free Software
-;; Foundation, Inc.
+;; The functions in this file are copied from more modern versions of
+;; emacs and are Copyright (C) 1985-1986, 1992, 1994-1995, 1999-2017
+;; Free Software Foundation, Inc.
+
+
+;; emacs master has a bugfix for folding long headers when sending
+;; messages. Include the fix for earlier versions of emacs. To avoid
+;; interfering with gnus we only run the hook when called from
+;; notmuch-message-mode.
+
+(declare-function mail-header-fold-field "mail-parse" nil)
+
+(defun notmuch-message--fold-long-headers ()
+  (when (eq major-mode 'notmuch-message-mode)
+(goto-char (point-min))
+(while (not (eobp))
+  (when (and (looking-at "[^:]+:")
+(> (- (line-end-position) (point)) 998))
+   (mail-header-fold-field))
+  (forward-line 1
+
+(unless (fboundp 'message--fold-long-headers)
+  (add-hook 'message-header-hook 'notmuch-message--fold-long-headers))
 
 (if (fboundp 'setq-local)
 (defalias 'notmuch-setq-local 'setq-local)
-- 
2.1.4

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


Re: [PATCH v2 2/2] emacs: compat: backport fix for folding long headers when sending

2017-03-04 Thread David Bremner
Mark Walters  writes:

> This backports the fix from emacs master (commit
> 77bbca8c82f6e553c42abbfafca28f55fc995d00) to notmuch-emacs to wrap
> long headers.
>
> This fixes the test introduced in the previous changeset.
> ---
>  emacs/notmuch-compat.el | 28 
>  1 file changed, 24 insertions(+), 4 deletions(-)
>
> diff --git a/emacs/notmuch-compat.el b/emacs/notmuch-compat.el
> index c3d827a..e71e861 100644
> --- a/emacs/notmuch-compat.el
> +++ b/emacs/notmuch-compat.el
> @@ -1,8 +1,28 @@
> -;; Compatibility functions for emacs 23 and 24 pre 24.4
> +;; Compatibility functions for earlier versions of emacs
>  
> -;; The functions in this file are copied from eamcs 24.4 and are
> -;; Copyright (C) 1985-1986, 1992, 1994-1995, 1999-2014 Free Software
> -;; Foundation, Inc.
> +;; The functions in this file are copied from more modern versions of
> +;; emacs and are Copyright (C) 1985-1986, 1992, 1994-1995, 1999-2017
> +;; Free Software Foundation, Inc.
> +
> +
> +

Seems to be a lot of blank lines.

> +;; emacs master has a bugfix for folding long headers when sending
> +;; messages. Include the fix for earlier versions of emacs. To avoid
> +;; interfering with gnus we only run the hook when called from
> +;; notmuch-message-mode.
> +
> +(declare-function mail-header-fold-field "mail-parse" nil)
> +
> +(unless (fboundp 'message--fold-long-headers)
> +  (add-hook 'message-header-hook
> + (lambda ()
> +   (when (eq major-mode 'notmuch-message-mode)
> + (goto-char (point-min))
> + (while (not (eobp))
> +   (when (and (looking-at "[^:]+:")
> +  (> (- (line-end-position) (point)) 998))
> + (mail-header-fold-field))
> +   (forward-line 1))

I'm just parroting what I've read, but it makes it hard for people to
manage hooks when you use a lambda instead of a named function. What do
you think about defining something notmuch-message--fold-long-headers
(using your code above) and adding that to the hook is
message--fold-long-headers is unbound?

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


Re: [PATCH v2 1/2] Test: emacs: test for folding long headers.

2017-03-04 Thread David Bremner
Mark Walters  writes:

> Headers of more than 998 characters should be folded when sending.
> However, until recently, emacs did not do this.
>
> This adds a (known broken) test for this when sending messages in
> emacs. We will backport the fix to notmuch-emacs in the next
> changeset.

I should have thought about this sooner, but this test is actually a bit
fragile. If the folding width changes for some reason in emacs, then the
test will break. I guess it's a corner case that we can live with.

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


[PATCH v2 0/2] emacs: fold long headers when sending

2017-03-04 Thread Mark Walters
The only change from v1 (at
id:1485684281-2760-1-git-send-email-markwalters1...@gmail.com ) is an
updated test as suggested by Domo using echo {1..1000} instead of seq.

Best wishes

Mark


Mark Walters (2):
  Test: emacs: test for folding long headers.
  emacs: compat: backport fix for folding long headers when sending

 emacs/notmuch-compat.el | 28 +++---
 test/T310-emacs.sh  | 78 +
 2 files changed, 102 insertions(+), 4 deletions(-)

-- 
2.1.4

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


[PATCH v2 2/2] emacs: compat: backport fix for folding long headers when sending

2017-03-04 Thread Mark Walters
This backports the fix from emacs master (commit
77bbca8c82f6e553c42abbfafca28f55fc995d00) to notmuch-emacs to wrap
long headers.

This fixes the test introduced in the previous changeset.
---
 emacs/notmuch-compat.el | 28 
 1 file changed, 24 insertions(+), 4 deletions(-)

diff --git a/emacs/notmuch-compat.el b/emacs/notmuch-compat.el
index c3d827a..e71e861 100644
--- a/emacs/notmuch-compat.el
+++ b/emacs/notmuch-compat.el
@@ -1,8 +1,28 @@
-;; Compatibility functions for emacs 23 and 24 pre 24.4
+;; Compatibility functions for earlier versions of emacs
 
-;; The functions in this file are copied from eamcs 24.4 and are
-;; Copyright (C) 1985-1986, 1992, 1994-1995, 1999-2014 Free Software
-;; Foundation, Inc.
+;; The functions in this file are copied from more modern versions of
+;; emacs and are Copyright (C) 1985-1986, 1992, 1994-1995, 1999-2017
+;; Free Software Foundation, Inc.
+
+
+
+;; emacs master has a bugfix for folding long headers when sending
+;; messages. Include the fix for earlier versions of emacs. To avoid
+;; interfering with gnus we only run the hook when called from
+;; notmuch-message-mode.
+
+(declare-function mail-header-fold-field "mail-parse" nil)
+
+(unless (fboundp 'message--fold-long-headers)
+  (add-hook 'message-header-hook
+   (lambda ()
+ (when (eq major-mode 'notmuch-message-mode)
+   (goto-char (point-min))
+   (while (not (eobp))
+ (when (and (looking-at "[^:]+:")
+(> (- (line-end-position) (point)) 998))
+   (mail-header-fold-field))
+ (forward-line 1))
 
 (if (fboundp 'setq-local)
 (defalias 'notmuch-setq-local 'setq-local)
-- 
2.1.4

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


[PATCH v2 1/2] Test: emacs: test for folding long headers.

2017-03-04 Thread Mark Walters
Headers of more than 998 characters should be folded when sending.
However, until recently, emacs did not do this.

This adds a (known broken) test for this when sending messages in
emacs. We will backport the fix to notmuch-emacs in the next
changeset.
---
 test/T310-emacs.sh | 78 ++
 1 file changed, 78 insertions(+)

diff --git a/test/T310-emacs.sh b/test/T310-emacs.sh
index 01385ae..f626d9a 100755
--- a/test/T310-emacs.sh
+++ b/test/T310-emacs.sh
@@ -208,6 +208,84 @@ This is a test that messages are sent via SMTP
 EOF
 test_expect_equal_file OUTPUT EXPECTED
 
+test_begin_subtest "Folding a long header when sending via (fake) SMTP"
+long_subject="This is a long subject `echo {1..1000}`"
+emacs_deliver_message \
+"${long_subject}" \
+'This is a test that long headers are folded when messages are sent via 
SMTP' \
+'(message-goto-to)
+ (kill-whole-line)
+ (insert "To: u...@example.com\n")'
+sed \
+-e s',^Message-ID: <.*>$,Message-ID: ,' \
+-e s',^\(Content-Type: text/plain\); charset=us-ascii$,\1,' < sent_message 
>OUTPUT
+cat 

[PATCH] lib: use delete[] to free buffer allocated using new[]

2017-03-04 Thread Jani Nikula
Fix warning caught by clang:

lib/regexp-fields.cc:41:2: warning: 'delete' applied to a pointer that was 
allocated
  with 'new[]'; did you mean 'delete[]'? [-Wmismatched-new-delete]
delete buffer;
^
  []
lib/regexp-fields.cc:37:17: note: allocated with 'new[]' here
char *buffer = new char[len];
   ^
---
 lib/regexp-fields.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/regexp-fields.cc b/lib/regexp-fields.cc
index 9873af803991..b41747502e1e 100644
--- a/lib/regexp-fields.cc
+++ b/lib/regexp-fields.cc
@@ -38,7 +38,7 @@ compile_regex (regex_t ®exp, const char *str)
std::string msg;
(void) regerror (err, ®exp, buffer, len);
msg.assign (buffer, len);
-   delete buffer;
+   delete[] buffer;
 
throw Xapian::QueryParserError (msg);
 }
-- 
2.11.0

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


Re: Github an licensing

2017-03-04 Thread Mark Walters

> On irc rlb pointed me to
> https://joeyh.name/blog/entry/removing_everything_from_github/
>
> IANAL so I don't know whether it is a real problem, a hypothetical
> problem or not a problem.

I got a couple of links sent to me privately which look relevant:

 * https://news.ycombinator.com/item?id=13767373
 * https://news.ycombinator.com/item?id=13766933

(hacker threads, but from people claiming to be lawyers)

Best wishes

Mark


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


Github an licensing

2017-03-04 Thread Mark Walters

Dear All

On irc rlb pointed me to
https://joeyh.name/blog/entry/removing_everything_from_github/

IANAL so I don't know whether it is a real problem, a hypothetical
problem or not a problem.

My guess is that it can't affect the main notmuch license as the bulk of
notmuch's copyright is owned by people not responsible for the github
mirror (*), but it might mean that those of us responsible for the mirror are
illegally posting notmuch's code.

Does anyone have any views on this, and whether we should carry on
maintaining the github mirror?

Best wishes

Mark

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


Re: some issues with emacs 25

2017-03-04 Thread David Bremner
David Bremner  writes:

> Matthew Lear  writes:
>
>
>> Thanks David. Yes it does. After recompiling the v25 lisp with these
>> changes, I'm unable to reproduce the problems with both the test emails I
>> sent you. Wonderful :-)
>> Are you going to raise this with upstream?
>> Cheers,
>>  Matt
>
> Yes, I've filed
>
>  https://debbugs.gnu.org/cgi/bugreport.cgi?bug=25828
>

That bug should be fixed in emacs master branch.

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