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 199C5421192 for ; Tue, 17 Jan 2012 11:02:53 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -2.3 X-Spam-Level: X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled 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 XL+nz9azDnXJ for ; Tue, 17 Jan 2012 11:02:52 -0800 (PST) Received: from outgoing-mail.its.caltech.edu (outgoing-mail.its.caltech.edu [131.215.239.19]) by olra.theworths.org (Postfix) with ESMTP id 24BA2421189 for ; Tue, 17 Jan 2012 11:02:52 -0800 (PST) Received: from earth-doxen.imss.caltech.edu (localhost [127.0.0.1]) by earth-doxen-postvirus (Postfix) with ESMTP id B5B8266E0183 for ; Tue, 17 Jan 2012 11:02:51 -0800 (PST) X-Spam-Scanned: at Caltech-IMSS on earth-doxen by amavisd-new Received: from finestructure.net (cpe-76-174-137-84.socal.res.rr.com [76.174.137.84]) (Authenticated sender: jrollins) by earth-doxen-submit (Postfix) with ESMTP id D1C7B66E016C for ; Tue, 17 Jan 2012 11:02:49 -0800 (PST) Received: by finestructure.net (Postfix, from userid 1000) id 7B24752B; Tue, 17 Jan 2012 11:02:49 -0800 (PST) From: Jameson Graef Rollins To: Notmuch Mail Subject: [PATCH 2/3] emacs: message/thread deletion by adding "deleted" tag Date: Tue, 17 Jan 2012 11:02:48 -0800 Message-Id: <1326826969-23545-2-git-send-email-jrollins@finestructure.net> X-Mailer: git-send-email 1.7.7.3 In-Reply-To: <1326826969-23545-1-git-send-email-jrollins@finestructure.net> References: <87vcoaywyu.fsf@servo.finestructure.net> <1326826969-23545-1-git-send-email-jrollins@finestructure.net> 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: Tue, 17 Jan 2012 19:02:53 -0000 --- emacs/notmuch-show.el | 46 ++++++++++++++++++++++++++++++++++++++++++++++ emacs/notmuch.el | 8 ++++++++ 2 files changed, 54 insertions(+), 0 deletions(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index c1d721e..141241d 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -1506,6 +1506,52 @@ removed)." (notmuch-show-archive-message) (notmuch-show-next-open-message t)) +(defun notmuch-show-delete-thread (&optional undelete) + "Delete each message in thread. + +Delete each message currently shown by adding the \"deleted\" tag +to each. If a prefix argument is given, the messages will be +\"undeleted\" (ie. the \"deleted\" tag will be removed instead of +added). + +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) + (if undelete + (notmuch-show-remove-tag-thread "deleted") + (notmuch-show-add-tag-thread "deleted"))) + +(defun notmuch-show-delete-thread-then-next () + "Delete each message in thread, then show next thread from search." + (interactive) + (notmuch-show-delete-thread) + (notmuch-show-next-thread t)) + +(defun notmuch-show-delete-thread-then-exit () + "Delete each message in thread, then exit back to search results." + (interactive) + (notmuch-show-delete-thread) + (notmuch-show-next-thread)) + +(defun notmuch-show-delete-message (&optional undelete) + "Delete the current message (add \"deleted\" tag). + +If a prefix argument is given, the message will be +\"undeleted\" (ie. the \"deleted\" tag will be removed instead of +added)." + (interactive) + (if undelete + (notmuch-show-remove-tag "deleted") + (notmuch-show-add-tag "deleted"))) + +(defun notmuch-show-delete-message-then-next () + "Archive the current message, then show next thread from search." + (interactive) + (notmuch-show-delete-message) + (notmuch-show-next-open-message t)) + (defun notmuch-show-stash-cc () "Copy CC field of current message to kill-ring." (interactive) diff --git a/emacs/notmuch.el b/emacs/notmuch.el index 67ecd3a..2acb31b 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -619,6 +619,14 @@ This function advances the next thread when finished." (notmuch-search-remove-tag-thread "inbox") (notmuch-search-next-thread)) +(defun notmuch-search-delete-thread () + "Delete the currently selected thread (add \"deleted\" tag). + +This function advances the next thread when finished." + (interactive) + (notmuch-search-add-tag-thread "deleted") + (notmuch-search-next-thread)) + (defvar notmuch-search-process-filter-data nil "Data that has not yet been processed.") (make-variable-buffer-local 'notmuch-search-process-filter-data) -- 1.7.7.3