Re: [PATCH] How to improve the mail handling workflow?

2010-11-15 Thread Michal Sojka
On Sat, 13 Nov 2010, Darren McGuicken wrote:
 On Sat, 13 Nov 2010 07:05:58 +0100, Michal Sojka sojk...@fel.cvut.cz wrote:
  I agree with you in that in many cases tags can be replaced by saved
  searches. Last time I did it, i.e. used saved searches to distinguish
  messages from different mailing lists, the result was that it took
  very long time (something like 5 seconds) to show notmuch-hello
 
 Interesting, what Xapian backend are you using?  I moved to chert after
 id:87ocl1lut1@yoom.home.cworth.org and my notmuch-hello with 15
 saved searches appears in a couple of seconds when freshly loaded,
 faster when switching back to it after use.  

I use chert as well.

 That may well be slower than just tag searches but it's not yet at a
 threshold where I notice it. How many searches had you saved?

I had 45 (or so). I wanted two searches for every mailing list. One 
tag:inbox and (...) and the second only 
 
  Additionally, I compared the speed of command line searches for tags
  and for the whole email addresses and even without the bug mentioned
  above, the search for to: is usually slower than the search for tag:.
 
 Very non-scientifically just using time and vm/drop_caches on my
 netbook, having tagged all mail sent to the list address with 'notmuch',
 I seem to get much the same performance:
 
$ time notmuch search tag:notmuch  /dev/null
 
real0m21.074s
user0m4.740s
sys 0m1.916s
 
$ time notmuch search to:notmuch  /dev/null
 
real0m20.280s
user0m4.600s
sys 0m2.048s
 
$ time notmuch search to:notmuch@notmuchmail.org  /dev/null
 
real0m21.790s
user0m5.044s
sys 0m2.008s

My current numbers (with hot cache) are bellow.

$ time notmuch count tag:notmuch

 
3243
0,00s user 0,00s system 72% cpu 0,011 total
$ time notmuch count to:notmuch@notmuchmail.org 

 
2477
0,03s user 0,00s system 89% cpu 0,036 total

That is 36ms vs. 11ms. If these numbers are multiplied by 45 (or by 90
with the bug in notmuch hello), this makes the difference.

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


Re: [PATCH] How to improve the mail handling workflow?

2010-11-15 Thread David Edmondson
On Sun, 14 Nov 2010 22:07:03 +0100, Sebastian Spaeth sebast...@sspaeth.de 
wrote:
  (define-key notmuch-search-mode-map d
(lambda ()
  delete thread and advance
  (interactive)
  (notmuch-search-add-tag deleted)
  (forward-line)))
 ...
 
 This only works if you've already loaded notmuch, or you get error
 messages about notmuch-search-mode-map not being known. How do you deal
 with that or does it simply work for you?

