[notmuch] auto-tagging replied messages

2010-04-24 Thread Carl Worth

-- 
carl.d.worth at intel.com
On Sat, 24 Apr 2010 09:56:04 -0400, Jesse Rosenthal  
wrote:
> I'd love to put this into shape to become part of notmuch proper. 

Great!

> My question, for this and other things I've worked on, is where code
> that targets message-mode should go. In notmuch-mua.el? Or a new
> notmuch-message-utils.el? Or just a catch-all notmuch-utils.el? Once I
> know where it would make the most sense to group these, I'll submit a
> patch.

You can call it notmuch-message.el if you'd like.

I'm never a fan of something generic like -utils. Things like that seem
to grow without bounds.

> But just to clarify: you don't mind if removal is a customizable user
> option, right?

I don't mind at all. I was just happy to realize that we wouldn't have
to do any tag removal to make the feature useful out-of-the-box.

-Carl
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: 



[notmuch] auto-tagging replied messages

2010-04-24 Thread Jesse Rosenthal
On Sat, 24 Apr 2010 05:38:36 -0700, Carl Worth  wrote:
> So here's my vote for someone cleaning this up into a patch that could
> be applied directly to notmuch rather than just being a snippet of code
> to shove into .emacs.

I'd love to put this into shape to become part of notmuch proper. 

My question, for this and other things I've worked on, is where code
that targets message-mode should go. In notmuch-mua.el? Or a new
notmuch-message-utils.el? Or just a catch-all notmuch-utils.el? Once I
know where it would make the most sense to group these, I'll submit a
patch.

