unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
[parent not found: <829811857.5353531267112884804.JavaMail.root@zimbra1-e1.priv.proxad.net>]
* [PATCH] Support for deletion (patch included)
@ 2009-12-13 11:54 Matthieu Lemerre
  2010-02-24 18:49 ` Carl Worth
  0 siblings, 1 reply; 7+ messages in thread
From: Matthieu Lemerre @ 2009-12-13 11:54 UTC (permalink / raw
  To: notmuch

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


I forgot the attachment..


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

diff --git a/notmuch.el b/notmuch.el
index 97914f2..f770dd0 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -991,6 +991,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-mark-as-deleted)
     (define-key map "-" 'notmuch-search-remove-tag)
     (define-key map "+" 'notmuch-search-add-tag)
     (define-key map (kbd "RET") 'notmuch-search-show-thread)
@@ -999,6 +1000,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")
 
@@ -1210,6 +1212,15 @@ This function advances the next thread when finished."
   (notmuch-search-remove-tag "inbox")
   (forward-line))
 
+
+(defun notmuch-search-mark-as-deleted ()
+  "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))
@@ -1284,10 +1295,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 (get-buffer-create (concat "*notmuch-search-" query "*"))))
     (switch-to-buffer buffer)
     (notmuch-search-mode)
     (set 'notmuch-search-query-string query)
@@ -1303,7 +1326,7 @@ characters as well as `_.+-'.
 	(let ((proc (start-process-shell-command
 		     "notmuch-search" buffer notmuch-command "search"
 		     (if oldest-first "--sort=oldest-first" "--sort=newest-first")
-		     (shell-quote-argument query))))
+		     (shell-quote-argument real-query))))
 	  (set-process-sentinel proc 'notmuch-search-process-sentinel)
 	  (set-process-filter proc 'notmuch-search-process-filter))))
     (run-hooks 'notmuch-search-hook)))
@@ -1351,7 +1374,6 @@ search."
 
 Runs a new search matching only messages that match both the
 current search results AND the additional query string provided."
-  (interactive "sFilter search: ")
   (let ((grouped-query (if (string-match-p notmuch-search-disjunctive-regexp query) (concat "( " query " )") query)))
     (notmuch-search (concat notmuch-search-query-string " and " grouped-query) notmuch-search-oldest-first)))
 
@@ -1391,7 +1413,9 @@ current search results AND that are tagged with the given tag."
 
 (fset 'notmuch-folder-mode-map notmuch-folder-mode-map)
 
-(defcustom notmuch-folders (quote (("inbox" . "tag:inbox") ("unread" . "tag:unread")))
+(defcustom notmuch-folders (quote (("inbox" . "tag:inbox") 
+				   ("unread" . "tag:unread")
+				   ("deleted" . "tag:deleted")))
   "List of searches for the notmuch folder view"
   :type '(alist :key-type (string) :value-type (string))
   :group 'notmuch)

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

end of thread, other threads:[~2010-03-01  9:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1427711643.5760731267266834921.JavaMail.root@zimbra1-e1.priv.proxad.net>
2010-02-27 10:34 ` [PATCH] Support for deletion (patch included) racin
     [not found] <829811857.5353531267112884804.JavaMail.root@zimbra1-e1.priv.proxad.net>
2010-02-25 15:51 ` racin
2009-12-13 11:54 Matthieu Lemerre
2010-02-24 18:49 ` Carl Worth
2010-02-25  0:00   ` racin
2010-02-25 10:49     ` Sebastian Spaeth
2010-03-01  9:09     ` Michal Sojka

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