1 Return-Path: <jrollins@finestructure.net>
\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 5EBCC431FC2
\r
6 for <notmuch@notmuchmail.org>; Mon, 2 Apr 2012 01:21:02 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id fplpA12xpdVs for <notmuch@notmuchmail.org>;
\r
16 Mon, 2 Apr 2012 01:21:01 -0700 (PDT)
\r
17 Received: from outgoing-mail.its.caltech.edu (outgoing-mail.its.caltech.edu
\r
19 by olra.theworths.org (Postfix) with ESMTP id 0A9A7431FD6
\r
20 for <notmuch@notmuchmail.org>; Mon, 2 Apr 2012 01:21:01 -0700 (PDT)
\r
21 Received: from earth-doxen.imss.caltech.edu (localhost [127.0.0.1])
\r
22 by earth-doxen-postvirus (Postfix) with ESMTP id C10B966E00EF
\r
23 for <notmuch@notmuchmail.org>; Mon, 2 Apr 2012 01:20:58 -0700 (PDT)
\r
24 X-Spam-Scanned: at Caltech-IMSS on earth-doxen by amavisd-new
\r
25 Received: from finestructure.net (unknown [76.89.193.65])
\r
26 (Authenticated sender: jrollins)
\r
27 by earth-doxen-submit (Postfix) with ESMTP id EBDB966E00E4
\r
28 for <notmuch@notmuchmail.org>; Mon, 2 Apr 2012 01:20:56 -0700 (PDT)
\r
29 Received: by finestructure.net (Postfix, from userid 1000)
\r
30 id 94FF019C4; Mon, 2 Apr 2012 01:20:56 -0700 (PDT)
\r
31 From: Jameson Graef Rollins <jrollins@finestructure.net>
\r
32 To: Notmuch Mail <notmuch@notmuchmail.org>
\r
33 Subject: [PATCH 3/6] emacs: modify notmuch-search-tag to not prompt if tags
\r
34 provided as argument
\r
35 Date: Mon, 2 Apr 2012 01:20:50 -0700
\r
36 Message-Id: <1333354853-25729-4-git-send-email-jrollins@finestructure.net>
\r
37 X-Mailer: git-send-email 1.7.9.1
\r
38 In-Reply-To: <1333354853-25729-3-git-send-email-jrollins@finestructure.net>
\r
39 References: <1333354853-25729-1-git-send-email-jrollins@finestructure.net>
\r
40 <1333354853-25729-2-git-send-email-jrollins@finestructure.net>
\r
41 <1333354853-25729-3-git-send-email-jrollins@finestructure.net>
\r
42 X-BeenThere: notmuch@notmuchmail.org
\r
43 X-Mailman-Version: 2.1.13
\r
45 List-Id: "Use and development of the notmuch mail system."
\r
46 <notmuch.notmuchmail.org>
\r
47 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
48 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
49 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
50 List-Post: <mailto:notmuch@notmuchmail.org>
\r
51 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
52 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
53 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
54 X-List-Received-Date: Mon, 02 Apr 2012 08:21:02 -0000
\r
56 If the argument is a full string or a list, the function will assume
\r
57 this is a tag string or list and will not prompt the user. If the
\r
58 argument is nil or the exact strings "-" or "+" then the user will be
\r
61 The function doc is updated accordingly.
\r
63 emacs/notmuch.el | 16 ++++++++++++----
\r
64 1 files changed, 12 insertions(+), 4 deletions(-)
\r
66 diff --git a/emacs/notmuch.el b/emacs/notmuch.el
\r
67 index 0ab8fc2..3b78584 100644
\r
68 --- a/emacs/notmuch.el
\r
69 +++ b/emacs/notmuch.el
\r
70 @@ -646,13 +646,21 @@ added or removed for all threads in the region from BEG to END."
\r
71 (notmuch-update-tags (notmuch-search-get-tags) tag-changes))
\r
74 -(defun notmuch-search-tag (&optional initial-input)
\r
75 - "Change tags for the currently selected thread or region."
\r
76 +(defun notmuch-search-tag (&optional tags)
\r
77 + "Change tags for the currently selected thread or region.
\r
79 +If TAGS is a string or list it will be interpreted as tags to
\r
80 +apply to the selected messages. If TAGS is nil or either of the
\r
81 +strings `-' or `+' the user will be prompted to enter tags (with
\r
84 (let* ((beg (if (region-active-p) (region-beginning) (point)))
\r
85 (end (if (region-active-p) (region-end) (point)))
\r
86 - (search-string (notmuch-search-find-thread-id-region-search beg end))
\r
87 - (tags (notmuch-read-tag-changes initial-input search-string)))
\r
88 + (search-string (notmuch-search-find-thread-id-region-search beg end)))
\r
89 + (if (string-or-null-p tags)
\r
90 + (if (or (string= tags "-") (string= tags "+") (eq tags nil))
\r
91 + (setq tags (notmuch-read-tag-changes tags search-string))
\r
92 + (setq tags (list tags))))
\r
93 (apply 'notmuch-search-tag-region beg end tags)))
\r
95 (defun notmuch-search-add-tag ()
\r