Re: [notmuch] [PATCH] Support for deletion (patch included)

2010-03-01 Thread Michal Sojka
On Thu, 25 Feb 2010 01:00:04 +0100 (CET), ra...@free.fr wrote:
 Hi Carl,
 
  Could you also write a commit message describing what the patch does?
  The easiest way for me to apply that would be if you would create a git
  commit, then run git format-patch origin/master and mail the resulting
  files, (the git send-email command can be used here, or you can insert
  the files into a mail-composition buffer and modify them as needed).
  
 
 OK, here it is (comments below). I had trouble splitting the patches into a 
 patch series; I
 found git add -p, but isn't there a better interface for selecting
 patches?

What about git gui?

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


Re: [notmuch] [PATCH] Support for deletion (patch included)

2010-02-27 Thread racin
Here they are; as I don't know how to include them in the body, I put the 
patches as attachments. I hope this 
will be convienient enough for you.


Matthieu

- ra...@free.fr a écrit :

 Carl: The patch in the mail has problems; apparently I have to
 manually add scissorlines to the mail for it
 to be processed by git-am. I thought this was automatically added. (I
 hate the git UI -- nothing is consistent,
 concepts have different names, the definition of scissor lines is as
 precise as A line that mainly consists of scissors (either 8 or
 8) and perforation (dash -) --, but I guess we can get used to it
 after a while...)
 
 I'll send you a proper patch as soon as I can. Meanwhile, I'm sure you
 have comments on this updated patch!
 
 Matthieu
From 0073152e3fa7dd11d88de28e87eec7762cdbbbeb Mon Sep 17 00:00:00 2001
From: Matthieu Lemerre ra...@free.fr
Date: Thu, 25 Feb 2010 00:25:51 +0100
Subject: [PATCH 2/2] Add support for deletion in the emacs interface

Add d keybinding in notmuch-show and notmuch-summary to delete the current
thread. Adds D keybinding to delete the current message in notmuch-show.
Adds a deleted folder. Omit deleted items from searchs if no prefix arg.
Adds history management to make searching deleted items more convenient.

