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 28E40431FBC for ; Tue, 24 Nov 2009 20:05:44 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org 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 eE1VO8el3woL for ; Tue, 24 Nov 2009 20:05:43 -0800 (PST) Received: from mail-fx0-f214.google.com (mail-fx0-f214.google.com [209.85.220.214]) by olra.theworths.org (Postfix) with ESMTP id 9E3A9431FAE for ; Tue, 24 Nov 2009 20:05:43 -0800 (PST) Received: by fxm6 with SMTP id 6so7558174fxm.0 for ; Tue, 24 Nov 2009 20:05:42 -0800 (PST) Received: by 10.103.78.38 with SMTP id f38mr3145143mul.72.1259121942518; Tue, 24 Nov 2009 20:05:42 -0800 (PST) Received: from x61s.janakj (r2c34.net.upc.cz [62.245.66.34]) by mx.google.com with ESMTPS id j2sm726727mue.5.2009.11.24.20.05.41 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 24 Nov 2009 20:05:41 -0800 (PST) Received: by x61s.janakj (Postfix, from userid 1000) id BFC5D440651; Wed, 25 Nov 2009 05:05:39 +0100 (CET) From: Jan Janak To: notmuch@notmuchmail.org Date: Wed, 25 Nov 2009 05:05:39 +0100 Message-Id: <1259121939-23040-1-git-send-email-jan@ryngle.com> X-Mailer: git-send-email 1.6.3.3 In-Reply-To: <1258935056-9746-3-git-send-email-jan@ryngle.com> References: <1258935056-9746-3-git-send-email-jan@ryngle.com> Subject: [notmuch] [PATCH] notmuch.el: When removing tags, offer only those a msg/thread has set. X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.12 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, 25 Nov 2009 04:05:44 -0000 When removing a tag from a message or thread, build a completion buffer which contains only tags that the message or thread has really set. Signed-off-by: Jan Janak --- notmuch.el | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/notmuch.el b/notmuch.el index a9f534b..9594f63 100644 --- a/notmuch.el +++ b/notmuch.el @@ -137,11 +137,11 @@ within the current window." (or (memq prop buffer-invisibility-spec) (assq prop buffer-invisibility-spec))))) -(defun notmuch-select-tag-with-completion (prompt) +(defun notmuch-select-tag-with-completion (prompt &rest search-terms) (let ((tag-list (with-output-to-string (with-current-buffer standard-output - (call-process notmuch-command nil t nil "search-tags"))))) + (apply 'call-process notmuch-command nil t nil "search-tags" search-terms))))) (completing-read prompt (split-string tag-list "\n+" t) nil nil nil))) (defun notmuch-show-next-line () @@ -218,7 +218,7 @@ Unlike builtin `next-line' this version accepts no arguments." (defun notmuch-show-remove-tag (&rest toremove) "Remove a tag from the current message." (interactive - (list (notmuch-select-tag-with-completion "Tag to remove: "))) + (list (notmuch-select-tag-with-completion "Tag to remove: " (notmuch-show-get-message-id)))) (let ((tags (notmuch-show-get-tags))) (if (intersection tags toremove :test 'string=) (progn @@ -968,7 +968,7 @@ and will also appear in a buffer named \"*Notmuch errors*\"." (defun notmuch-search-remove-tag (tag) (interactive - (list (notmuch-select-tag-with-completion "Tag to remove: "))) + (list (notmuch-select-tag-with-completion "Tag to remove: " (notmuch-search-find-thread-id)))) (notmuch-call-notmuch-process "tag" (concat "-" tag) (notmuch-search-find-thread-id)) (notmuch-search-set-tags (delete tag (notmuch-search-get-tags)))) -- 1.6.3.3