unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] How to improve the mail handling workflow?
@ 2010-11-12 15:23 Matthieu Lemerre
  2010-11-12 15:33 ` Jameson Rollins
                   ` (4 more replies)
  0 siblings, 5 replies; 24+ messages in thread
From: Matthieu Lemerre @ 2010-11-12 15:23 UTC (permalink / raw)
  To: notmuch

[-- Attachment #1: Type: text/plain, Size: 2114 bytes --]


Hi,

I think that there are several irritating nitpicks when using notmuch in
a typical mail workflow.

I don't know how other people process their email. I for myself use the
following method:

1. The script I use to fetch new mails tries to add tags if it can. For
   instance, all new mails from the notmuch mailing lists appears with
   tags "(inbox,unread,notmuch)".

2. When processing mails, I manually add some tag to the mails for which
   no tags were added automatically. Then I archive the mail (remove its
   inbox tag).

3. Sometimes I keep mails in my inbox, for instance if I am expecting a
   specific mail and do not want to take the time to process the others.

The emacs interface to notmuch gets in my way in at least several
manners:

 - I often find myself hitting the spacebar too much, which ends up with
   some of my new messages being removed from all of their tags, which
   make them very difficult to find. I don't think the spacebar should
   remove the inbox tag at all. It should only change the unread tag.

 - It does not provide a command for deleting mails. We were several
   people who provided patches to add a 'd' keybinding to support
   deletion. I provided a complex patch for that (that added "and not
   tag:deleted" to all requests", but I now think that just adding a
   "deleted" tag and removing the "inbox" tag would be sufficient).

 - 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.

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.

I probably will send patches to handle the other bullet points to, but
first I would be happy to hear your comments about this, or learn about
how you process your mail using the current interface.

Thanks,
Matthieu Lemerre


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: out.patch --]
[-- Type: text/x-diff, Size: 2244 bytes --]

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index d8773e6..57ff72e 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1054,11 +1054,35 @@ argument, hide all of the messages."
   (interactive)
   (backward-button 1))
 
