Re: thread merge/split proposal
[notmuch-archives.git] / 42 / b0121e6c391d5b81df248f7ca6a1988b0595cb
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 195B6417325\r
6         for <notmuch@notmuchmail.org>; Mon, 30 Jan 2012 20:56: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 ITdEHPeSX0PS for <notmuch@notmuchmail.org>;\r
17         Mon, 30 Jan 2012 20:56: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 B099241ED91\r
22         for <notmuch@notmuchmail.org>; Mon, 30 Jan 2012 20:56:00 -0800 (PST)\r
23 Received: by mail-bk0-f53.google.com with SMTP id 11so2152468bke.26\r
24         for <notmuch@notmuchmail.org>; Mon, 30 Jan 2012 20:56:00 -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=6OBNRk2FhWOO5ldIxvA3mkHEDfP1ByFVeBAjEP0ddyg=;\r
28         b=pmOLuwv8td6QrAZhbxynhPLcOw1e7bC3UwHwi4WXTPexKhukF+xBEha8/9xA385aX7\r
29         bKiLQTYKwfo4haY6UCDV9fYbN23J/p/AgpjOZIYNTyBFC2VHhs8an3nXEcwayJu001V3\r
30         xLPXo6pP4Oo5WtEhLhD4SHX/jD7zOIJuA8UlY=\r
31 Received: by 10.205.131.13 with SMTP id ho13mr10260406bkc.58.1327985760361;\r
32         Mon, 30 Jan 2012 20:56:00 -0800 (PST)\r
33 Received: from localhost ([91.144.186.21])\r
34         by mx.google.com with ESMTPS id o26sm36264418bko.14.2012.01.30.20.55.59\r
35         (version=TLSv1/SSLv3 cipher=OTHER);\r
36         Mon, 30 Jan 2012 20:55:59 -0800 (PST)\r
37 From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>\r
38 To: notmuch@notmuchmail.org\r
39 Subject: [PATCH v4 08/12] emacs: separate history for operations which accept\r
40         single and multiple tags\r
41 Date: Tue, 31 Jan 2012 08:54:22 +0400\r
42 Message-Id: <1327985666-29191-9-git-send-email-dmitry.kurochkin@gmail.com>\r
43 X-Mailer: git-send-email 1.7.9\r
44 In-Reply-To: <1327985666-29191-1-git-send-email-dmitry.kurochkin@gmail.com>\r
45 References: <1327901644-15799-1-git-send-email-dmitry.kurochkin@gmail.com>\r
46         <1327985666-29191-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: Tue, 31 Jan 2012 04:56:02 -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 7d06109..0a3bd17 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.9\r
114 \r