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 03FBA431FC0 for ; Sat, 8 Dec 2012 04:48:47 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0.201 X-Spam-Level: X-Spam-Status: No, score=0.201 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] 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 70krOiZLg1TF for ; Sat, 8 Dec 2012 04:48:45 -0800 (PST) Received: from mail-we0-f181.google.com (mail-we0-f181.google.com [74.125.82.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id BAFEE431FCB for ; Sat, 8 Dec 2012 04:48:41 -0800 (PST) Received: by mail-we0-f181.google.com with SMTP id t11so646760wey.26 for ; Sat, 08 Dec 2012 04:48:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=GjTVtjKgKOmXFfRC0R8QsVBAQbqd6vADxbEHk+uWDmw=; b=ESegsOKxCFdD2BK/78qNSMGY79w1Cg5nlYWFMt0IIDQ6AKTLfWCzo6PEQwwo20ochO /WFsrgvp30ZpXd1DC/ytpA363Cw4oHiYDITB3rl5iT7w95pAsD2MfOA4v7yo/KJxDV8C lX/NzD153pDGQB6QT+vgGtkCY2hQnfhpoefiYucGcJWRN4UVnatrtqZKCB5k0vKhyiXc FgdXvOXIdbOngKEOjRn0ENlvGJgBliOGaTkOyFiFDncKPmLR7YE0/TPJAGa8hSdPV2T5 zxaf8cg3ykzO3GjE9tCr5XM5likdTc8dijx8zOuK/BV0Tcdoc677XYihuugd+AUc0tZS COnQ== Received: by 10.180.104.69 with SMTP id gc5mr2952325wib.13.1354970921416; Sat, 08 Dec 2012 04:48:41 -0800 (PST) Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31]) by mx.google.com with ESMTPS id b1sm2408296wix.11.2012.12.08.04.48.39 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 08 Dec 2012 04:48:40 -0800 (PST) From: Mark Walters To: notmuch@notmuchmail.org Subject: [PATCH 2/2] contrib: pick: thread tagging (including archiving) implemented Date: Sat, 8 Dec 2012 12:48:34 +0000 Message-Id: <1354970914-18342-3-git-send-email-markwalters1009@gmail.com> X-Mailer: git-send-email 1.7.9.1 In-Reply-To: <1354970914-18342-1-git-send-email-markwalters1009@gmail.com> References: <1354970914-18342-1-git-send-email-markwalters1009@gmail.com> 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: Sat, 08 Dec 2012 12:48:47 -0000 Previously pick had no actions based on the entire thread: this adds some. Note in this version '*' is bound to `tag thread' which is not consistent with search or show. However it still might be the most natural thing (as it is similar to running * in the show pane). --- contrib/notmuch-pick/notmuch-pick.el | 30 ++++++++++++++++++++++++++++++ 1 files changed, 30 insertions(+), 0 deletions(-) diff --git a/contrib/notmuch-pick/notmuch-pick.el b/contrib/notmuch-pick/notmuch-pick.el index 77e15bb..23442b9 100644 --- a/contrib/notmuch-pick/notmuch-pick.el +++ b/contrib/notmuch-pick/notmuch-pick.el @@ -173,6 +173,7 @@ (define-key map "q" 'notmuch-pick-quit) (define-key map "x" 'notmuch-pick-quit) (define-key map "?" 'notmuch-help) + (define-key map "A" 'notmuch-pick-archive-thread) (define-key map "a" 'notmuch-pick-archive-message-then-next) (define-key map "=" 'notmuch-pick-refresh-view) (define-key map "s" 'notmuch-pick-to-search) @@ -188,6 +189,7 @@ (define-key map "|" 'notmuch-pick-pipe-message) (define-key map "-" 'notmuch-pick-remove-tag) (define-key map "+" 'notmuch-pick-add-tag) + (define-key map "*" 'notmuch-pick-tag-thread) (define-key map " " 'notmuch-pick-scroll-or-next) (define-key map "b" 'notmuch-pick-scroll-message-window-back) map)) @@ -579,6 +581,34 @@ than only the current message." "Return a search string for all message ids of messages in the current thread." (mapconcat 'identity (notmuch-pick-get-messages-ids-thread) " or ")) + +(defun notmuch-pick-tag-thread (&optional tag-changes) + "Tag all messages in the current thread" + (interactive) + (setq tag-changes (funcall 'notmuch-tag (notmuch-pick-get-messages-ids-thread-search) tag-changes)) + (notmuch-pick-thread-mapc + (lambda () (notmuch-pick-tag-update-display tag-changes)))) + +(defun notmuch-pick-archive-thread (&optional unarchive) + "Archive each message in thread. + +Archive each message currently shown by applying the tag changes +in `notmuch-archive-tags' to each (remove the \"inbox\" tag by +default). If a prefix argument is given, the messages will be +\"unarchived\", i.e. the tag changes in `notmuch-archive-tags' +will be reversed. + +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 "P") + (when notmuch-archive-tags + (notmuch-pick-tag-thread + (notmuch-tag-change-list notmuch-archive-tags unarchive)))) + +;; Functions below here display the pick buffer itself. + (defun notmuch-pick-clean-address (address) "Try to clean a single email ADDRESS for display. Return AUTHOR_NAME if present, otherwise return AUTHOR_EMAIL. Return -- 1.7.9.1