Re: [PATCH] emacs: bind M-RET to notmuch-tree-from-search-thread

2019-11-20 Thread Daniel Kahn Gillmor
On Wed 2019-11-13 14:57:52 -0800, William Casarin wrote:
> This is an unbound function that is quite useful. It opens a selected
> thread in notmuch-tree from the current search query.
>
> Signed-off-by: William Casarin 
>
> ---
>
> This is a simpler alternative to id:20191113080004.32214-1-j...@jb55.com
>
>  emacs/notmuch.el | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/emacs/notmuch.el b/emacs/notmuch.el
> index 773d1206..0d68d123 100644
> --- a/emacs/notmuch.el
> +++ b/emacs/notmuch.el
> @@ -188,6 +188,7 @@ there will be called at other points of notmuch 
> execution."
>  (define-key map "-" 'notmuch-search-remove-tag)
>  (define-key map "+" 'notmuch-search-add-tag)
>  (define-key map (kbd "RET") 'notmuch-search-show-thread)
> +(define-key map (kbd "M-RET") 'notmuch-tree-from-search-thread)
>  (define-key map "Z" 'notmuch-tree-from-search-current-query)
>  map)
>"Keymap for \"notmuch search\" buffers.")
>

LGTM.

Thanks for suggesting this.

   --dkg


signature.asc
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] Display extra headers for emacs-mua - db config option

2019-11-20 Thread Daniel Kahn Gillmor
On Sat 2019-11-16 17:27:23 +0100, Johan Parin wrote:
> Modify format_headers_sprinter so that it returns some additional headers in 
> the
> sexp, instead of a small fixed set of headers.
>
> The extra header list is configured by the database config option
> `show.extra_headers'.
>
> This is required in order for the elisp variable
> `notmuch-message-headers' to work.

Thanks for this work, Johan, and for your persistence on this
functionality.

> diff --git a/notmuch-show.c b/notmuch-show.c
> index 21792a57..4c77468f 100644
> --- a/notmuch-show.c
> +++ b/notmuch-show.c
> @@ -18,11 +18,16 @@
>   * Author: Carl Worth 
>   */
>  
> +#include 
> +
>  #include "notmuch-client.h"
>  #include "gmime-filter-reply.h"
>  #include "sprinter.h"
>  #include "zlib-extra.h"
>  
> +static notmuch_database_t *notmuch = NULL;
> +
> +
>  static const char *
>  _get_tags_as_string (const void *ctx, notmuch_message_t *message)
>  {
> @@ -195,6 +200,38 @@ _is_from_line (const char *line)
>   return 0;
>  }
>  
> +/* Output extra headers if configured with the `show.extra_headers'
> + * database configuration option
> + */
> +void
> +format_extra_headers_sprinter (sprinter_t *sp, GMimeMessage *message)
> +{
> +GMimeHeaderList *header_list;
> +GMimeHeader *header;
> +char *extra_headers, *tofree, *header_name;
> +
> +if (notmuch == NULL)
> + return;
> +
> +if (notmuch_database_get_config (notmuch, "show.extra_headers",
> +  _headers) != NOTMUCH_STATUS_SUCCESS)
> + return;
> +
> +header_list  = g_mime_object_get_header_list (GMIME_OBJECT(message));
> +
> +tofree = extra_headers;
> +while ( (header_name = strsep(_headers, ";")) != NULL) {
> +
> + header = g_mime_header_list_get_header (header_list, header_name);
> + if (header == NULL)
> + continue;
> +
> + sp->map_key (sp, g_mime_header_get_name(header));
> + sp->string (sp, g_mime_header_get_value(header));
> +}
> +free (tofree);
> +}
> +
>  void
>  format_headers_sprinter (sprinter_t *sp, GMimeMessage *message,
>bool reply, const _notmuch_message_crypto_t 
> *msg_crypto)
> @@ -253,6 +290,9 @@ format_headers_sprinter (sprinter_t *sp, GMimeMessage 
> *message,
>  } else {
>   sp->map_key (sp, "Date");
>   sp->string (sp, g_mime_message_get_date_string (sp, message));
> +
> + /* Output extra headers the user has configured in the database, if any 
> */
> + format_extra_headers_sprinter (sp, message);
>  }
>  
>  sp->end (sp);
> @@ -1152,7 +1192,6 @@ static const notmuch_show_format_t *formatters[] = {
>  int
>  notmuch_show_command (notmuch_config_t *config, int argc, char *argv[])
>  {
> -notmuch_database_t *notmuch;
>  notmuch_query_t *query;
>  char *query_string;
>  int opt_index, ret;

I'm a little weirded out by the move to a static notmuch_database_t
*notmuch object.  Are we doing this because we don't want to pass around
the database to internal functions?  I know that the scope of
nomtuch-show.c is basically "global scope", but i worry that it makes
the code more difficult to read and maintain.

It's also not a common idiom in the rest of the codebase (at least not
one that i've seen).

Is it that much worse to pass around the notmuch_database_t *?

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


Re: wish: notmuch-emacs: handle RFC822 attachments as email (allow for replying)

2019-11-20 Thread Daniel Kahn Gillmor
On Wed 2019-11-13 09:44:41 +, David Edmondson wrote:
> 1. extract the attachment, add it to the database and use normal reply
>processing (maybe remember to remove the message from the database
>after?),

I do this in the notmuch-emacs interface with:

   . | notmuch insert

I don't bother removing it from the database afterward, i'm happy to
have it retained in the db as a first-class object for future reference.

  --dkg


signature.asc
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: Workaround for Exchange-corrupted PGP/Mime structure

2019-11-20 Thread Daniel Kahn Gillmor
On Wed 2019-11-20 13:19:12 -0800, Carl Worth wrote:
> On Wed, Nov 20 2019, Carl Worth wrote:
>> I'll update my notmuch and give this a try.
>
> Just a "git pull; make; make install" and my problem went away.
>
> Thanks again for the fixes, Daniel.

Glad that it worked for you!

(and, thanks for the pointers to the additional documentation of the
problem)

--dkg


signature.asc
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: Debian packaging cleanup

2019-11-20 Thread Daniel Kahn Gillmor
On Tue 2019-11-12 10:47:33 -0500, Antoine Beaupré wrote:
> On 2019-11-10 12:37:42, Daniel Kahn Gillmor wrote:
>> This series offers a set of simple and small changes to the debian
>> packaging for notmuch.  they apply to the master branch.
>
> Looks good to me.

Anarcat has reviewed these, but they're still tagged
notmuch::needs-review in nmbug.  should i clear these tags now that
they've been reviewed by someone who knows something about debian
packaging?

--dkg


signature.asc
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: Workaround for Exchange-corrupted PGP/Mime structure

2019-11-20 Thread Daniel Kahn Gillmor
On Wed 2019-11-20 17:10:40 -0500, Brian Sniffen wrote:
> Yeah, these have been fantastic for me too.  MSFT has no intention of
> fixing PGP or MIME support; it's been well over a decade.  

I'm unwilling to accept this situation, and i hope that other people
will join me in exerting pressure on MSFT to fix this.

fwiw, there are versions or configurations of Exchange (or of their
SMTP/submission subsystem) that *do not* introduce this failure, and
I've had some success in getting MSFT to adjust the version or
configuration of Exchange used by some clients that can demonstrate that
their sent mail is being mangled, to the point where the messages are no
longer being mangled.

While i've documented the mangling publicly:

   
https://tools.ietf.org/html/draft-dkg-openpgp-pgpmime-message-mangling-00#section-4.1

I would *really* like to see MSFT publicly acknowledge this as a
flaw/vulnerability in specific versions/configurations of their
products, so that we can push people running vulnerable
versions/configurations to upgrade/change.

If you know anyone whose messages are being mangled in this way, i would
appreciate being put in touch with them, so that i can help them (as a
customer) push Microsoft into a better position.

If you've encountered any message like this while running notmuch from
git master, you should be able to identify those messages with:

notmuch search property:index.repaired=mixedup

Feel free to reply to me off-list if you have identified anyone who
might be interested in trying to improve the situation (or if you
yourself are interested in doing this).  I might be able to help you
figure out specific ways to push Microsoft to avoid causing this failure
in the future.

  --dkg


signature.asc
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 2/2] Rename package to notmuch2

2019-11-20 Thread David Bremner
Floris Bruynooghe  writes:

> This is based on a previous discussion on the list where this was more
> or less seen as the least-bad option.

pushed to wip/cffi, along with the other patch switching away from the
deprecated API.

I still need to review the discussion and see if there is any
outstanding review comments from Tomi (or other people).

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


Re: [PATCH] python: make some docstrings raw

2019-11-20 Thread David Bremner
Jakub Wilk  writes:

> Fixes:
>
> notmuch/message.py:57: DeprecationWarning: invalid escape sequence \s
> notmuch/query.py:155: DeprecationWarning: invalid escape sequence \.
> notmuch/messages.py:89: DeprecationWarning: invalid escape sequence \s
>
> with Python >= 3.6.

Pushed to master. I struggled a bit to understand what those backslashes
are doing there, but they've been there forever...
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: Workaround for Exchange-corrupted PGP/Mime structure

2019-11-20 Thread Brian Sniffen
Carl Worth  writes:

> On Wed, Nov 20 2019, Carl Worth wrote:
>> I'll update my notmuch and give this a try.
>
> Just a "git pull; make; make install" and my problem went away.
>
> Thanks again for the fixes, Daniel.

Yeah, these have been fantastic for me too.  MSFT has no intention of
fixing PGP or MIME support; it's been well over a decade.  
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: Workaround for Exchange-corrupted PGP/Mime structure

2019-11-20 Thread Carl Worth
On Wed, Nov 20 2019, Carl Worth wrote:
> I'll update my notmuch and give this a try.

Just a "git pull; make; make install" and my problem went away.

Thanks again for the fixes, Daniel.

-Carl



signature.asc
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: Workaround for Exchange-corrupted PGP/Mime structure

2019-11-20 Thread Carl Worth
On Wed, Nov 20 2019, David Bremner wrote:
> There's some recent work by dkg in (currrently unreleased) commits on
> master. "git log -Smangled"

Thanks, David, and Daniel!

Those commit messages look very useful to me.

I'll update my notmuch and give this a try.

-Carl


signature.asc
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: Workaround for Exchange-corrupted PGP/Mime structure

2019-11-20 Thread David Bremner
Ralph Seichter  writes:

> * Carl Worth:
>
>> What would anyone think about a workaround where notmuch-emacs could
>> grub around inside a "multipart/mixed" structure looking for child
>> parts that look like they really should have been a part of a
>> "multipart/encrypted" container?
>
> Personally, I see no reason to spend any effort in Notmuch to fix
> whatever Exchange has screwed up this week. Microsoft has more than
> enough resources to clean up their own messes, don't you think?
>

There's some recent work by dkg in (currrently unreleased) commits on
master. "git log -Smangled"

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


Re: Workaround for Exchange-corrupted PGP/Mime structure

2019-11-20 Thread Ralph Seichter
* Carl Worth:

> What would anyone think about a workaround where notmuch-emacs could
> grub around inside a "multipart/mixed" structure looking for child
> parts that look like they really should have been a part of a
> "multipart/encrypted" container?

Personally, I see no reason to spend any effort in Notmuch to fix
whatever Exchange has screwed up this week. Microsoft has more than
enough resources to clean up their own messes, don't you think?

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


Workaround for Exchange-corrupted PGP/Mime structure

2019-11-20 Thread Carl Worth
I recently received a GPG-encrypted message that notmuch was not able to
handle transparently as I'm used to. (That is, instead of decrypting the
message and verifying the signature inside, etc.—instead I was just
presented with an attachment that contained the encrypted message.)

After some poking around, it appears that the problem is that the
message was sent through Microsoft Exchange which corrupts PGP/mime
structure by changing the outer content-type from "multipart/encrypted"
to "multipart/mixed".

I've verified this bug by sending mail from notmuch through Exchange as
the MTA and it indeed does corrupt the mail in exactly this fashion.

It looks like this bug in Exchange is known[1] and there's evidence of
other MUAs working around the bug[2].

Have other notmuch users encountered this problem?

What would anyone think about a workaround where notmuch-emacs could
grub around inside a "multipart/mixed" structure looking for child parts
that look like they really should have been a part of a
"multipart/encrypted" container?

-Carl

[1] 
https://social.technet.microsoft.com/Forums/en-US/c5059734-5031-4d82-96eb-c74fe60b5e9e/quotthis-is-a-broken-pgpmime-message-from-msexchangequot

[2] https://gitlab.com/mikecardwell/gpgit/blob/master/gpgit.pl#L108
which also refers to Enigmail having a workaround for thi.


signature.asc
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] python: make some docstrings raw

2019-11-20 Thread Jakub Wilk
Fixes:

notmuch/message.py:57: DeprecationWarning: invalid escape sequence \s
notmuch/query.py:155: DeprecationWarning: invalid escape sequence \.
notmuch/messages.py:89: DeprecationWarning: invalid escape sequence \s

with Python >= 3.6.
---
 bindings/python/notmuch/message.py  | 2 +-
 bindings/python/notmuch/messages.py | 2 +-
 bindings/python/notmuch/query.py| 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/bindings/python/notmuch/message.py 
b/bindings/python/notmuch/message.py
index 6e32b5f7..e71dbe3e 100644
--- a/bindings/python/notmuch/message.py
+++ b/bindings/python/notmuch/message.py
@@ -46,7 +46,7 @@ import sys
 
 
 class Message(Python3StringMixIn):
-"""Represents a single Email message
+r"""Represents a single Email message
 
 Technically, this wraps the underlying *notmuch_message_t*
 structure. A user will usually not create these objects themselves
diff --git a/bindings/python/notmuch/messages.py 
b/bindings/python/notmuch/messages.py
index cae5da50..3801c666 100644
--- a/bindings/python/notmuch/messages.py
+++ b/bindings/python/notmuch/messages.py
@@ -32,7 +32,7 @@ from .tag import Tags
 from .message import Message
 
 class Messages(object):
-"""Represents a list of notmuch messages
+r"""Represents a list of notmuch messages
 
 This object provides an iterator over a list of notmuch messages
 (Technically, it provides a wrapper for the underlying
diff --git a/bindings/python/notmuch/query.py b/bindings/python/notmuch/query.py
index cc70e2aa..bdc18790 100644
--- a/bindings/python/notmuch/query.py
+++ b/bindings/python/notmuch/query.py
@@ -140,7 +140,7 @@ class Query(object):
 _search_threads.restype = c_uint
 
 def search_threads(self):
-"""Execute a query for threads
+r"""Execute a query for threads
 
 Execute a query for threads, returning a :class:`Threads` iterator.
 The returned threads are owned by the query and as such, will only be
-- 
2.24.0

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


Re: [PATCH 0/7] Port notmuch-show's x/X bindings to notmuch-tree

2019-11-20 Thread Teemu Likonen
William Casarin [2019-11-17T14:29:22-08] wrote:

> These patches bring notmuch-tree more in line with the user experience
> of notmuch-show by adding the x/X bindings.

I have not tested the patch set yet but I think it is very good idea to
add x/X keybindings to make tree view work similarly to show view.
Perhaps I will try the patch set later. Would you mind sending a fixed
version of "PATCH 5/7" (see id:87mucuay8p@jb55.com)?

-- 
///  OpenPGP key: 4E1055DC84E9DFF613D78557719D69D324539450
//  https://keys.openpgp.org/search?q=tliko...@iki.fi
/  https://keybase.io/tlikonen  https://github.com/tlikonen


signature.asc
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch