Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id D38684196F3 for ; Wed, 21 Apr 2010 16:16:19 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -1.9 X-Spam-Level: X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5 tests=[BAYES_00=-1.9] autolearn=ham Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GnTbHaggc2-U for ; Wed, 21 Apr 2010 16:16:19 -0700 (PDT) Received: from mail.hohndel.org (mail.hohndel.org [65.23.157.147]) by olra.theworths.org (Postfix) with ESMTP id C35DD431FC1 for ; Wed, 21 Apr 2010 16:16:18 -0700 (PDT) Received: by mail.hohndel.org (Postfix, from userid 112) id 773F5340FA; Wed, 21 Apr 2010 19:16:18 -0400 (EDT) Received: from x200.gr8dns.org (unknown [65.23.157.147]) by mail.hohndel.org (Postfix) with ESMTP id AECA3340F4; Wed, 21 Apr 2010 19:16:17 -0400 (EDT) Received: by x200.gr8dns.org (Postfix, from userid 500) id 76E7BC0212; Wed, 21 Apr 2010 16:16:17 -0700 (PDT) From: Dirk Hohndel To: Subject: [PATCH] Add 'd'elete keybinding to search and show views Date: Wed, 21 Apr 2010 16:16:03 -0700 Message-Id: <1271891763-10757-2-git-send-email-hohndel@infradead.org> X-Mailer: git-send-email 1.6.6.1 In-Reply-To: <1271891763-10757-1-git-send-email-hohndel@infradead.org> References: <1271891763-10757-1-git-send-email-hohndel@infradead.org> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Apr 2010 23:16:20 -0000 This is a variation of the 'a'rchive binding - it additionally sets the "deleted" tag (which notmuchsync uses to trigger pruning of files) Signed-off-by: Dirk Hohndel --- emacs/notmuch-show.el | 26 ++++++++++++++++++++++---- emacs/notmuch.el | 10 ++++++++++ 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 916b39e..45d1abe 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -520,6 +520,7 @@ function is used. " (define-key map "+" 'notmuch-show-add-tag) (define-key map "x" 'notmuch-show-archive-thread-then-exit) (define-key map "a" 'notmuch-show-archive-thread) + (define-key map "d" 'notmuch-show-delete-thread) (define-key map "N" 'notmuch-show-next-message) (define-key map "P" 'notmuch-show-previous-message) (define-key map "n" 'notmuch-show-next-open-message) @@ -910,10 +911,13 @@ to stdout or stderr will appear in the *Messages* buffer." (interactive) (backward-button 1)) -(defun notmuch-show-archive-thread-internal (show-next) +(defun notmuch-show-archive-or-delete-thread-internal (show-next delete) ;; Remove the tag from the current set of messages. (goto-char (point-min)) - (loop do (notmuch-show-remove-tag "inbox") + (loop do (progn + (notmuch-show-remove-tag "inbox") + (if delete + (notmuch-show-add-tag "deleted"))) until (not (notmuch-show-goto-message-next))) ;; Move to the next item in the search results, if any. (let ((parent-buffer notmuch-show-parent-buffer)) @@ -925,6 +929,20 @@ to stdout or stderr will appear in the *Messages* buffer." (if show-next (notmuch-search-show-thread)))))) +(defun notmuch-show-delete-thread () + "Delete each message in thread, then show next thread from search. + +Archive each message currently shown by removing the \"inbox\" +tag from each. Then kill this buffer and show the next thread +from the search from which this thread was originally shown. + +Note: This command is safe from any race condition of new messages +being delivered to the same thread. It does not archive the +entire thread, but only the messages shown in the current +buffer." + (interactive) + (notmuch-show-archive-or-delete-thread-internal t t)) + (defun notmuch-show-archive-thread () "Archive each message in thread, then show next thread from search. @@ -937,12 +955,12 @@ being delivered to the same thread. It does not archive the entire thread, but only the messages shown in the current buffer." (interactive) - (notmuch-show-archive-thread-internal t)) + (notmuch-show-archive-or-delete-thread-internal t nil)) (defun notmuch-show-archive-thread-then-exit () "Archive each message in thread, then exit back to search results." (interactive) - (notmuch-show-archive-thread-internal nil)) + (notmuch-show-archive-or-delete-thread-internal nil nil)) (defun notmuch-show-do-stash (text) (kill-new text) diff --git a/emacs/notmuch.el b/emacs/notmuch.el index f135bca..372f940 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -254,6 +254,7 @@ For a mouse binding, return 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) @@ -551,6 +552,15 @@ This function advances the next thread when finished." (notmuch-search-remove-tag-thread "inbox") (forward-line)) +(defun notmuch-search-delete-thread () + "Delete the currently selected thread (remove its \"inbox\" tag and add \"deleted\" tag). + +This function advances the next thread when finished." + (interactive) + (notmuch-search-remove-tag-thread "inbox") + (notmuch-search-add-tag-thread "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)) -- 1.6.6.1