unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] add notmuch-show-delete keybinding 'd'
@ 2010-01-20 10:32 Sebastian Spaeth
  2010-01-20 10:56 ` racin
  0 siblings, 1 reply; 8+ messages in thread
From: Sebastian Spaeth @ 2010-01-20 10:32 UTC (permalink / raw)
  To: notmuch

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

Signed-off-by: Sebastian Spaeth <Sebastian@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

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

* Re: [PATCH] add notmuch-show-delete keybinding 'd'
  2010-01-20 10:32 [PATCH] add notmuch-show-delete keybinding 'd' Sebastian Spaeth
@ 2010-01-20 10:56 ` racin
  2010-02-24 18:53   ` Carl Worth
  0 siblings, 1 reply; 8+ messages in thread
From: racin @ 2010-01-20 10:56 UTC (permalink / raw)
  To: Sebastian Spaeth; +Cc: notmuch

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" <Sebastian@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 <Sebastian@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

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

* Re: [PATCH] add notmuch-show-delete keybinding 'd'
  2010-01-20 10:56 ` racin
@ 2010-02-24 18:53   ` Carl Worth
  2010-02-24 19:01     ` Jameson Rollins
  0 siblings, 1 reply; 8+ messages in thread
From: Carl Worth @ 2010-02-24 18:53 UTC (permalink / raw)
  To: racin, Sebastian Spaeth; +Cc: notmuch

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

On Wed, 20 Jan 2010 11:56:07 +0100 (CET), racin@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

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

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

* Re: [PATCH] add notmuch-show-delete keybinding 'd'
  2010-02-24 18:53   ` Carl Worth
@ 2010-02-24 19:01     ` Jameson Rollins
  2010-02-24 19:28       ` Carl Worth
  2010-02-25 10:53       ` Sebastian Spaeth
  0 siblings, 2 replies; 8+ messages in thread
From: Jameson Rollins @ 2010-02-24 19:01 UTC (permalink / raw)
  To: Carl Worth, racin, Sebastian Spaeth; +Cc: notmuch

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

On Wed, 24 Feb 2010 10:53:50 -0800, Carl Worth <cworth@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)

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

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

* Re: [PATCH] add notmuch-show-delete keybinding 'd'
  2010-02-24 19:01     ` Jameson Rollins
@ 2010-02-24 19:28       ` Carl Worth
  2010-02-24 19:46         ` Jameson Rollins
  2010-02-25 10:53       ` Sebastian Spaeth
  1 sibling, 1 reply; 8+ messages in thread
From: Carl Worth @ 2010-02-24 19:28 UTC (permalink / raw)
  To: Jameson Rollins, racin, Sebastian Spaeth; +Cc: notmuch

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

On Wed, 24 Feb 2010 14:01:18 -0500, Jameson Rollins <jrollins@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).

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

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

* Re: [PATCH] add notmuch-show-delete keybinding 'd'
  2010-02-24 19:28       ` Carl Worth
@ 2010-02-24 19:46         ` Jameson Rollins
  0 siblings, 0 replies; 8+ messages in thread
From: Jameson Rollins @ 2010-02-24 19:46 UTC (permalink / raw)
  To: Carl Worth, racin, Sebastian Spaeth; +Cc: notmuch

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

On Wed, 24 Feb 2010 11:28:29 -0800, Carl Worth <cworth@cworth.org> wrote:
> On Wed, 24 Feb 2010 14:01:18 -0500, Jameson Rollins <jrollins@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.

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

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

* Re: [PATCH] add notmuch-show-delete keybinding 'd'
  2010-02-24 19:01     ` Jameson Rollins
  2010-02-24 19:28       ` Carl Worth
@ 2010-02-25 10:53       ` Sebastian Spaeth
  2010-02-25 14:21         ` James Vasile
  1 sibling, 1 reply; 8+ messages in thread
From: Sebastian Spaeth @ 2010-02-25 10:53 UTC (permalink / raw)
  To: Jameson Rollins, Carl Worth, racin; +Cc: notmuch

On Wed, 24 Feb 2010 14:01:18 -0500, Jameson Rollins <jrollins@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).

Sebastian

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

* Re: [PATCH] add notmuch-show-delete keybinding 'd'
  2010-02-25 10:53       ` Sebastian Spaeth
@ 2010-02-25 14:21         ` James Vasile
  0 siblings, 0 replies; 8+ messages in thread
From: James Vasile @ 2010-02-25 14:21 UTC (permalink / raw)
  To: Sebastian Spaeth; +Cc: notmuch

At Thu, 25 Feb 2010 11:53:14 +0100,
Sebastian Spaeth wrote:
> 
> On Wed, 24 Feb 2010 14:01:18 -0500, Jameson Rollins <jrollins@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 (&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))))

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

end of thread, other threads:[~2010-02-25 14:21 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-20 10:32 [PATCH] add notmuch-show-delete keybinding 'd' Sebastian Spaeth
2010-01-20 10:56 ` racin
2010-02-24 18:53   ` Carl Worth
2010-02-24 19:01     ` Jameson Rollins
2010-02-24 19:28       ` Carl Worth
2010-02-24 19:46         ` Jameson Rollins
2010-02-25 10:53       ` Sebastian Spaeth
2010-02-25 14:21         ` James Vasile

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