---
 notmuch.el |   56 +---
 1 files changed, 49 insertions(+), 7 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index 5d7342a..0285573 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -92,6 +92,8 @@
 (define-key map x 'notmuch-show-archive-thread-then-exit)
 (define-key map A 'notmuch-show-mark-read-then-archive-thread)
 (define-key map a 'notmuch-show-archive-thread)
+(define-key map d 'notmuch-show-delete-thread)
+(define-key map D 'notmuch-show-delete-message)
 (define-key map p 'notmuch-show-previous-message)
 (define-key map N 'notmuch-show-mark-read-then-next-open-message)
 (define-key map n 'notmuch-show-next-message)
@@ -380,6 +382,23 @@ buffer.
   (notmuch-show-archive-thread)
   (kill-this-buffer))
 
+(defun notmuch-show-delete-message ()
+  Delete current message (sets its deleted tag).
+  (interactive)
+  (notmuch-show-add-tag deleted))
+
+(defun notmuch-show-delete-thread()
+  Delete each message in thread.
+  (interactive)
+  (notmuch-show-forall-in-thread
+   (notmuch-show-delete-message)))
+
+(defun notmuch-show-delete-thread-and-exit()
+  Delete each message in thread, then exit back to search results.
+  (interactive)
+  (notmuch-show-delete-thread)
+  (kill-this-buffer))
+
 (defun notmuch-show-mark-read-then-archive-then-exit ()
   Remove unread tags from thread, then archive and exit to search results.
   (interactive)
@@ -1227,6 +1246,7 @@ matching this search term are shown if non-nil. 
 (define-key map [mouse-1] 'notmuch-search-show-thread)
 (define-key map * 'notmuch-search-operate-all)
 (define-key map a 'notmuch-search-archive-thread)
+(define-key map d 'notmuch-search-delete-thread)
 (define-key map - 'notmuch-search-remove-tag)
 (define-key map + 'notmuch-search-add-tag)
 (define-key map (kbd RET) 'notmuch-search-show-thread)
@@ -1235,6 +1255,7 @@ matching this search term are shown if non-nil. 
 (fset 'notmuch-search-mode-map notmuch-search-mode-map)
 
 (defvar notmuch-search-query-string)
+(defvar notmuch-search-history nil)
 (defvar notmuch-search-oldest-first t
   Show the oldest mail first in the search-mode)
 
@@ -1446,6 +1467,13 @@ This function advances the next thread when finished.
   (notmuch-search-remove-tag inbox)
   (forward-line))
 
+(defun notmuch-search-delete-thread ()
+  Mark the currently selected thread as deleted (set its \deleted\ tag).
+This function advances the next thread when finished.
+  (interactive)
+  (notmuch-search-add-tag deleted)
+  (forward-line))
+
 (defun notmuch-search-process-sentinel (proc msg)
   Add a message to let user know when \notmuch search\ exits
   (let ((buffer (process-buffer proc))
@@ -1520,10 +1548,22 @@ characters as well as `_.+-'.
 	   (append action-split (list notmuch-search-query-string) nil
 
 ;;;###autoload
-(defun notmuch-search (query optional oldest-first)
-  Run \notmuch search\ with the given query string and display results.
-  (interactive sNotmuch search: )
-  (let ((buffer (get-buffer-create (concat *notmuch-search- query *
+(defun notmuch-search (query optional oldest-first include-deleted)
+  Run \notmuch search\ with the given query string and display results.
+
+With prefix argument, include deleted items.
+
+  (interactive (let* ((prefix current-prefix-arg)
+		  (query (if prefix
+ (read-string Notmuch search (including deleted): 
+	  notmuch-search-query-string
+	  'notmuch-search-history)
+			   (read-string Notmuch search:  nil
+	'notmuch-search-history
+		 (list query nil prefix)))
+  (let ((real-query (if include-deleted query 
+		  (concat not tag:deleted and ( query 
+	(buffer 

Re: [notmuch] [PATCH] Support for deletion (patch included)

2010-02-25 Thread racin
Carl: The patch in the mail has problems; apparently I have to manually add 
scissorlines to the mail for it
to be processed by git-am. I thought this was automatically added. (I hate the 
git UI -- nothing is consistent,
concepts have different names, the definition of scissor lines is as precise as 
A line that mainly consists of scissors (either 8 or 8) and perforation 
(dash -) --, but I guess we can get used to it after a while...)

I'll send you a proper patch as soon as I can. Meanwhile, I'm sure you have 
comments on this updated patch!

Matthieu

À: Carl Worth cwo...@cworth.org
Cc: notmuch@notmuchmail.org
Envoyé: Jeudi 25 Février 2010 00h00:04 GMT +00:00 GMT - Grande-Bretagne, 
Irlande, Portugal
Objet: Re: [notmuch] [PATCH] Support for deletion (patch included)

Hi Carl,

 Could you also write a commit message describing what the patch does?
 The easiest way for me to apply that would be if you would create a git
 commit, then run git format-patch origin/master and mail the resulting
 files, (the git send-email command can be used here, or you can insert
 the files into a mail-composition buffer and modify them as needed).
 

OK, here it is (comments below). I had trouble splitting the patches into a 
patch series; I
found git add -p, but isn't there a better interface for selecting patches?

From bdee9558d93bffb97c80632f522288e059deb7c2 Mon Sep 17 00:00:00 2001
From: Matthieu Lemerre ra...@racin.rez-gif.supelec.fr
Date: Thu, 25 Feb 2010 00:24:24 +0100
Subject: [PATCH 1/2] Add and use notmuch-show-forall-in-thread macro

---
 notmuch.el |   17 +++--
 1 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index 6482170..5d7342a 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -321,17 +321,22 @@ pseudoheader summary
 (cons (notmuch-show-get-message-id) nil)))
  (notmuch-show-set-tags (sort (set-difference tags toremove :test 
'string=) 'string))
 
-(defun notmuch-show-archive-thread-maybe-mark-read (markread)
-  (save-excursion
+(defmacro notmuch-show-forall-in-thread (rest body)
+  Executes BODY with point in all messages of the current thread.
+  `(save-excursion
 (goto-char (point-min))
 (while (not (eobp))
-  (if markread
- (notmuch-show-remove-tag unread inbox)
-   (notmuch-show-remove-tag inbox))
+  ,@body
   (if (not (eobp))
  (forward-char))
   (if (not (re-search-forward notmuch-show-message-begin-regexp nil t))
- (goto-char (point-max)
+ (goto-char (point-max))
+
+(defun notmuch-show-archive-thread-maybe-mark-read (markread)
+  (notmuch-show-forall-in-thread
+  (if markread
+ (notmuch-show-remove-tag unread inbox)
+   (notmuch-show-remove-tag inbox)))
   (let ((parent-buffer notmuch-show-parent-buffer))
 (kill-this-buffer)
 (if parent-buffer
-- 
1.6.5


This first patch is helpful for factorizing out code. Basically, it allows to
apply a message-only command to all the thread.

From 0073152e3fa7dd11d88de28e87eec7762cdbbbeb Mon Sep 17 00:00:00 2001
From: Matthieu Lemerre ra...@racin.rez-gif.supelec.fr
Date: Thu, 25 Feb 2010 00:25:51 +0100
Subject: [PATCH 2/2] Add support for deletion in the emacs interface

---
 notmuch.el |   56 +---
 1 files changed, 49 insertions(+), 7 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index 5d7342a..0285573 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -92,6 +92,8 @@
 (define-key map x 'notmuch-show-archive-thread-then-exit)
 (define-key map A 'notmuch-show-mark-read-then-archive-thread)
 (define-key map a 'notmuch-show-archive-thread)
+(define-key map d 'notmuch-show-delete-thread)
+(define-key map D 'notmuch-show-delete-message)
 (define-key map p 'notmuch-show-previous-message)
 (define-key map N 'notmuch-show-mark-read-then-next-open-message)
 (define-key map n 'notmuch-show-next-message)
@@ -380,6 +382,23 @@ buffer.
   (notmuch-show-archive-thread)
   (kill-this-buffer))
 
+(defun notmuch-show-delete-message ()
+  Delete current message (sets its deleted tag).
+  (interactive)
+  (notmuch-show-add-tag deleted))
+
+(defun notmuch-show-delete-thread()
+  Delete each message in thread.
+  (interactive)
+  (notmuch-show-forall-in-thread
+   (notmuch-show-delete-message)))
+
+(defun notmuch-show-delete-thread-and-exit()
+  Delete each message in thread, then exit back to search results.
+  (interactive)
+  (notmuch-show-delete-thread)
+  (kill-this-buffer))
+
 (defun notmuch-show-mark-read-then-archive-then-exit ()
   Remove unread tags from thread, then archive and exit to search results.
   (interactive)
@@ -1227,6 +1246,7 @@ matching this search term are shown if non-nil. 
 (define-key map [mouse-1] 'notmuch-search-show-thread)
 (define-key map * 'notmuch-search-operate-all)
 (define-key map a 'notmuch-search-archive-thread)
+(define-key map d 'notmuch-search-delete-thread)
 (define

Re: [notmuch] [PATCH] Support for deletion (patch included)

2010-02-24 Thread racin
Hi Carl,

 Could you also write a commit message describing what the patch does?
 The easiest way for me to apply that would be if you would create a git
 commit, then run git format-patch origin/master and mail the resulting
 files, (the git send-email command can be used here, or you can insert
 the files into a mail-composition buffer and modify them as needed).
 

OK, here it is (comments below). I had trouble splitting the patches into a 
patch series; I
found git add -p, but isn't there a better interface for selecting patches?

From bdee9558d93bffb97c80632f522288e059deb7c2 Mon Sep 17 00:00:00 2001
From: Matthieu Lemerre ra...@racin.rez-gif.supelec.fr
Date: Thu, 25 Feb 2010 00:24:24 +0100
Subject: [PATCH 1/2] Add and use notmuch-show-forall-in-thread macro

---
 notmuch.el |   17 +++--
 1 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index 6482170..5d7342a 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -321,17 +321,22 @@ pseudoheader summary
 (cons (notmuch-show-get-message-id) nil)))
  (notmuch-show-set-tags (sort (set-difference tags toremove :test 
'string=) 'string))
 
-(defun notmuch-show-archive-thread-maybe-mark-read (markread)
-  (save-excursion
+(defmacro notmuch-show-forall-in-thread (rest body)
+  Executes BODY with point in all messages of the current thread.
+  `(save-excursion
 (goto-char (point-min))
 (while (not (eobp))
-  (if markread
- (notmuch-show-remove-tag unread inbox)
-   (notmuch-show-remove-tag inbox))
+  ,@body
   (if (not (eobp))
  (forward-char))
   (if (not (re-search-forward notmuch-show-message-begin-regexp nil t))
- (goto-char (point-max)
+ (goto-char (point-max))
+
+(defun notmuch-show-archive-thread-maybe-mark-read (markread)
+  (notmuch-show-forall-in-thread
+  (if markread
+ (notmuch-show-remove-tag unread inbox)
+   (notmuch-show-remove-tag inbox)))
   (let ((parent-buffer notmuch-show-parent-buffer))
 (kill-this-buffer)
 (if parent-buffer
-- 
1.6.5


This first patch is helpful for factorizing out code. Basically, it allows to
apply a message-only command to all the thread.

From 0073152e3fa7dd11d88de28e87eec7762cdbbbeb Mon Sep 17 00:00:00 2001
From: Matthieu Lemerre ra...@racin.rez-gif.supelec.fr
Date: Thu, 25 Feb 2010 00:25:51 +0100
Subject: [PATCH 2/2] Add support for deletion in the emacs interface

---
 notmuch.el |   56 +---
 1 files changed, 49 insertions(+), 7 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index 5d7342a..0285573 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -92,6 +92,8 @@
 (define-key map x 'notmuch-show-archive-thread-then-exit)
 (define-key map A 'notmuch-show-mark-read-then-archive-thread)
 (define-key map a 'notmuch-show-archive-thread)
+(define-key map d 'notmuch-show-delete-thread)
+(define-key map D 'notmuch-show-delete-message)
 (define-key map p 'notmuch-show-previous-message)
 (define-key map N 'notmuch-show-mark-read-then-next-open-message)
 (define-key map n 'notmuch-show-next-message)
@@ -380,6 +382,23 @@ buffer.
   (notmuch-show-archive-thread)
   (kill-this-buffer))
 
+(defun notmuch-show-delete-message ()
+  Delete current message (sets its deleted tag).
+  (interactive)
+  (notmuch-show-add-tag deleted))
+
+(defun notmuch-show-delete-thread()
+  Delete each message in thread.
+  (interactive)
+  (notmuch-show-forall-in-thread
+   (notmuch-show-delete-message)))
+
+(defun notmuch-show-delete-thread-and-exit()
+  Delete each message in thread, then exit back to search results.
+  (interactive)
+  (notmuch-show-delete-thread)
+  (kill-this-buffer))
+
 (defun notmuch-show-mark-read-then-archive-then-exit ()
   Remove unread tags from thread, then archive and exit to search results.
   (interactive)
@@ -1227,6 +1246,7 @@ matching this search term are shown if non-nil. 
 (define-key map [mouse-1] 'notmuch-search-show-thread)
 (define-key map * 'notmuch-search-operate-all)
 (define-key map a 'notmuch-search-archive-thread)
+(define-key map d 'notmuch-search-delete-thread)
 (define-key map - 'notmuch-search-remove-tag)
 (define-key map + 'notmuch-search-add-tag)
 (define-key map (kbd RET) 'notmuch-search-show-thread)
@@ -1235,6 +1255,7 @@ matching this search term are shown if non-nil. 
 (fset 'notmuch-search-mode-map notmuch-search-mode-map)
 
 (defvar notmuch-search-query-string)
+(defvar notmuch-search-history nil)
 (defvar notmuch-search-oldest-first t
   Show the oldest mail first in the search-mode)
 
@@ -1446,6 +1467,13 @@ This function advances the next thread when finished.
   (notmuch-search-remove-tag inbox)
   (forward-line))
 
+(defun notmuch-search-delete-thread ()
+  Mark the currently selected thread as deleted (set its \deleted\ tag).
+This function advances the next thread when finished.
+  (interactive)
+