+(defun notmuch-is-user-tag (tag)
+  ;; Returns true if tag is not one of 
+  ;; inbox, deleted, replied, draft, 
+  (not (member tag '("inbox" "replied" "draft" "deleted" 
+		    "attachment" "unread"))))
+
 (defun notmuch-show-archive-thread-internal (show-next)
   ;; Remove the tag from the current set of messages.
   (goto-char (point-min))
-  (loop do (notmuch-show-remove-tag "inbox")
-	until (not (notmuch-show-goto-message-next)))
+  (let ((has-empty-tags))
+    ;; 1st pass: try to see if adding a tag is necessary.
+    (loop do (let ((user-tags (remove-if-not #'notmuch-is-user-tag 
+					     (notmuch-show-get-tags))))
+	       (setq has-empty-tags 
+		     (or has-empty-tags (eq user-tags nil))))
+	  until (not (notmuch-show-goto-message-next)))
+    ;; Only ask for a tag to add if has-empty-tags is non-nil. Use
+    ;; tags-to-apply to propose a default value.
+    (let ((tags-to-add '()))
+      (if has-empty-tags
+	  (setq tags-to-add (list (notmuch-select-tag-with-completion 
+				   "Some messages in the thread have no user tags. Add: "))))
+      ;; 2nd pass: tag all the messages with the user-selected tag,
+      ;; and remove the "inbox" tag
+      (goto-char (point-min))
+      (loop do (progn 
+		 (apply #'notmuch-show-add-tag tags-to-add)
+		 (notmuch-show-remove-tag "inbox"))
+	  until (not (notmuch-show-goto-message-next)))))
   ;; Move to the next item in the search results, if any.
   (let ((parent-buffer notmuch-show-parent-buffer))
     (notmuch-kill-this-buffer)
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 5933747..eeff18c 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -560,7 +560,9 @@ thread or threads in the current region."
 
 This function advances the next thread when finished."
   (interactive)
-  (notmuch-search-remove-tag-thread "inbox")
+  (save-excursion
+    (notmuch-search-show-thread)
+    (notmuch-show-archive-thread-internal nil))
   (forward-line))
 
 (defun notmuch-search-process-sentinel (proc msg)

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* Re: [PATCH] How to improve the mail handling workflow?
  2010-11-12 15:23 [PATCH] How to improve the mail handling workflow? Matthieu Lemerre
@ 2010-11-12 15:33 ` Jameson Rollins
  2010-11-12 16:39   ` Matthieu Lemerre
  2010-11-14 21:07   ` Sebastian Spaeth
  2010-11-12 15:39 ` Darren McGuicken
                   ` (3 subsequent siblings)
  4 siblings, 2 replies; 24+ messages in thread
From: Jameson Rollins @ 2010-11-12 15:33 UTC (permalink / raw)
  To: Matthieu Lemerre, notmuch

[-- Attachment #1: Type: text/plain, Size: 3113 bytes --]

On Fri, 12 Nov 2010 16:23:58 +0100, Matthieu Lemerre <racin@free.fr> wrote:
> The emacs interface to notmuch gets in my way in at least several
> manners:

Hi, Matthieu.  Here are some of the things I've done to deal with
similar issues:

>  - I often find myself hitting the spacebar too much, which ends up with
>    some of my new messages being removed from all of their tags, which
>    make them very difficult to find. I don't think the spacebar should
>    remove the inbox tag at all. It should only change the unread tag.

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.

>  - It does not provide a command for deleting mails. We were several
>    people who provided patches to add a 'd' keybinding to support
>    deletion. I provided a complex patch for that (that added "and not
>    tag:deleted" to all requests", but I now think that just adding a
>    "deleted" tag and removing the "inbox" tag would be sufficient).

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)))

(define-key notmuch-show-mode-map "d"
  (lambda ()
    "delete current message and advance"
    (interactive)
    (notmuch-show-add-tag "deleted")
    (notmuch-show-next-open-message-or-pop)))

(define-key notmuch-search-mode-map "u"
  (lambda ()
    "undelete thread"
    (interactive)
    (notmuch-search-remove-tag "deleted")))

(define-key notmuch-show-mode-map "u"
  (lambda ()
    "undelete current message"
    (interactive)
    (notmuch-show-remove-tag "deleted")))

I do *not* think that adding the "deleted" tag should remove the inbox
tag.  If you want to view your inbox without seeing the deleted
messages, then just use the search "tag:inbox and not tag:deleted".

>  - 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.

Again, I achieve archiving with some simple custom functions:

(define-key notmuch-search-mode-map "a"
  (lambda ()
    "archive thread and advance"
    (interactive)
    (notmuch-search-remove-tag "inbox")
    (notmuch-search-remove-tag "unread")
    (forward-line)))

(define-key notmuch-show-mode-map "a"
  (lambda ()
    "archive current message and advance"
    (interactive)
    (notmuch-show-remove-tag "inbox")
    (notmuch-show-next-open-message-or-pop)))

(define-key notmuch-show-mode-map "i"
  (lambda ()
    "add current message to inbox"
    (interactive)
    (notmuch-show-add-tag "inbox")))

jamie.

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] How to improve the mail handling workflow?
  2010-11-12 15:23 [PATCH] How to improve the mail handling workflow? Matthieu Lemerre
  2010-11-12 15:33 ` Jameson Rollins
@ 2010-11-12 15:39 ` Darren McGuicken
  2010-11-12 16:35   ` Matthieu Lemerre
  2010-11-13  6:05   ` Michal Sojka
  2010-11-12 17:05 ` David Edmondson
                   ` (2 subsequent siblings)
  4 siblings, 2 replies; 24+ messages in thread
From: Darren McGuicken @ 2010-11-12 15:39 UTC (permalink / raw)
  To: Matthieu Lemerre, notmuch

[-- Attachment #1: Type: text/plain, Size: 1442 bytes --]

On Fri, 12 Nov 2010 16:23:58 +0100, Matthieu Lemerre <racin@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?

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] How to improve the mail handling workflow?
  2010-11-12 15:39 ` Darren McGuicken
@ 2010-11-12 16:35   ` Matthieu Lemerre
  2010-11-12 16:58     ` Darren McGuicken
  2010-11-14 21:34     ` Sebastian Spaeth
  2010-11-13  6:05   ` Michal Sojka
  1 sibling, 2 replies; 24+ messages in thread
From: Matthieu Lemerre @ 2010-11-12 16:35 UTC (permalink / raw)
  To: Darren McGuicken, notmuch


On Fri, 12 Nov 2010 15:39:37 +0000, Darren McGuicken <mailing-notmuch@fernseed.info> wrote:
> On Fri, 12 Nov 2010 16:23:58 +0100, Matthieu Lemerre <racin@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

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] How to improve the mail handling workflow?
  2010-11-12 15:33 ` Jameson Rollins
@ 2010-11-12 16:39   ` Matthieu Lemerre
  2010-11-14 21:07   ` Sebastian Spaeth
  1 sibling, 0 replies; 24+ messages in thread
From: Matthieu Lemerre @ 2010-11-12 16:39 UTC (permalink / raw)
  To: Jameson Rollins, notmuch


Hi, Jamie.

> 
> >  - I often find myself hitting the spacebar too much, which ends up with
> >    some of my new messages being removed from all of their tags, which
> >    make them very difficult to find. I don't think the spacebar should
> >    remove the inbox tag at all. It should only change the unread tag.
> 
> 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.

Great! Then I'll be waiting for your patch.

> >  - It does not provide a command for deleting mails. We were several
> >    people who provided patches to add a 'd' keybinding to support
> >    deletion. I provided a complex patch for that (that added "and not
> >    tag:deleted" to all requests", but I now think that just adding a
> >    "deleted" tag and removing the "inbox" tag would be sufficient).
> 

[...]


> I do *not* think that adding the "deleted" tag should remove the inbox
> tag.  If you want to view your inbox without seeing the deleted
> messages, then just use the search "tag:inbox and not tag:deleted".

Good idea, yes.

> 
> >  - 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.
> 
> Again, I achieve archiving with some simple custom functions:
> 

[...]

OK, but this does not solve the problem of forgetting to put a tag when
archiving a thread. Also my patch allows to put a tag without having to
press "+" (so you don't have to think about adding tags when you archive
your mail, you only have to press "a" and be reminded about it).

Matthieu

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] How to improve the mail handling workflow?
  2010-11-12 16:35   ` Matthieu Lemerre
@ 2010-11-12 16:58     ` Darren McGuicken
  2010-11-14 21:34     ` Sebastian Spaeth
  1 sibling, 0 replies; 24+ messages in thread
From: Darren McGuicken @ 2010-11-12 16:58 UTC (permalink / raw)
  To: Matthieu Lemerre, notmuch

[-- Attachment #1: Type: text/plain, Size: 1631 bytes --]

On Fri, 12 Nov 2010 17:35:22 +0100, Matthieu Lemerre <racin@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.

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] How to improve the mail handling workflow?
  2010-11-12 15:23 [PATCH] How to improve the mail handling workflow? Matthieu Lemerre
  2010-11-12 15:33 ` Jameson Rollins
  2010-11-12 15:39 ` Darren McGuicken
@ 2010-11-12 17:05 ` David Edmondson
  2010-11-12 17:48   ` Matthieu Lemerre
  2010-11-13 16:43 ` Cédric Cabessa
  2010-11-14 21:45 ` Michael Hudson
  4 siblings, 1 reply; 24+ messages in thread
From: David Edmondson @ 2010-11-12 17:05 UTC (permalink / raw)
  To: Matthieu Lemerre, notmuch

On Fri, 12 Nov 2010 16:23:58 +0100, Matthieu Lemerre <racin@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

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] How to improve the mail handling workflow?
  2010-11-12 17:48   ` Matthieu Lemerre
@ 2010-11-12 17:42     ` David Edmondson
  0 siblings, 0 replies; 24+ messages in thread
From: David Edmondson @ 2010-11-12 17:42 UTC (permalink / raw)
  To: Matthieu Lemerre, notmuch

On Fri, 12 Nov 2010 18:48:12 +0100, Matthieu Lemerre <racin@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

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] How to improve the mail handling workflow?
  2010-11-12 17:05 ` David Edmondson
@ 2010-11-12 17:48   ` Matthieu Lemerre
  2010-11-12 17:42     ` David Edmondson
  0 siblings, 1 reply; 24+ messages in thread
From: Matthieu Lemerre @ 2010-11-12 17:48 UTC (permalink / raw)
  To: David Edmondson, notmuch


On Fri, 12 Nov 2010 17:05:23 +0000, David Edmondson <dme@dme.org> wrote:
> On Fri, 12 Nov 2010 16:23:58 +0100, Matthieu Lemerre <racin@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

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] How to improve the mail handling workflow?
  2010-11-12 15:39 ` Darren McGuicken
  2010-11-12 16:35   ` Matthieu Lemerre
@ 2010-11-13  6:05   ` Michal Sojka
  2010-11-13 11:03     ` Darren McGuicken
  1 sibling, 1 reply; 24+ messages in thread
From: Michal Sojka @ 2010-11-13  6:05 UTC (permalink / raw)
  To: Darren McGuicken, Matthieu Lemerre, notmuch

On Fri, 12 Nov 2010, Darren McGuicken wrote:
> On Fri, 12 Nov 2010 16:23:58 +0100, Matthieu Lemerre <racin@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.fsf@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

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] How to improve the mail handling workflow?
  2010-11-13  6:05   ` Michal Sojka
@ 2010-11-13 11:03     ` Darren McGuicken
  2010-11-15  8:00       ` Michal Sojka
  0 siblings, 1 reply; 24+ messages in thread
From: Darren McGuicken @ 2010-11-13 11:03 UTC (permalink / raw)
  To: Michal Sojka, Matthieu Lemerre, notmuch

[-- Attachment #1: Type: text/plain, Size: 1530 bytes --]

On Sat, 13 Nov 2010 07:05:58 +0100, Michal Sojka <sojkam1@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.fsf@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.  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?

> 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

   real    0m21.074s
   user    0m4.740s    
   sys     0m1.916s

   $ time notmuch search to:notmuch > /dev/null

   real    0m20.280s
   user    0m4.600s
   sys     0m2.048s

   $ time notmuch search to:notmuch@notmuchmail.org > /dev/null

   real    0m21.790s
   user    0m5.044s
   sys     0m2.008s

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] How to improve the mail handling workflow?
  2010-11-12 15:23 [PATCH] How to improve the mail handling workflow? Matthieu Lemerre
                   ` (2 preceding siblings ...)
  2010-11-12 17:05 ` David Edmondson
@ 2010-11-13 16:43 ` Cédric Cabessa
  2010-11-13 18:41   ` Jameson Rollins
  2010-11-14 21:45 ` Michael Hudson
  4 siblings, 1 reply; 24+ messages in thread
From: Cédric Cabessa @ 2010-11-13 16:43 UTC (permalink / raw)
  To: notmuch

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

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] How to improve the mail handling workflow?
  2010-11-13 16:43 ` Cédric Cabessa
@ 2010-11-13 18:41   ` Jameson Rollins
  2010-11-14 17:01     ` Matthieu Lemerre
  0 siblings, 1 reply; 24+ messages in thread
From: Jameson Rollins @ 2010-11-13 18:41 UTC (permalink / raw)
  To: Cédric Cabessa, notmuch

[-- Attachment #1: Type: text/plain, Size: 1223 bytes --]

On Sat, 13 Nov 2010 17:43:38 +0100, Cédric Cabessa <ced@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:ced@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.

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] How to improve the mail handling workflow?
  2010-11-13 18:41   ` Jameson Rollins
@ 2010-11-14 17:01     ` Matthieu Lemerre
  2010-11-14 19:13       ` Jameson Rollins
  0 siblings, 1 reply; 24+ messages in thread
From: Matthieu Lemerre @ 2010-11-14 17:01 UTC (permalink / raw)
  To: Jameson Rollins, Cédric Cabessa, notmuch

> 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.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] How to improve the mail handling workflow?
  2010-11-14 17:01     ` Matthieu Lemerre
@ 2010-11-14 19:13       ` Jameson Rollins
  2010-11-14 21:43         ` Matthieu Lemerre
  0 siblings, 1 reply; 24+ messages in thread
From: Jameson Rollins @ 2010-11-14 19:13 UTC (permalink / raw)
  To: Matthieu Lemerre, Cédric Cabessa, notmuch

[-- Attachment #1: Type: text/plain, Size: 909 bytes --]

On Sun, 14 Nov 2010 18:01:48 +0100, Matthieu Lemerre <racin@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.

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] How to improve the mail handling workflow?
  2010-11-12 15:33 ` Jameson Rollins
  2010-11-12 16:39   ` Matthieu Lemerre
@ 2010-11-14 21:07   ` Sebastian Spaeth
  2010-11-14 21:19     ` Jameson Rollins
                       ` (2 more replies)
  1 sibling, 3 replies; 24+ messages in thread
From: Sebastian Spaeth @ 2010-11-14 21:07 UTC (permalink / raw)
  To: Jameson Rollins, Matthieu Lemerre, notmuch

[-- Attachment #1: Type: text/plain, Size: 1075 bytes --]

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

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] How to improve the mail handling workflow?
  2010-11-14 21:07   ` Sebastian Spaeth
@ 2010-11-14 21:19     ` Jameson Rollins
  2010-11-14 21:31     ` Sebastian Spaeth
  2010-11-15  8:28     ` David Edmondson
  2 siblings, 0 replies; 24+ messages in thread
From: Jameson Rollins @ 2010-11-14 21:19 UTC (permalink / raw)
  To: Sebastian Spaeth, Matthieu Lemerre, notmuch

[-- Attachment #1: Type: text/plain, Size: 357 bytes --]

On Sun, 14 Nov 2010 22:07:03 +0100, Sebastian Spaeth <Sebastian@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.

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] How to improve the mail handling workflow?
  2010-11-14 21:07   ` Sebastian Spaeth
  2010-11-14 21:19     ` Jameson Rollins
@ 2010-11-14 21:31     ` Sebastian Spaeth
  2010-11-15  8:28     ` David Edmondson
  2 siblings, 0 replies; 24+ messages in thread
From: Sebastian Spaeth @ 2010-11-14 21:31 UTC (permalink / raw)
  To: Jameson Rollins, Matthieu Lemerre, notmuch

[-- Attachment #1: Type: text/plain, Size: 381 bytes --]

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

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] How to improve the mail handling workflow?
  2010-11-12 16:35   ` Matthieu Lemerre
  2010-11-12 16:58     ` Darren McGuicken
@ 2010-11-14 21:34     ` Sebastian Spaeth
  2010-11-14 23:25       ` Matthieu Lemerre
  1 sibling, 1 reply; 24+ messages in thread
From: Sebastian Spaeth @ 2010-11-14 21:34 UTC (permalink / raw)
  To: Matthieu Lemerre, Darren McGuicken, notmuch

[-- Attachment #1: Type: text/plain, Size: 530 bytes --]

On Fri, 12 Nov 2010 17:35:22 +0100, Matthieu Lemerre <racin@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

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] How to improve the mail handling workflow?
  2010-11-14 19:13       ` Jameson Rollins
@ 2010-11-14 21:43         ` Matthieu Lemerre
  0 siblings, 0 replies; 24+ messages in thread
From: Matthieu Lemerre @ 2010-11-14 21:43 UTC (permalink / raw)
  To: Jameson Rollins, Cédric Cabessa, notmuch

On Sun, 14 Nov 2010 14:13:26 -0500, Jameson Rollins <jrollins@finestructure.net> wrote:
> On Sun, 14 Nov 2010 18:01:48 +0100, Matthieu Lemerre <racin@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

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] How to improve the mail handling workflow?
  2010-11-12 15:23 [PATCH] How to improve the mail handling workflow? Matthieu Lemerre
                   ` (3 preceding siblings ...)
  2010-11-13 16:43 ` Cédric Cabessa
@ 2010-11-14 21:45 ` Michael Hudson
  4 siblings, 0 replies; 24+ messages in thread
From: Michael Hudson @ 2010-11-14 21:45 UTC (permalink / raw)
  To: Matthieu Lemerre, notmuch

On Fri, 12 Nov 2010 16:23:58 +0100, Matthieu Lemerre <racin@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

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] How to improve the mail handling workflow?
  2010-11-14 21:34     ` Sebastian Spaeth
@ 2010-11-14 23:25       ` Matthieu Lemerre
  0 siblings, 0 replies; 24+ messages in thread
From: Matthieu Lemerre @ 2010-11-14 23:25 UTC (permalink / raw)
  To: Sebastian Spaeth, Darren McGuicken, notmuch

On Sun, 14 Nov 2010 22:34:38 +0100, Sebastian Spaeth <Sebastian@SSpaeth.de> wrote:
> On Fri, 12 Nov 2010 17:35:22 +0100, Matthieu Lemerre <racin@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

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] How to improve the mail handling workflow?
  2010-11-13 11:03     ` Darren McGuicken
@ 2010-11-15  8:00       ` Michal Sojka
  0 siblings, 0 replies; 24+ messages in thread
