[PATCH v4 5/7] Introduce _notmuch_message_has_term()
[notmuch-archives.git] / 09 / c46a581841186e3a40effceaf2f556d203ddb7
1 Return-Path: <dmitry.kurochkin@gmail.com>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 77204429E52\r
6         for <notmuch@notmuchmail.org>; Sun, 29 Jan 2012 18:28:02 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.799\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
13         FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id bI2xY5EvWP-J for <notmuch@notmuchmail.org>;\r
17         Sun, 29 Jan 2012 18:28:01 -0800 (PST)\r
18 Received: from mail-bk0-f53.google.com (mail-bk0-f53.google.com\r
19         [209.85.214.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id 3919E429E5B\r
22         for <notmuch@notmuchmail.org>; Sun, 29 Jan 2012 18:27:51 -0800 (PST)\r
23 Received: by mail-bk0-f53.google.com with SMTP id 11so960260bke.26\r
24         for <notmuch@notmuchmail.org>; Sun, 29 Jan 2012 18:27:51 -0800 (PST)\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
26         h=from:to:subject:date:message-id:x-mailer:in-reply-to:references;\r
27         bh=gAlKgeckCO9dksbWIHV8TRRa5OpPO7JH2qsf2d2H2w0=;\r
28         b=csP8Mc+PbxwngnkatySnGIhq6erXBusBdiKAwBVfmejTUtmbcKJ4GvNqHGQDG1ti38\r
29         YQyKCfdc9YEK8qLGwxCqwqUXiqRUSQOshMwCobJIeT18F2NtUBAE2snqlqtYNbmywgqo\r
30         3PuiBbmx//dq6oKU/AJfh+lW6Gr77wWe7QEGM=\r
31 Received: by 10.205.131.13 with SMTP id ho13mr7829154bkc.58.1327890470974;\r
32         Sun, 29 Jan 2012 18:27:50 -0800 (PST)\r
33 Received: from localhost ([91.144.186.21])\r
34         by mx.google.com with ESMTPS id o26sm28043469bko.14.2012.01.29.18.27.50\r
35         (version=TLSv1/SSLv3 cipher=OTHER);\r
36         Sun, 29 Jan 2012 18:27:50 -0800 (PST)\r
37 From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>\r
38 To: notmuch@notmuchmail.org\r
39 Subject: [PATCH v2 08/13] emacs: separate history for operations which accept\r
40         single and multiple tags\r
41 Date: Mon, 30 Jan 2012 06:26:17 +0400\r
42 Message-Id: <1327890382-548-9-git-send-email-dmitry.kurochkin@gmail.com>\r
43 X-Mailer: git-send-email 1.7.8.3\r
44 In-Reply-To: <1327890382-548-1-git-send-email-dmitry.kurochkin@gmail.com>\r
45 References: <1327725684-5887-1-git-send-email-dmitry.kurochkin@gmail.com>\r
46         <1327890382-548-1-git-send-email-dmitry.kurochkin@gmail.com>\r
47 X-BeenThere: notmuch@notmuchmail.org\r
48 X-Mailman-Version: 2.1.13\r
49 Precedence: list\r
50 List-Id: "Use and development of the notmuch mail system."\r
51         <notmuch.notmuchmail.org>\r
52 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
53         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
54 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
55 List-Post: <mailto:notmuch@notmuchmail.org>\r
56 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
57 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
58         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
59 X-List-Received-Date: Mon, 30 Jan 2012 02:28:03 -0000\r
60 \r
61 Some tag-related operations accept a single tag without prefix\r
62 (`notmuch-select-tag-with-completion'), others accept multiple tags\r
63 prefixed with '+' or '-' (`notmuch-read-tag-changes').  Before the\r
64 change, both functions used a single default minibuffer history.  This\r
65 is inconvenient because you have to skip options with incompatible\r
66 format when going through the history.  The patch adds separate\r
67 history lists for the two functions.  Note that functions that accept\r
68 the same input format (e.g. "+", "-", "*") share the history list as\r
69 before.\r
70 ---\r
71  emacs/notmuch.el |   13 +++++++++++--\r
72  1 files changed, 11 insertions(+), 2 deletions(-)\r
73 \r
74 diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
75 index 90627dc..5adcac5 100644\r
76 --- a/emacs/notmuch.el\r
77 +++ b/emacs/notmuch.el\r
78 @@ -76,6 +76,14 @@ For example:\r
79  (defvar notmuch-query-history nil\r
80    "Variable to store minibuffer history for notmuch queries")\r
81  \r
82 +(defvar notmuch-select-tag-history nil\r
83 +  "Variable to store minibuffer history for\r
84 +`notmuch-select-tag-with-completion' function.")\r
85 +\r
86 +(defvar notmuch-read-tag-changes-history nil\r
87 +  "Variable to store minibuffer history for\r
88 +`notmuch-read-tag-changes' function.")\r
89 +\r
90  (defun notmuch-tag-completions (&optional search-terms)\r
91    (split-string\r
92     (with-output-to-string\r
93 @@ -86,7 +94,7 @@ For example:\r
94  \r
95  (defun notmuch-select-tag-with-completion (prompt &rest search-terms)\r
96    (let ((tag-list (notmuch-tag-completions search-terms)))\r
97 -    (completing-read prompt tag-list)))\r
98 +    (completing-read prompt tag-list nil nil nil 'notmuch-select-tag-history)))\r
99  \r
100  (defun notmuch-read-tag-changes (&optional initial-input &rest search-terms)\r
101    (let* ((all-tag-list (notmuch-tag-completions))\r
102 @@ -106,7 +114,8 @@ For example:\r
103             (define-key map " " 'self-insert-command)\r
104             map)))\r
105      (delete "" (completing-read-multiple "Tags (+add -drop): "\r
106 -               tag-list nil nil initial-input))))\r
107 +               tag-list nil nil initial-input\r
108 +               'notmuch-read-tag-changes-history))))\r
109  \r
110  (defun notmuch-update-tags (tags tag-changes)\r
111    "Return a copy of TAGS with additions and removals from TAG-CHANGES.\r
112 -- \r
113 1.7.8.3\r
114 \r