[notmuch] [PATCH] add notmuch-show-delete keybinding 'd'

2010-02-25 Thread James Vasile
At Thu, 25 Feb 2010 11:53:14 +0100,
Sebastian Spaeth wrote:
> 
> On Wed, 24 Feb 2010 14:01:18 -0500, Jameson Rollins  finestructure.net> wrote:
> > > 2. It removes the "inbox" and "unread" tags while adding the tag to
> > >indicate deletion.
> > 
> > Hey, Carl.  Why is this last point important? [...]Why should it modify any 
> > other
> > tags?  A message/thread should be allowed to be both deleted and in the
> > inbox.
> 
> As long as deleted threads/messages show up in the default views, I
> don't want them to show up in my inbox or show up as unread. I agree
> that it might be possible to have "unread" yet "delete"d emails. But in
> reality, if I delete a message I don't want it to pop up in my inbox.
> 
> Feel free to apply patches however you want though, thanks to emacs,
> I'll be able to get my desired behavior nonetheless :).
> 
> > As for "unread", I think that should be handled by actually reading the
> > message, not by manually applying a state to it.
> 
> I agree, but deleting a message in my world view resets the unread tag
> (as in, I don't want to read it anymore).

This elisp might help.  I run these when deleting messages in search
or show modes.  Basically, this means I never see deleted threads
again.  I also use these to mark spam.

(defun notmuch-tags-strip-properties (tags)
  "return list of tags with emacs text properties removed

tags is a list of tags where each tag is a string with emacs text
properties
"
  (mapcar '(lambda (tag)
(set-text-properties 0 (length tag) nil tag)
tag)
  tags))