`eval-after-load' is your friend.

dme.
-- 
David Edmondson, http://dme.org
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] How to improve the mail handling workflow?

2010-11-14 Thread Matthieu Lemerre
 I think you guys may have a misunderstanding about how notmuch indexes
 mail.  Notmuch indexes multiple headers (To, From, Subject, Date) and
 the *entire* body of the message.  That's kind of the whole point.  In
 other words, messages don't have to have tags in order to be found.  

[...]

Not at all. Tags are just a useful complement of information, that
allows to quickly exclude irrelevant results from your search (and
avoids some noisy disk activity). It is just that some of us like to
have all their archived mails classified in some way (i.e. by adding a
label or tag), which can be used as a complementary information to help
refine your search. If archiving with a label is seemless, there is no
harm in adding informations to your mail, and it can be a real help when
you don't remember well what you're searching.

Now when you consistently label all your mails, you just don't want to
have unclassified mails. That is what we meant by mail you can't find.

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


Re: [PATCH] How to improve the mail handling workflow?

2010-11-14 Thread Jameson Rollins
On Sun, 14 Nov 2010 18:01:48 +0100, Matthieu Lemerre ra...@free.fr wrote:
 Now when you consistently label all your mails, you just don't want to
 have unclassified mails. That is what we meant by mail you can't find.

It sounds like this would just as easily be accomplished with a way to
search for all messages that don't have any tags.  I don't think there's
a way to do that at the moment.  Carl (on #notmuch) just confirmed that
this can only be accomplished by construction the search explicitly.
Here's what I came up with:

search=$(printf 'not (%s)\n' $(notmuch search --output=tags '*' | xargs -I'{}' 
echo tag:'{}' | tr '\n' ' ' | sed 's/ $//' | sed 's/ / or /g'))
notmuch search $search

Someone can probably figure out how to simplify that a bit.  I don't
think there's an easy way to save a search that's generated on the fly
like that.  Some elisp magic is probably in order.

jamie.


pgpsxvS1vWrvz.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] How to improve the mail handling workflow?

2010-11-14 Thread Sebastian Spaeth
On Fri, 12 Nov 2010 10:33:33 -0500, Jameson Rollins wrote:
 I agree that the function currently bound to space bar is annoying.  I
 am actually in the middle of preparing a patch to fix this.  I think
 that space should just scroll through the open messages.  I don't want
 it to archive anything, or pop out of the currently viewed thread.  I
 think this function is too aggressive as is.

+1 for not switching to the next thread. I often do it by accident.

 I agree that some built-in support for handling deleted tags is called
 for, but in the mean time it's very easy to make your own custom
 functions to drop into your emacs config.  I have the following:
 
 (define-key notmuch-search-mode-map d
   (lambda ()
 delete thread and advance
 (interactive)
 (notmuch-search-add-tag deleted)
 (forward-line)))
...

This only works if you've already loaded notmuch, or you get error
messages about notmuch-search-mode-map not being known. How do you deal
with that or does it simply work for you?

Sebastian


pgpoJJHhMX1lD.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] How to improve the mail handling workflow?

2010-11-14 Thread Jameson Rollins
On Sun, 14 Nov 2010 22:07:03 +0100, Sebastian Spaeth sebast...@sspaeth.de 
wrote:
 This only works if you've already loaded notmuch, or you get error
 messages about notmuch-search-mode-map not being known. How do you deal
 with that or does it simply work for you?

I have:

(require 'notmuch)

in my config file before I add these keybinding.

jamie.


pgp70maidsntK.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] How to improve the mail handling workflow?

2010-11-14 Thread Matthieu Lemerre
On Sun, 14 Nov 2010 14:13:26 -0500, Jameson Rollins 
jroll...@finestructure.net wrote:
 On Sun, 14 Nov 2010 18:01:48 +0100, Matthieu Lemerre ra...@free.fr wrote:
  Now when you consistently label all your mails, you just don't want to
  have unclassified mails. That is what we meant by mail you can't find.
 
 It sounds like this would just as easily be accomplished with a way to
 search for all messages that don't have any tags.  

I think this would be something complementary and indeed very
useful. But the solution I have proposed is not only to ensure that
there are no unclassified mails, but also to help you classify your
mails if it is not done automatically.

I think there are a lot of people used to classify their emails, so I
think this behaviour could be an option in notmuch (even if not set by
default).

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


Re: [PATCH] How to improve the mail handling workflow?

2010-11-14 Thread Sebastian Spaeth
On Sun, 14 Nov 2010 22:07:03 +0100, Sebastian Spaeth wrote:
 This only works if you've already loaded notmuch, or you get error
 messages about notmuch-search-mode-map not being known. How do you deal
 with that or does it simply work for you?

DOH, nothing that a (require 'notmuch) couldn't fix. Thank you for that
snippet. It should be on the emacstips wiki page.

Sebastian


pgp1iTK1QOiw6.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] How to improve the mail handling workflow?

2010-11-14 Thread Sebastian Spaeth
On Fri, 12 Nov 2010 17:35:22 +0100, Matthieu Lemerre ra...@free.fr wrote:
 But the space bar removes the unread tag, so I do not see how it
 helps... By default, hitting the space bar throughout a thread would
 remove every tag from the thread, so you keep asking where was the mail
 in my inbox that I have read and I can't find anymore?

If you accidentally switch to the next thread, it's very easy to just
hit 'q' to get back to the initial search and go one message up to get
to the message you just left.

Sebastian


pgpwIyniIdKGT.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] How to improve the mail handling workflow?

2010-11-14 Thread Michael Hudson
On Fri, 12 Nov 2010 16:23:58 +0100, Matthieu Lemerre ra...@free.fr wrote:
  - Processing mails which do not have any automatically added tag is
boring, because I need to press several keys to archive them: + to
add a tag, and then a. If I forget about +, then my mail is
impossible to find.

I think what I want here is undo last tagging operation.  You need a
way for 'notmuch tag' to report what it did for this to be possible
though...

I'd also like a way of binding keys to the operation of adding a
particular tag, removng the 'inbox' tag, move to next mail in search.
I've seen a few people talk about this, surely someone will get around
to implementing it eventually!

Cheers,
mwh
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] How to improve the mail handling workflow?

2010-11-14 Thread Matthieu Lemerre
On Sun, 14 Nov 2010 22:34:38 +0100, Sebastian Spaeth sebast...@sspaeth.de 
wrote:
 On Fri, 12 Nov 2010 17:35:22 +0100, Matthieu Lemerre ra...@free.fr wrote:
  But the space bar removes the unread tag, so I do not see how it
  helps... By default, hitting the space bar throughout a thread would
  remove every tag from the thread, so you keep asking where was the mail
  in my inbox that I have read and I can't find anymore?
 
 If you accidentally switch to the next thread, it's very easy to just
 hit 'q' to get back to the initial search and go one message up to get
 to the message you just left.

I'd rather not remove the inbox tag from the thread in the first place.

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


Re: [PATCH] How to improve the mail handling workflow?

2010-11-13 Thread Cédric Cabessa
On Friday 12 November 2010 16:23:58 Matthieu Lemerre wrote:
  - Processing mails which do not have any automatically added tag is
boring, because I need to press several keys to archive them: + to
add a tag, and then a. If I forget about +, then my mail is
impossible to find.

I feel the same !
I do not know if notmuch/xapian can find mail with 0 tag or only attachment 
tag for exemple ?

The dirty solution I found is to create a virtual folder called orphan that 
contains none of all the other tags (ie not tag:foo and not tag:bar and not 
...)


I do not considere attachment as a real tag. I should now do the same for 
replied and all other new stuff


(require 'cl)

(defun tagreduce(a b)
  (if (or (string= a attachment) (string= b attachment))
  (if (string= a attachment)
b
a
)
(if (not (string-match and not a))
(concat not tag: a  and not tag: b)
  (concat a  and not tag: b)
  )
)
  )


(defun orphan() 
  (reduce 'tagreduce (split-string (with-output-to-string
 (with-current-buffer standard-output
   (apply 'call-process notmuch-command nil 
t nil 
search-tags nil))) \n+ t))
)

(setq pnotmuch-orphans (append '(orphan) (orphan)))
(setq notmuch-folders (append notmuch-folders (list pnotmuch-orphans)))



(excuse my lisp ...)

-- 
Cédric
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] How to improve the mail handling workflow?

2010-11-13 Thread Jameson Rollins
On Sat, 13 Nov 2010 17:43:38 +0100, Cédric Cabessa c...@ryick.net wrote:
 On Friday 12 November 2010 16:23:58 Matthieu Lemerre wrote:
   - Processing mails which do not have any automatically added tag is
 boring, because I need to press several keys to archive them: + to
 add a tag, and then a. If I forget about +, then my mail is
 impossible to find.
 
 I feel the same !
 I do not know if notmuch/xapian can find mail with 0 tag or only attachment 
 tag for exemple ?

I think you guys may have a misunderstanding about how notmuch indexes
mail.  Notmuch indexes multiple headers (To, From, Subject, Date) and
the *entire* body of the message.  That's kind of the whole point.  In
other words, messages don't have to have tags in order to be found.  For
instance, the following two search return just this message (for me):

to:notmuch subject:how improve workflow
from:c...@ryick.net dirty solution

And none of the messages in this thread are tagged for me at all (except
the first in the thread which has a replied tag).

So don't worry if not all of your messages are tagged.  They can all
still be found.  That's the beauty of fast search.

jamie.


pgpadIQDCK8Il.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] How to improve the mail handling workflow?

2010-11-12 Thread Darren McGuicken
On Fri, 12 Nov 2010 16:23:58 +0100, Matthieu Lemerre ra...@free.fr wrote:
 Here is first a patch that copes with this last point. Whenever you
 want to archive a thread, it finds whether you forgot to add a custom
 user tag to a message, and if so asks you for a tag to add before
 archiving. That way, I no longer have messages without any tags.

Hmm, this would be very irritating in my own workflow in which I really
only use a small number of tags on a fraction of my total mail archive
to differentiate mail type or content which can't otherwise be
determined from the indexed plain text of the message (I don't like to
add a 'notmuch' tag to mail from the list for instance since a saved
search for mail sent to the list address does exactly the same thing).

I agree that the spacebar does too much if you're just using a search on
the inbox tag and want something to stay visible even when you've
quickly spacebar'd through a thread and archived it, but in my case that
was easily solved by creating a new default saved search called 'todo'
which collects unread, manually tagged 'todo' and mail matching a number
of other criteria into one place.  When something has been followed-up
on, I remove the tag.

Colouring threads using notmuch-search-line-faces is also very useful in
that one-stop 'todo' view.

Would any of that work for you?  Why are plain text or header searches
not able to find the mail you're looking for?


pgpRYx2EOnGZ5.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] How to improve the mail handling workflow?

2010-11-12 Thread Matthieu Lemerre

On Fri, 12 Nov 2010 15:39:37 +, Darren McGuicken 
mailing-notm...@fernseed.info wrote:
 On Fri, 12 Nov 2010 16:23:58 +0100, Matthieu Lemerre ra...@free.fr wrote:
  Here is first a patch that copes with this last point. Whenever you
  want to archive a thread, it finds whether you forgot to add a custom
  user tag to a message, and if so asks you for a tag to add before
  archiving. That way, I no longer have messages without any tags.
 
 Hmm, this would be very irritating in my own workflow in which I really
 only use a small number of tags on a fraction of my total mail archive
 to differentiate mail type or content which can't otherwise be
 determined from the indexed plain text of the message (I don't like to
 add a 'notmuch' tag to mail from the list for instance since a saved
 search for mail sent to the list address does exactly the same thing).

I prefer to add tags, for the following reasons:

 - If I want to search through a mailing list, I don't have to remember
   its address. Saved searchs solve the problem only partly, because I
   am not able to make complex queries involving several saved
   searches. This could be solved only by making notmuch aware of saved
   searches.

 - I have some collection of emails that belong to a topic, even if the
   topic does not appear in it. For instance, if I receive mails about a
   project foo, it can happen that foo is not mentionned in it.

 - I think that adding more informations to mail help find it, even if
   it fills my screen with tag names. Basically, I use tags for several
   different things:
 - to label information 
 - to indicate actions that have to be done (like todo, waiting, done, etc)
 - the other are mail-related tags (inbox, attachment, replied etc).

 I agree that the spacebar does too much if you're just using a search on
 the inbox tag and want something to stay visible even when you've
 quickly spacebar'd through a thread and archived it, but in my case that
 was easily solved by creating a new default saved search called 'todo'
 which collects unread, manually tagged 'todo' and mail matching a number
 of other criteria into one place.  When something has been followed-up
 on, I remove the tag.

But the space bar removes the unread tag, so I do not see how it
helps... By default, hitting the space bar throughout a thread would
remove every tag from the thread, so you keep asking where was the mail
in my inbox that I have read and I can't find anymore?
 
 Colouring threads using notmuch-search-line-faces is also very useful in
 that one-stop 'todo' view.
 
 Would any of that work for you?  Why are plain text or header searches
 not able to find the mail you're looking for?

Of course, I can change my patch so that its behaviour can be customized
using a variable.

Thanks,
Matthieu
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] How to improve the mail handling workflow?

2010-11-12 Thread Darren McGuicken
On Fri, 12 Nov 2010 17:35:22 +0100, Matthieu Lemerre ra...@free.fr wrote:
 I prefer to add tags, for the following reasons:

It sounds like we do much the same things with our mail except that your
approach is quite disciplined and mine quite lazy :-)

  - If I want to search through a mailing list, I don't have to
  remember its address. Saved searchs solve the problem only partly,
  because I am not able to make complex queries involving several saved
  searches. This could be solved only by making notmuch aware of saved
  searches.

[...]

 By default, hitting the space bar throughout a thread would remove
 every tag from the thread, so you keep asking where was the mail in
 my inbox that I have read and I can't find anymore?

As it's so quick, I tend to search my entire archive, even for new
messages, through progressive stages of filtering (which is really all
that a saved search is) starting off knowing only vaguely what it is
that I'm looking for.

For instance 'there was something on the notmuch list about printing
format issues recently' would be 's to:notmuch' 'f print' 'f format' etc
until I see what I'm looking for (or something similar) in the results.
That particular set of steps gives me a buffer with 24 threads in it,
the second of which is what I was looking for.  I tend not to even
bother with subject header based searches unless I know for sure that
what I'm looking for had an unusual subject.

It sounds like a lot of work when I write it out long-form, but it's
incredibly intuitive and so far always gets me what I need.

I can see your approach has its own merits though.


pgpaQUUaAIhew.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] How to improve the mail handling workflow?

2010-11-12 Thread David Edmondson
On Fri, 12 Nov 2010 16:23:58 +0100, Matthieu Lemerre ra...@free.fr wrote:
  - Processing mails which do not have any automatically added tag is
boring, because I need to press several keys to archive them: + to
add a tag, and then a. If I forget about +, then my mail is
impossible to find.

I don't understand this at all. You can find messages by searching for
anything about them (sender, subject, body). In what way is it
'impossible'?

Using tags to group things is great, I agree, but coercing me into
adding tags that I don't really need seems strange.

dme.
-- 
David Edmondson, http://dme.org
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] How to improve the mail handling workflow?

2010-11-12 Thread Matthieu Lemerre

On Fri, 12 Nov 2010 17:05:23 +, David Edmondson d...@dme.org wrote:
 On Fri, 12 Nov 2010 16:23:58 +0100, Matthieu Lemerre ra...@free.fr wrote:
   - Processing mails which do not have any automatically added tag is
 boring, because I need to press several keys to archive them: + to
 add a tag, and then a. If I forget about +, then my mail is
 impossible to find.
 
 I don't understand this at all. You can find messages by searching for
 anything about them (sender, subject, body). In what way is it
 'impossible'?

Impossible was a bit strong. But if for instance I hit space in a
inboxed mail in a thread with one mail, without taking too much time to
study it, then I will know that I forgot to process one mail without
knowing which one it is. I used to find such mails by searching for
mails without any tags, but this was cumbersome. My present patch is a
better attempt to fix this.
 
 Using tags to group things is great, I agree, but coercing me into
 adding tags that I don't really need seems strange.

It is just a way to ensure that all your mails are properly filed, and
file them quickly.

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


Re: [PATCH] How to improve the mail handling workflow?

2010-11-12 Thread David Edmondson
On Fri, 12 Nov 2010 18:48:12 +0100, Matthieu Lemerre ra...@free.fr wrote:
 It is just a way to ensure that all your mails are properly filed, and
 file them quickly.

We should just add a hook that you can use, then.

dme.
-- 
David Edmondson, http://dme.org
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] How to improve the mail handling workflow?

2010-11-12 Thread Michal Sojka
On Fri, 12 Nov 2010, Darren McGuicken wrote:
 On Fri, 12 Nov 2010 16:23:58 +0100, Matthieu Lemerre ra...@free.fr wrote:
  Here is first a patch that copes with this last point. Whenever you
  want to archive a thread, it finds whether you forgot to add a custom
  user tag to a message, and if so asks you for a tag to add before
  archiving. That way, I no longer have messages without any tags.
 
 Hmm, this would be very irritating in my own workflow in which I really
 only use a small number of tags on a fraction of my total mail archive
 to differentiate mail type or content which can't otherwise be
 determined from the indexed plain text of the message (I don't like to
 add a 'notmuch' tag to mail from the list for instance since a saved
 search for mail sent to the list address does exactly the same thing).

I agree with you in that in many cases tags can be replaced by saved
searches. Last time I did it, i.e. used saved searches to distinguish
messages from different mailing lists, the result was that it took very
long time (something like 5 seconds) to show notmuch-hello screen. There
is a bug in notmuch hello, as I described in
id:87wrtz3pw2@steelpick.2x.cz.

Additionally, I compared the speed of command line searches for tags and
for the whole email addresses and even without the bug mentioned above,
the search for to: is usually slower than the search for tag:.

And finally, there are some mailing lists, which changed their address
in the past or have multiple aliases and in this case you always has to
use a more complex search to match all messages to that mailing list and
these searches are even more slow than tag searches.

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