[PATCH] notmuch: Add tag archive when archiving the mails

classic Classic list List threaded Threaded
5 messages Options
Aneesh Kumar K.V Aneesh Kumar K.V
Reply | Threaded
Open this post in threaded view
|

[PATCH] notmuch: Add tag archive when archiving the mails


>From a2325b950016f39290a0c6f0d6aa3417584eb4e8 Mon Sep 17 00:00:00 2001
From: Aneesh Kumar K.V <[hidden email]>
Date: Wed, 18 Nov 2009 20:45:45 +0530
Subject: [PATCH] notmuch: Add tag archive when archiving the mails

This enables us to search for archived mails later

Signed-off-by: Aneesh Kumar K.V <[hidden email]>
---
 notmuch.el |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index 87116f9..ec2155a 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -196,6 +196,7 @@ Unlike builtin `next-line' this version accepts no arguments."
       (if markread
   (notmuch-show-remove-tag "unread" "inbox")
  (notmuch-show-remove-tag "inbox"))
+      (notmuch-show-add-tag "archive")
       (if (not (eobp))
   (forward-char))
       (if (not (re-search-forward notmuch-show-message-begin-regexp nil t))
--
1.6.5.2.74.g610f9


Keith Packard Keith Packard
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] notmuch: Add tag archive when archiving the mails


> This enables us to search for archived mails later

I think you can just use 'not tag:inbox' as 'archived' really just means
'doesn't have the inbox tag'.

--
[hidden email]



attachment0 (189 bytes) Download Attachment
Jeffrey Ollie Jeffrey Ollie
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] notmuch: Add tag archive when archiving the mails

On Wed, Nov 18, 2009 at 1:07 PM, Keith Packard <[hidden email]> wrote:
>
>> This enables us to search for archived mails later
>
> I think you can just use 'not tag:inbox' as 'archived' really just means
> 'doesn't have the inbox tag'.

That resulted in an error for me:

$ notmuch search not tag:inbox
A Xapian exception occurred: Syntax: <expression> NOT <expression>
A Xapian exception occurred: Syntax: <expression> NOT <expression>

--
Jeff Ollie

Keith Packard Keith Packard
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] notmuch: Add tag archive when archiving the mails

On Wed, 18 Nov 2009 13:50:58 -0600, Jeffrey Ollie <[hidden email]> wrote:

> That resulted in an error for me:
>
> $ notmuch search not tag:inbox
> A Xapian exception occurred: Syntax: <expression> NOT <expression>
> A Xapian exception occurred: Syntax: <expression> NOT <expression>

Yeah, NOT isn't a unary operator in xapian; it's a binary operator that
means 'AND NOT'. The Xapian docs say that if you set the FLAG_PURE_NOT
flag, you'll get the unary behaviour, but I haven't tried that.

--
[hidden email]

attachment0 (189 bytes) Download Attachment
Carl Worth-2 Carl Worth-2
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] notmuch: Add tag archive when archiving the mails

In reply to this post by Jeffrey Ollie
On Wed, 18 Nov 2009 13:50:58 -0600, Jeffrey Ollie <[hidden email]> wrote:
> On Wed, Nov 18, 2009 at 1:07 PM, Keith Packard <[hidden email]> wrote:
> > I think you can just use 'not tag:inbox' as 'archived' really just means
> > 'doesn't have the inbox tag'.
>
> That resulted in an error for me:
>
> $ notmuch search not tag:inbox
> A Xapian exception occurred: Syntax: <expression> NOT <expression>
> A Xapian exception occurred: Syntax: <expression> NOT <expression>

Like I said earlier. I think that's a bug we should report to the Xapian
folks.

Meanwhile, it just occurred to me that we can make "notmuch search not
tag:inbox" work without any change to Xapian.

For every document we store in the database we put a special term on it
to indicate its type. (We mostly just have documents of type "mail" but
we also have documents of type "timestamp"---see the comment at the top
of lib/database.cc for details.)

So if we take the string "not tag:inbox" and turn it into "type:mail and
not tag:inbox" then that will work just fine. (That's close to what
we're doing currently, but different. Right now we try to parse the
query "not tag:inbox" on its own and then combine the result with
another query generated from a term representing the "mail" type.)

-Carl