unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Matthieu Lemerre <racin@free.fr>
To: notmuch@notmuchmail.org
Subject: [PATCH] Support for deletion (patch included)
Date: Sun, 13 Dec 2009 12:54:09 +0100	[thread overview]
Message-ID: <87y6l7144e.fsf@free.fr> (raw)

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

             reply	other threads:[~2009-12-13 11:53 UTC|newest]

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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y6l7144e.fsf@free.fr \
    --to=racin@free.fr \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).