From: Michal Sojka @ 2010-11-15  8:00 UTC (permalink / raw)
  To: Darren McGuicken, Matthieu Lemerre, notmuch

On Sat, 13 Nov 2010, Darren McGuicken wrote:
> On Sat, 13 Nov 2010 07:05:58 +0100, Michal Sojka <sojkam1@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.fsf@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
> 
>    real    0m21.074s
>    user    0m4.740s    
>    sys     0m1.916s
> 
>    $ time notmuch search to:notmuch > /dev/null
> 
>    real    0m20.280s
>    user    0m4.600s
>    sys     0m2.048s
> 
>    $ time notmuch search to:notmuch@notmuchmail.org > /dev/null
> 
>    real    0m21.790s
>    user    0m5.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

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] How to improve the mail handling workflow?
  2010-11-14 21:07   ` Sebastian Spaeth
  2010-11-14 21:19     ` Jameson Rollins
  2010-11-14 21:31     ` Sebastian Spaeth
@ 2010-11-15  8:28     ` David Edmondson
  2 siblings, 0 replies; 24+ messages in thread
From: David Edmondson @ 2010-11-15  8:28 UTC (permalink / raw)
  To: Sebastian Spaeth, Jameson Rollins, Matthieu Lemerre, notmuch

On Sun, 14 Nov 2010 22:07:03 +0100, Sebastian Spaeth <Sebastian@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

