I forgot the attachment..

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)
_______________________________________________
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch

Reply via email to