Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 46 / a2f5e54c76e681f78eb5a0e01407af7acd95f4
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 B1440431FAF\r
6         for <notmuch@notmuchmail.org>; Sat, 14 Apr 2012 13:49:11 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -2.3\r
10 X-Spam-Level: \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 9lKSyBEFQf0w for <notmuch@notmuchmail.org>;\r
16         Sat, 14 Apr 2012 13:49:09 -0700 (PDT)\r
17 Received: from outgoing-mail.its.caltech.edu (outgoing-mail.its.caltech.edu\r
18         [131.215.239.19])\r
19         by olra.theworths.org (Postfix) with ESMTP id DD0BF431FAE\r
20         for <notmuch@notmuchmail.org>; Sat, 14 Apr 2012 13:49:09 -0700 (PDT)\r
21 Received: from fire-doxen.imss.caltech.edu (localhost [127.0.0.1])\r
22         by fire-doxen-postvirus (Postfix) with ESMTP id 7C039328031\r
23         for <notmuch@notmuchmail.org>; Sat, 14 Apr 2012 13:49:09 -0700 (PDT)\r
24 X-Spam-Scanned: at Caltech-IMSS on fire-doxen by amavisd-new\r
25 Received: from finestructure.net (unknown [76.89.193.65])\r
26         (Authenticated sender: jrollins)\r
27         by fire-doxen-submit (Postfix) with ESMTP id A11D032802A\r
28         for <notmuch@notmuchmail.org>; Sat, 14 Apr 2012 13:49:07 -0700 (PDT)\r
29 Received: by finestructure.net (Postfix, from userid 1000)\r
30         id 3FD2745D; Sat, 14 Apr 2012 13:49:07 -0700 (PDT)\r
31 From: Jameson Graef Rollins <jrollins@finestructure.net>\r
32 To: Notmuch Mail <notmuch@notmuchmail.org>\r
33 Subject: [PATCH v2 2/5] emacs: allow notmuch-tag to accept string inputs and\r
34         prompt for tags\r
35 Date: Sat, 14 Apr 2012 13:49:07 -0700\r
36 Message-Id: <1334436547-10260-1-git-send-email-jrollins@finestructure.net>\r
37 X-Mailer: git-send-email 1.7.9.5\r
38 In-Reply-To: <1334429574-12918-3-git-send-email-jrollins@finestructure.net>\r
39 References: <1334429574-12918-3-git-send-email-jrollins@finestructure.net>\r
40 X-BeenThere: notmuch@notmuchmail.org\r
41 X-Mailman-Version: 2.1.13\r
42 Precedence: list\r
43 List-Id: "Use and development of the notmuch mail system."\r
44         <notmuch.notmuchmail.org>\r
45 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
46         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
47 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
48 List-Post: <mailto:notmuch@notmuchmail.org>\r
49 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
50 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
51         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
52 X-List-Received-Date: Sat, 14 Apr 2012 20:49:11 -0000\r
53 \r
54 notmuch-tag is extended to accept various formats of the tag changes.\r
55 In particular, user prompting for tag changes is now incorporated\r
56 here, so it is common for modes.\r
57 \r
58 The tag binary and the notmuch-{before,after}-tag-hooks are only\r
59 called if tag changes is non-nil.\r
60 \r
61 In all cases tag-changes is returned as a list.\r
62 ---\r
63 This addresses Mark Walters concerns in regards to a code comment.\r
64 \r
65  emacs/notmuch-tag.el |   20 +++++++++++++++-----\r
66  1 file changed, 15 insertions(+), 5 deletions(-)\r
67 \r
68 diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el\r
69 index c25cff8..0c0fc87 100644\r
70 --- a/emacs/notmuch-tag.el\r
71 +++ b/emacs/notmuch-tag.el\r
72 @@ -108,18 +108,26 @@ from TAGS if present."\r
73            (error "Changed tag must be of the form `+this_tag' or `-that_tag'")))))\r
74      (sort result-tags 'string<)))\r
75  \r
76 -(defun notmuch-tag (query &rest tag-changes)\r
77 +(defun notmuch-tag (query &optional tag-changes)\r
78    "Add/remove tags in TAG-CHANGES to messages matching QUERY.\r
79  \r
80 -TAG-CHANGES should be a list of strings of the form \"+tag\" or\r
81 -\"-tag\" and QUERY should be a string containing the\r
82 -search-query.\r
83 +QUERY should be a string containing the search-terms.\r
84 +TAG-CHANGES can take multiple forms.  If TAG-CHANGES is a list of\r
85 +strings of the form \"+tag\" or \"-tag\" then those are the tag\r
86 +changes applied.  If TAG-CHANGES is a string then it is\r
87 +interpreted as a single tag change.  If TAG-CHANGES is the string\r
88 +\"-\" or \"+\", or null, then the user is prompted to enter the\r
89 +tag changes.\r
90  \r
91  Note: Other code should always use this function alter tags of\r
92  messages instead of running (notmuch-call-notmuch-process \"tag\" ..)\r
93  directly, so that hooks specified in notmuch-before-tag-hook and\r
94  notmuch-after-tag-hook will be run."\r
95    ;; Perform some validation\r
96 +  (if (string-or-null-p tag-changes)\r
97 +      (if (or (string= tag-changes "-") (string= tag-changes "+") (null tag-changes))\r
98 +         (setq tag-changes (notmuch-read-tag-changes tag-changes query))\r
99 +       (setq tag-changes (list tag-changes))))\r
100    (mapc (lambda (tag-change)\r
101           (unless (string-match-p "^[-+]\\S-+$" tag-change)\r
102             (error "Tag must be of the form `+this_tag' or `-that_tag'")))\r
103 @@ -128,7 +136,9 @@ notmuch-after-tag-hook will be run."\r
104      (run-hooks 'notmuch-before-tag-hook)\r
105      (apply 'notmuch-call-notmuch-process "tag"\r
106            (append tag-changes (list "--" query)))\r
107 -    (run-hooks 'notmuch-after-tag-hook)))\r
108 +    (run-hooks 'notmuch-after-tag-hook))\r
109 +  ;; in all cases we return tag-changes as a list\r
110 +  tag-changes)\r
111  \r
112  ;;\r
113  \r
114 -- \r
115 1.7.9.5\r
116 \r