^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2010-11-15  8:31 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-12 15:23 [PATCH] How to improve the mail handling workflow? Matthieu Lemerre
2010-11-12 15:33 ` Jameson Rollins
2010-11-12 16:39   ` Matthieu Lemerre
2010-11-14 21:07   ` Sebastian Spaeth
2010-11-14 21:19     ` Jameson Rollins
2010-11-14 21:31     ` Sebastian Spaeth
2010-11-15  8:28     ` David Edmondson
2010-11-12 15:39 ` Darren McGuicken
2010-11-12 16:35   ` Matthieu Lemerre
2010-11-12 16:58     ` Darren McGuicken
2010-11-14 21:34     ` Sebastian Spaeth
2010-11-14 23:25       ` Matthieu Lemerre
2010-11-13  6:05   ` Michal Sojka
2010-11-13 11:03     ` Darren McGuicken
2010-11-15  8:00       ` Michal Sojka
2010-11-12 17:05 ` David Edmondson
2010-11-12 17:48   ` Matthieu Lemerre
2010-11-12 17:42     ` David Edmondson
2010-11-13 16:43 ` Cédric Cabessa
2010-11-13 18:41   ` Jameson Rollins
2010-11-14 17:01     ` Matthieu Lemerre
2010-11-14 19:13       ` Jameson Rollins
2010-11-14 21:43         ` Matthieu Lemerre
2010-11-14 21:45 ` Michael Hudson

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).