> Supporting the removal of a tag as well is clever, but I wouldn't
> suggest doing that by default (the patch doesn't anyway). And instead,
> people could do things like searches for "tag:reply-required and not
> tag:replied".

But just to clarify: you don't mind if removal is a customizable user
option, right?

Best,
Jesse


[notmuch] auto-tagging replied messages

2010-04-24 Thread Carl Worth
On Thu, 22 Apr 2010 12:35:16 +0200, "Sebastian Spaeth"  wrote:
> On 2010-03-05, Jesse Rosenthal wrote:
> > One element of traditional clients that I've missed in notmuch is the
> > ability to easily see which messages have been replied to. A look at the
> > thread structure will often make that clear, but for both searching and
> > syncing, an "answered" tag would be nice.
> 
> This patch has been working great so far and is very useful. Can I
> persuade someone to take this into the notmuch code and have a defcustom
> as to which tag a reply should get (or disable if nil)?

I'd like to see the in as well.

Since we name the action of responding to a message "reply" in the
documentation already, my vote for a default tag to add would be
"replied".

Supporting the removal of a tag as well is clever, but I wouldn't
suggest doing that by default (the patch doesn't anyway). And instead,
people could do things like searches for "tag:reply-required and not
tag:replied".

So here's my vote for someone cleaning this up into a patch that could
be applied directly to notmuch rather than just being a snippet of code
to shove into .emacs.

-Carl


-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: 



Re: [notmuch] auto-tagging replied messages

2010-04-24 Thread Carl Worth
On Thu, 22 Apr 2010 12:35:16 +0200, Sebastian Spaeth sebast...@sspaeth.de 
wrote:
 On 2010-03-05, Jesse Rosenthal wrote:
  One element of traditional clients that I've missed in notmuch is the
  ability to easily see which messages have been replied to. A look at the
  thread structure will often make that clear, but for both searching and
  syncing, an answered tag would be nice.
 
 This patch has been working great so far and is very useful. Can I
 persuade someone to take this into the notmuch code and have a defcustom
 as to which tag a reply should get (or disable if nil)?

I'd like to see the in as well.

Since we name the action of responding to a message reply in the
documentation already, my vote for a default tag to add would be
replied.

Supporting the removal of a tag as well is clever, but I wouldn't
suggest doing that by default (the patch doesn't anyway). And instead,
people could do things like searches for tag:reply-required and not
tag:replied.

So here's my vote for someone cleaning this up into a patch that could
be applied directly to notmuch rather than just being a snippet of code
to shove into .emacs.

-Carl




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


Re: [notmuch] auto-tagging replied messages

2010-04-24 Thread Jesse Rosenthal
On Sat, 24 Apr 2010 05:38:36 -0700, Carl Worth cwo...@cworth.org wrote:
 So here's my vote for someone cleaning this up into a patch that could
 be applied directly to notmuch rather than just being a snippet of code
 to shove into .emacs.

I'd love to put this into shape to become part of notmuch proper. 

My question, for this and other things I've worked on, is where code
that targets message-mode should go. In notmuch-mua.el? Or a new
notmuch-message-utils.el? Or just a catch-all notmuch-utils.el? Once I
know where it would make the most sense to group these, I'll submit a
patch.

 Supporting the removal of a tag as well is clever, but I wouldn't
 suggest doing that by default (the patch doesn't anyway). And instead,
 people could do things like searches for tag:reply-required and not
 tag:replied.

But just to clarify: you don't mind if removal is a customizable user
option, right?

Best,
Jesse
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [notmuch] auto-tagging replied messages

2010-04-24 Thread Carl Worth

-- 
carl.d.wo...@intel.com
On Sat, 24 Apr 2010 09:56:04 -0400, Jesse Rosenthal jrosent...@jhu.edu wrote:
 I'd love to put this into shape to become part of notmuch proper. 

Great!

 My question, for this and other things I've worked on, is where code
 that targets message-mode should go. In notmuch-mua.el? Or a new
 notmuch-message-utils.el? Or just a catch-all notmuch-utils.el? Once I
 know where it would make the most sense to group these, I'll submit a
 patch.

You can call it notmuch-message.el if you'd like.

I'm never a fan of something generic like -utils. Things like that seem
to grow without bounds.

 But just to clarify: you don't mind if removal is a customizable user
 option, right?

I don't mind at all. I was just happy to realize that we wouldn't have
to do any tag removal to make the feature useful out-of-the-box.

-Carl


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


[notmuch] auto-tagging replied messages

2010-04-22 Thread Sebastian Spaeth
On 2010-03-05, Jesse Rosenthal wrote:
> One element of traditional clients that I've missed in notmuch is the
> ability to easily see which messages have been replied to. A look at the
> thread structure will often make that clear, but for both searching and
> syncing, an "answered" tag would be nice.

This patch has been working great so far and is very useful. Can I
persuade someone to take this into the notmuch code and have a defcustom
as to which tag a reply should get (or disable if nil)?

Sebastian


Re: [notmuch] auto-tagging replied messages

2010-04-22 Thread Sebastian Spaeth
On 2010-03-05, Jesse Rosenthal wrote:
 One element of traditional clients that I've missed in notmuch is the
 ability to easily see which messages have been replied to. A look at the
 thread structure will often make that clear, but for both searching and
 syncing, an answered tag would be nice.

This patch has been working great so far and is very useful. Can I
persuade someone to take this into the notmuch code and have a defcustom
as to which tag a reply should get (or disable if nil)?

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


[notmuch] auto-tagging replied messages

2010-03-05 Thread Sebastian Spaeth
On 2010-03-05, Sebastian Spaeth wrote:
> By the way, the reason that I didn't submit this as a patch to
> notmuch.el is that I'm not sure how we want to deal with things that are
> actually more about message-mode, and could possibly affect other
> programs using message-mode (gnus).

This is really neat functionality, and I have no problems with hooking
this into message mode directly (or even including it into notmuch). I
think it is reasonable to tag notmuch messages as replied (even when
doing from gnus) when I have loaded (notmuch.el).

Testing 'replied' tag with this message...

> There are a couple of ways to deal
> with this (e.g., notmuch minor-mode in message-mode, custom headers) but
> my sense is that we should keep notmuch.el from being too imperious at
> the moment.

;-). I agree.

Sebastian


[notmuch] auto-tagging replied messages

2010-03-05 Thread Jameson Rollins
On Fri, 05 Mar 2010 09:39:14 -0500, Jesse Rosenthal  
wrote:
> One element of traditional clients that I've missed in notmuch is the
> ability to easily see which messages have been replied to. A look at the
> thread structure will often make that clear, but for both searching and
> syncing, an "answered" tag would be nice.
> 
> To solve this, I have added the following to my .emacs, and I wanted to
> share it in case others might find it useful. You can add an arbitrary
> number of tags to the list "notmuch-answered-tags" and it will apply
> them (or remove them) when the reply is sent. So you could use it to
> automatically mark and email "answered" and remove it from the inbox, or
> remove a "todo" or "reply_later" tag.

Hey, Jesse.  This does look neat.  Don't forget to add it to the "emacs
tips" section of the wiki as well.  I've also got some stuff that I'll
be adding there when I ever get a chance.

jamie.
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: 



[notmuch] auto-tagging replied messages

2010-03-05 Thread Jesse Rosenthal
Dear All,

One element of traditional clients that I've missed in notmuch is the
ability to easily see which messages have been replied to. A look at the
thread structure will often make that clear, but for both searching and
syncing, an "answered" tag would be nice.

To solve this, I have added the following to my .emacs, and I wanted to
share it in case others might find it useful. You can add an arbitrary
number of tags to the list "notmuch-answered-tags" and it will apply
them (or remove them) when the reply is sent. So you could use it to
automatically mark and email "answered" and remove it from the inbox, or
remove a "todo" or "reply_later" tag.

This relies on the "In-Reply-To" header, so if that's not there, it
won't mark the original message. But then, if that's not there,
threading won't work either, so you'll have bigger problems in notmuch.

Thanks to David, who took a look and offered some suggestions on IRC.

;

;; A set of tags to be added or, if prefaced with a `-', removed
;; e.g. (setq notmuch-answered-tags '("replied" "-todo" "-inbox"))
(setq notmuch-answered-tags '("answered"))

(defun jkr/notmuch-mark-answered ()
  ;; get the in-reply-to header and parse it for the message id. 
  (let ((rep (mail-header-parse-addresses (message-field-value "In-Reply-To"
(when (and notmuch-answered-tags rep)
  ;; add a "+" to any tag that is doesn't already begin with a "+"
  ;; or "-"
  (let ((tags (mapcar '(lambda (str)
 (if (not (string-match "^[+-]" str))
 (concat "+" str)
   str))
  notmuch-answered-tags)))
(apply 'notmuch-call-notmuch-process "tag"
   (append tags (list (concat "id:" (car (car rep nil))

(add-hook 'message-sent-hook 'jkr/notmuch-mark-answered)

;

By the way, the reason that I didn't submit this as a patch to
notmuch.el is that I'm not sure how we want to deal with things that are
actually more about message-mode, and could possibly affect other
programs using message-mode (gnus). There are a couple of ways to deal
with this (e.g., notmuch minor-mode in message-mode, custom headers) but
my sense is that we should keep notmuch.el from being too imperious at
the moment.

Best,
Jesse





[notmuch] auto-tagging replied messages

2010-03-05 Thread Jesse Rosenthal
Dear All,

One element of traditional clients that I've missed in notmuch is the
ability to easily see which messages have been replied to. A look at the
thread structure will often make that clear, but for both searching and
syncing, an answered tag would be nice.

To solve this, I have added the following to my .emacs, and I wanted to
share it in case others might find it useful. You can add an arbitrary
number of tags to the list notmuch-answered-tags and it will apply
them (or remove them) when the reply is sent. So you could use it to
automatically mark and email answered and remove it from the inbox, or
remove a todo or reply_later tag.

This relies on the In-Reply-To header, so if that's not there, it
won't mark the original message. But then, if that's not there,
threading won't work either, so you'll have bigger problems in notmuch.

Thanks to David, who took a look and offered some suggestions on IRC.

;

;; A set of tags to be added or, if prefaced with a `-', removed
;; e.g. (setq notmuch-answered-tags '(replied -todo -inbox))
(setq notmuch-answered-tags '(answered))

(defun jkr/notmuch-mark-answered ()
  ;; get the in-reply-to header and parse it for the message id. 
  (let ((rep (mail-header-parse-addresses (message-field-value In-Reply-To
(when (and notmuch-answered-tags rep)
  ;; add a + to any tag that is doesn't already begin with a +
  ;; or -
  (let ((tags (mapcar '(lambda (str)
 (if (not (string-match ^[+-] str))
 (concat + str)
   str))
  notmuch-answered-tags)))
(apply 'notmuch-call-notmuch-process tag
   (append tags (list (concat id: (car (car rep nil))

(add-hook 'message-sent-hook 'jkr/notmuch-mark-answered)

;

By the way, the reason that I didn't submit this as a patch to
notmuch.el is that I'm not sure how we want to deal with things that are
actually more about message-mode, and could possibly affect other
programs using message-mode (gnus). There are a couple of ways to deal
with this (e.g., notmuch minor-mode in message-mode, custom headers) but
my sense is that we should keep notmuch.el from being too imperious at
the moment.

Best,
Jesse



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


Re: [notmuch] auto-tagging replied messages

2010-03-05 Thread Jameson Rollins
On Fri, 05 Mar 2010 09:39:14 -0500, Jesse Rosenthal jrosent...@jhu.edu wrote:
 One element of traditional clients that I've missed in notmuch is the
 ability to easily see which messages have been replied to. A look at the
 thread structure will often make that clear, but for both searching and
 syncing, an answered tag would be nice.
 
 To solve this, I have added the following to my .emacs, and I wanted to
 share it in case others might find it useful. You can add an arbitrary
 number of tags to the list notmuch-answered-tags and it will apply
 them (or remove them) when the reply is sent. So you could use it to
 automatically mark and email answered and remove it from the inbox, or
 remove a todo or reply_later tag.

Hey, Jesse.  This does look neat.  Don't forget to add it to the emacs
tips section of the wiki as well.  I've also got some stuff that I'll
be adding there when I ever get a chance.

jamie.


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