(defun notmuch-show-remove-all-tags ()
  "Remove all tags from the currently selected thread."
  (apply 'notmuch-show-remove-tag
 (notmuch-tags-strip-properties (notmuch-show-get-tags

(defun notmuch-search-remove-tags ( tags)
  "Remove multiple tags from the currently selected thread."
  (mapc 'notmuch-search-remove-tag tags))

(defun notmuch-search-remove-all-tags ()
  "Remove all tags from the currently selected thread."
  (apply 'notmuch-search-remove-tags
 (notmuch-tags-strip-properties (notmuch-search-get-tags


Re: [notmuch] [PATCH] add notmuch-show-delete keybinding 'd'

2010-02-25 Thread Sebastian Spaeth
On Wed, 24 Feb 2010 14:01:18 -0500, Jameson Rollins 
jroll...@finestructure.net wrote:
  2. It removes the inbox and unread tags while adding the tag to
 indicate deletion.
 
 Hey, Carl.  Why is this last point important? [...]Why should it modify any 
 other
 tags?  A message/thread should be allowed to be both deleted and in the
 inbox.

As long as deleted threads/messages show up in the default views, I
don't want them to show up in my inbox or show up as unread. I agree
that it might be possible to have unread yet deleted emails. But in
reality, if I delete a message I don't want it to pop up in my inbox.

Feel free to apply patches however you want though, thanks to emacs,
I'll be able to get my desired behavior nonetheless :).

 As for unread, I think that should be handled by actually reading the
 message, not by manually applying a state to it.

I agree, but deleting a message in my world view resets the unread tag
(as in, I don't want to read it anymore).

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


Re: [notmuch] [PATCH] add notmuch-show-delete keybinding 'd'

2010-02-25 Thread James Vasile
At Thu, 25 Feb 2010 11:53:14 +0100,
Sebastian Spaeth wrote:
 
 On Wed, 24 Feb 2010 14:01:18 -0500, Jameson Rollins 
 jroll...@finestructure.net wrote:
   2. It removes the inbox and unread tags while adding the tag to
  indicate deletion.
  
  Hey, Carl.  Why is this last point important? [...]Why should it modify any 
  other
  tags?  A message/thread should be allowed to be both deleted and in the
  inbox.
 
 As long as deleted threads/messages show up in the default views, I
 don't want them to show up in my inbox or show up as unread. I agree
 that it might be possible to have unread yet deleted emails. But in
 reality, if I delete a message I don't want it to pop up in my inbox.
 
 Feel free to apply patches however you want though, thanks to emacs,
 I'll be able to get my desired behavior nonetheless :).
 
  As for unread, I think that should be handled by actually reading the
  message, not by manually applying a state to it.
 
 I agree, but deleting a message in my world view resets the unread tag
 (as in, I don't want to read it anymore).

This elisp might help.  I run these when deleting messages in search
or show modes.  Basically, this means I never see deleted threads
again.  I also use these to mark spam.

(defun notmuch-tags-strip-properties (tags)
  return list of tags with emacs text properties removed

tags is a list of tags where each tag is a string with emacs text
properties

  (mapcar '(lambda (tag)
(set-text-properties 0 (length tag) nil tag)
tag)
  tags))

(defun notmuch-show-remove-all-tags ()
  Remove all tags from the currently selected thread.
  (apply 'notmuch-show-remove-tag
 (notmuch-tags-strip-properties (notmuch-show-get-tags

(defun notmuch-search-remove-tags (rest tags)
  Remove multiple tags from the currently selected thread.
  (mapc 'notmuch-search-remove-tag tags))

(defun notmuch-search-remove-all-tags ()
  Remove all tags from the currently selected thread.
  (apply 'notmuch-search-remove-tags
 (notmuch-tags-strip-properties (notmuch-search-get-tags
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[notmuch] [PATCH] add notmuch-show-delete keybinding 'd'

2010-02-24 Thread Jameson Rollins
On Wed, 24 Feb 2010 11:28:29 -0800, Carl Worth  wrote:
> On Wed, 24 Feb 2010 14:01:18 -0500, Jameson Rollins  finestructure.net> wrote:
> > > 2. It removes the "inbox" and "unread" tags while adding the tag to
> > >indicate deletion.
> > 
> > Hey, Carl.  Why is this last point important?
> 
> I guess I was imagining the case of running "notmuch search tag:inbox"
> at the command-line. That output will get out of hand fairly quickly if
> it includes all deleted messages back to the beginning of time, (or as
> far back as the window of actually deleting files from the
> mailstore[*]).
> 
> But you're right that tags should really be handled orthogonally. Maybe
> what we want is lower-level support for the "deleted" tag? Other than
> just the high-level emacs interface?

Yeah, I tend to think that notmuch should be as agnostic about tag
handling as possible.  The beauty of that is that it keeps things as
simple and configurable as possible, which is necessary because everyone
will have a different way they want to do things.

The point of the functions provided by these patches is basically just
convenience.  In fact, I had implemented the functions I previously
included in my own private .el, since I didn't know if they would be
wanted by all others.  In general, I'm a big fan of "keep it simple"
(KIS).  In this case that means "if I want to add a delete tag, the tool
should do just that and nothing else".  I certainly don't want the other
tags modified.  If one did, it's really quite easy to write custom emacs
functions to do that.  We can just hints on doing that in the wiki if
need be.

> That could put *more* direct interpretation of specific tags in the low
> levels. And this is the opposite direction of where we've been going (or
> talking about at least). We've currently got "inbox" and "unread" inside
> the low levels and there's been talking or removing those, switching to
> just "new" or making it all configurable.

This isn't a bad idea at all.  I don't think it changes the
functionality much, but it does make things conceptually much simpler,
which I'm always in favor of (KIS).

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



[notmuch] [PATCH] add notmuch-show-delete keybinding 'd'

2010-02-24 Thread Jameson Rollins
On Wed, 24 Feb 2010 10:53:50 -0800, Carl Worth  wrote:
> But this patch does have two good ideas not in the other patch, (both of
> which I mentioned in the review):
> 
> 1. It adds a keybinding to the notmuch-show mode
> 
> 2. It removes the "inbox" and "unread" tags while adding the tag to
>indicate deletion.

Hey, Carl.  Why is this last point important?  I've been using my own
patchs for handling deleted messages, and all deleting a message or
thread does is add the "delete" tag.  Why should it modify any other
tags?  A message/thread should be allowed to be both deleted and in the
inbox.

As for "unread", I think that should be handled by actually reading the
message, not by manually applying a state to it.

FWIW, below are the functions I've added to my notmuch .el to handle
message/thread deleting.

jamie.

(defun notmuch-search-delete-thread ()
  "Delete thread (add \"delete\" tag).

This function advances the next thread when finished."
  (interactive)
  (notmuch-search-add-tag "delete")
  (forward-line))

(define-key notmuch-search-mode-map "d" 'notmuch-search-delete-thread)

(defun notmuch-show-delete-message ()
  "Delete message (add \"delete\" tag).

Add the \"delete\" tag to message. Then kill this buffer and
show the next thread from the search from which this thread was
originally shown."
  (interactive)
  (notmuch-show-add-tag "delete")
  (let ((parent-buffer notmuch-show-parent-buffer))
(kill-this-buffer)
(if parent-buffer
(progn
  (switch-to-buffer parent-buffer)
  (forward-line)

(define-key notmuch-show-mode-map "d" 'notmuch-show-delete-message)
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: 



[notmuch] [PATCH] add notmuch-show-delete keybinding 'd'

2010-02-24 Thread Carl Worth
On Wed, 24 Feb 2010 14:01:18 -0500, Jameson Rollins  wrote:
> > 2. It removes the "inbox" and "unread" tags while adding the tag to
> >indicate deletion.
> 
> Hey, Carl.  Why is this last point important?

I guess I was imagining the case of running "notmuch search tag:inbox"
at the command-line. That output will get out of hand fairly quickly if
it includes all deleted messages back to the beginning of time, (or as
far back as the window of actually deleting files from the
mailstore[*]).

But you're right that tags should really be handled orthogonally. Maybe
what we want is lower-level support for the "deleted" tag? Other than
just the high-level emacs interface?

That could put *more* direct interpretation of specific tags in the low
levels. And this is the opposite direction of where we've been going (or
talking about at least). We've currently got "inbox" and "unread" inside
the low levels and there's been talking or removing those, switching to
just "new" or making it all configurable.

I do know that I also want to have low-level support for "muted" (aka
"killed" threads). For that I want an --exclude option to notmuch search
that would look something like this:

notmuch search --exclude="" 

Where the result would be the set difference of the threads matched by
the two sets of search terms. Perhaps with something like that in place
all we'd want in addition would be a configuration option to add
--exclude=tag:muted by default. And if we go that route, perhaps we
could have an option for an implicit "and not tag:deleted" for the
search terms as well.

I do worry about making the command-line tool hard to use without a
configuration file, but it also seems very appealing to keep the lowest
levels very general to allow people to experiment with whatever they
want on top.

-Carl

[*] My eventual plan for detected spam and manually deleted messages is
to keep them in the mail store so they are searchable for some time (a
month or two) and then deleting them after that (with something like a
cron job using a convenient --before="2 months ago" syntax to a notmuch
search command).
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: 



[notmuch] [PATCH] add notmuch-show-delete keybinding 'd'

2010-02-24 Thread Carl Worth
On Wed, 20 Jan 2010 11:56:07 +0100 (CET), racin at free.fr wrote:
> I posted a similar patch a while ago, that also did not show deleted
> messages by default. Don't know if Carl wants to integrate this though

OK. When two people are independently contributing similar
functionality, it's more than clear that I'm far too behind on patch
review.

Matthieu, I've just posted my review of your original patch. I think I
like the name "deleted" for the tag rather than "delete", (it's
consistent with "unread" at least that way). And I like the support for
excluding deleted results in that patch as well.

But this patch does have two good ideas not in the other patch, (both of
which I mentioned in the review):

1. It adds a keybinding to the notmuch-show mode

2. It removes the "inbox" and "unread" tags while adding the tag to
   indicate deletion.

-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] [PATCH] add notmuch-show-delete keybinding 'd'

2010-02-24 Thread Jameson Rollins
On Wed, 24 Feb 2010 10:53:50 -0800, Carl Worth cwo...@cworth.org wrote:
 But this patch does have two good ideas not in the other patch, (both of
 which I mentioned in the review):
 
 1. It adds a keybinding to the notmuch-show mode
 
 2. It removes the inbox and unread tags while adding the tag to
indicate deletion.

Hey, Carl.  Why is this last point important?  I've been using my own
patchs for handling deleted messages, and all deleting a message or
thread does is add the delete tag.  Why should it modify any other
tags?  A message/thread should be allowed to be both deleted and in the
inbox.

As for unread, I think that should be handled by actually reading the
message, not by manually applying a state to it.

FWIW, below are the functions I've added to my notmuch .el to handle
message/thread deleting.

jamie.

(defun notmuch-search-delete-thread ()
  Delete thread (add \delete\ tag).

This function advances the next thread when finished.
  (interactive)
  (notmuch-search-add-tag delete)
  (forward-line))

(define-key notmuch-search-mode-map d 'notmuch-search-delete-thread)

(defun notmuch-show-delete-message ()
  Delete message (add \delete\ tag).

Add the \delete\ tag to message. Then kill this buffer and
show the next thread from the search from which this thread was
originally shown.
  (interactive)
  (notmuch-show-add-tag delete)
  (let ((parent-buffer notmuch-show-parent-buffer))
(kill-this-buffer)
(if parent-buffer
(progn
  (switch-to-buffer parent-buffer)
  (forward-line)

(define-key notmuch-show-mode-map d 'notmuch-show-delete-message)


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


Re: [notmuch] [PATCH] add notmuch-show-delete keybinding 'd'

2010-02-24 Thread Carl Worth
On Wed, 24 Feb 2010 14:01:18 -0500, Jameson Rollins 
jroll...@finestructure.net wrote:
  2. It removes the inbox and unread tags while adding the tag to
 indicate deletion.
 
 Hey, Carl.  Why is this last point important?

I guess I was imagining the case of running notmuch search tag:inbox
at the command-line. That output will get out of hand fairly quickly if
it includes all deleted messages back to the beginning of time, (or as
far back as the window of actually deleting files from the
mailstore[*]).

But you're right that tags should really be handled orthogonally. Maybe
what we want is lower-level support for the deleted tag? Other than
just the high-level emacs interface?

That could put *more* direct interpretation of specific tags in the low
levels. And this is the opposite direction of where we've been going (or
talking about at least). We've currently got inbox and unread inside
the low levels and there's been talking or removing those, switching to
just new or making it all configurable.

I do know that I also want to have low-level support for muted (aka
killed threads). For that I want an --exclude option to notmuch search
that would look something like this:

notmuch search --exclude=negative-search-terms positive-search-terms

Where the result would be the set difference of the threads matched by
the two sets of search terms. Perhaps with something like that in place
all we'd want in addition would be a configuration option to add
--exclude=tag:muted by default. And if we go that route, perhaps we
could have an option for an implicit and not tag:deleted for the
search terms as well.

I do worry about making the command-line tool hard to use without a
configuration file, but it also seems very appealing to keep the lowest
levels very general to allow people to experiment with whatever they
want on top.

-Carl

[*] My eventual plan for detected spam and manually deleted messages is
to keep them in the mail store so they are searchable for some time (a
month or two) and then deleting them after that (with something like a
cron job using a convenient --before=2 months ago syntax to a notmuch
search command).


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


[notmuch] [PATCH] add notmuch-show-delete keybinding 'd'

2010-01-20 Thread Sebastian Spaeth
It adds a tag 'delete' and removes the tags 'inbox' and 'unread'.

Signed-off-by: Sebastian Spaeth 
---
 notmuch.el |8 
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index 97914f2..ff930c9 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -63,6 +63,7 @@
 (define-key map "m" 'message-mail)
 (define-key map "f" 'notmuch-show-forward-current)
 (define-key map "r" 'notmuch-show-reply)
+(define-key map "d" 'notmuch-show-delete)
 (define-key map "|" 'notmuch-show-pipe-message)
 (define-key map "w" 'notmuch-show-save-attachments)
 (define-key map "V" 'notmuch-show-view-raw-message)
@@ -369,6 +370,13 @@ buffer."
   (let ((message-id (notmuch-show-get-message-id)))
 (notmuch-reply message-id)))

+(defun notmuch-show-delete ()
+  "'delete' current mail and remove 'unread' 'inbox'"
+  (interactive)
+  (notmuch-show-add-tag "delete")
+  (notmuch-show-remove-tag "unread")
+  (notmuch-show-remove-tag "inbox"))
+
 (defun notmuch-show-forward-current ()
   "Forward the current message."
   (interactive)
-- 
1.6.3.3



Re: [notmuch] [PATCH] add notmuch-show-delete keybinding 'd'

2010-01-20 Thread racin
Hi Sebastian,

I posted a similar patch a while ago, that also did not show deleted messages 
by default. Don't know if Carl wants to 
integrate this though

Matthieu

- Mail Original -
De: Sebastian Spaeth sebast...@sspaeth.de
À: notmuch notmuch@notmuchmail.org
Envoyé: Mercredi 20 Janvier 2010 10h32:10 GMT +00:00 GMT - Grande-Bretagne, 
Irlande, Portugal
Objet: [notmuch] [PATCH] add notmuch-show-delete keybinding 'd'

It adds a tag 'delete' and removes the tags 'inbox' and 'unread'.

Signed-off-by: Sebastian Spaeth sebast...@sspaeth.de
---
 notmuch.el |8 
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index 97914f2..ff930c9 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -63,6 +63,7 @@
 (define-key map m 'message-mail)
 (define-key map f 'notmuch-show-forward-current)
 (define-key map r 'notmuch-show-reply)
+(define-key map d 'notmuch-show-delete)
 (define-key map | 'notmuch-show-pipe-message)
 (define-key map w 'notmuch-show-save-attachments)
 (define-key map V 'notmuch-show-view-raw-message)
@@ -369,6 +370,13 @@ buffer.
   (let ((message-id (notmuch-show-get-message-id)))
 (notmuch-reply message-id)))
 
+(defun notmuch-show-delete ()
+  'delete' current mail and remove 'unread' 'inbox'
+  (interactive)
+  (notmuch-show-add-tag delete)
+  (notmuch-show-remove-tag unread)
+  (notmuch-show-remove-tag inbox))
+
 (defun notmuch-show-forward-current ()
   Forward the current message.
   (interactive)
-- 
1.6.3.3

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