[PATCH] fixup! cli: add standard option processing to config, help and setup
[notmuch-archives.git] / 3a / d449f049fb67b21fa481c8e43183630f8ffea8
1 Return-Path: <m.walters@qmul.ac.uk>\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 77AE5431FC0\r
6         for <notmuch@notmuchmail.org>; Tue,  7 Aug 2012 09:32:27 -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: -1.098\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5\r
12         tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,\r
13         NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] 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 LOsJSv3rGRRL for <notmuch@notmuchmail.org>;\r
17         Tue,  7 Aug 2012 09:32:27 -0700 (PDT)\r
18 Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])\r
19         (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id BE193431FAF\r
22         for <notmuch@notmuchmail.org>; Tue,  7 Aug 2012 09:32:26 -0700 (PDT)\r
23 Received: from smtp.qmul.ac.uk ([138.37.6.40])\r
24         by mail2.qmul.ac.uk with esmtp (Exim 4.71)\r
25         (envelope-from <m.walters@qmul.ac.uk>)\r
26         id 1Symhl-000445-0b; Tue, 07 Aug 2012 17:32:25 +0100\r
27 Received: from 94-192-233-223.zone6.bethere.co.uk ([94.192.233.223]\r
28         helo=localhost)\r
29         by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.69)\r
30         (envelope-from <m.walters@qmul.ac.uk>)\r
31         id 1Symhk-0004QT-Nf; Tue, 07 Aug 2012 17:32:24 +0100\r
32 From: Mark Walters <markwalters1009@gmail.com>\r
33 To: Austin Clements <amdragon@MIT.EDU>\r
34 Subject: [PATCH v2] emacs: notmuch search bugfix\r
35 In-Reply-To: <20120807160352.GA2811@mit.edu>\r
36 References: <87boinpqfg.fsf@qmul.ac.uk> <20120806234732.GM22601@mit.edu>\r
37         <87pq72bthc.fsf@qmul.ac.uk> <20120807160352.GA2811@mit.edu>\r
38 User-Agent: Notmuch/0.13.2+96~g634443c (http://notmuchmail.org) Emacs/23.4.1\r
39         (x86_64-pc-linux-gnu)\r
40 Date: Tue, 07 Aug 2012 17:32:18 +0100\r
41 Message-ID: <877gta1x4d.fsf@qmul.ac.uk>\r
42 MIME-Version: 1.0\r
43 Content-Type: text/plain; charset=us-ascii\r
44 X-Sender-Host-Address: 94.192.233.223\r
45 X-QM-SPAM-Info: Sender has good ham record.  :)\r
46 X-QM-Body-MD5: 5a34d4ccae813180489b98ef05114659 (of first 20000 bytes)\r
47 X-SpamAssassin-Score: -1.8\r
48 X-SpamAssassin-SpamBar: -\r
49 X-SpamAssassin-Report: The QM spam filters have analysed this message to\r
50         determine if it is\r
51         spam. We require at least 5.0 points to mark a message as spam.\r
52         This message scored -1.8 points.\r
53         Summary of the scoring: \r
54         * -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/,\r
55         *      medium trust\r
56         *      [138.37.6.40 listed in list.dnswl.org]\r
57         * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\r
58         provider *      (markwalters1009[at]gmail.com)\r
59         * -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay\r
60         *      domain\r
61         *  0.5 AWL AWL: From: address is in the auto white-list\r
62 X-QM-Scan-Virus: ClamAV says the message is clean\r
63 Cc: notmuch@notmuchmail.org\r
64 X-BeenThere: notmuch@notmuchmail.org\r
65 X-Mailman-Version: 2.1.13\r
66 Precedence: list\r
67 List-Id: "Use and development of the notmuch mail system."\r
68         <notmuch.notmuchmail.org>\r
69 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
70         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
71 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
72 List-Post: <mailto:notmuch@notmuchmail.org>\r
73 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
74 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
75         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
76 X-List-Received-Date: Tue, 07 Aug 2012 16:32:27 -0000\r
77 \r
78 \r
79 The recent change to use json for notmuch-search.el introduced a bug\r
80 in the code for keeping position on refresh. The problem is a\r
81 comparison between (plist-get result :thread) and a thread-id returned\r
82 by notmuch-search-find-thread-id: the latter is prefixed with\r
83 "thread:"\r
84 \r
85 We fix this by adding an option to notmuch-search-find-thread-id to\r
86 return the bare thread-id. It appears that notmuch-search-refresh-view\r
87 is the only caller of notmuch-search that supplies a thread-id so this\r
88 change should be safe (but could theoretically break users .emacs\r
89 functions).\r
90 ---\r
91 \r
92 I think this implements all of Austin's suggestions, and it adds a short\r
93 remark to NEWS (since in unlikely cases it could break users' functions)\r
94 and updates the docstring for notmuch-search. \r
95 \r
96 Best wishes\r
97 \r
98 Mark\r
99 \r
100  NEWS             |    3 +++\r
101  emacs/notmuch.el |   12 +++++++-----\r
102  2 files changed, 10 insertions(+), 5 deletions(-)\r
103 \r
104 diff --git a/NEWS b/NEWS\r
105 index 761b2c1..9916c91 100644\r
106 --- a/NEWS\r
107 +++ b/NEWS\r
108 @@ -55,6 +55,9 @@ user-specified formatting\r
109    you've customized this variable, you may have to change your date\r
110    format from `"%s "` to `"%12s "`.\r
111  \r
112 +The thread-id for the `target-thread` argument for `notmuch-search` should\r
113 +now be supplied without the "thread:" prefix.\r
114 +\r
115  Notmuch 0.13.2 (2012-06-02)\r
116  ===========================\r
117  \r
118 diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
119 index d2d82a9..7b61e9b 100644\r
120 --- a/emacs/notmuch.el\r
121 +++ b/emacs/notmuch.el\r
122 @@ -475,10 +475,12 @@ BEG."\r
123         (push (plist-get (notmuch-search-get-result pos) property) output)))\r
124      output))\r
125  \r
126 -(defun notmuch-search-find-thread-id ()\r
127 -  "Return the thread for the current thread"\r
128 +(defun notmuch-search-find-thread-id (&optional bare)\r
129 +  "Return the thread for the current thread\r
130 +\r
131 +If BARE is set then do not prefix with \"thread:\""\r
132    (let ((thread (plist-get (notmuch-search-get-result) :thread)))\r
133 -    (when thread (concat "thread:" thread))))\r
134 +    (when thread (concat (unless bare "thread:") thread))))\r
135  \r
136  (defun notmuch-search-find-thread-id-region (beg end)\r
137    "Return a list of threads for the current region"\r
138 @@ -936,7 +938,7 @@ If `query' is nil, it is read interactively from the minibuffer.\r
139  Other optional parameters are used as follows:\r
140  \r
141    oldest-first: A Boolean controlling the sort order of returned threads\r
142 -  target-thread: A thread ID (with the thread: prefix) that will be made\r
143 +  target-thread: A thread ID (without the thread: prefix) that will be made\r
144                   current if it appears in the search results.\r
145    target-line: The line number to move to if the target thread does not\r
146                 appear in the search results."\r
147 @@ -993,7 +995,7 @@ same relative position within the new buffer."\r
148    (interactive)\r
149    (let ((target-line (line-number-at-pos))\r
150         (oldest-first notmuch-search-oldest-first)\r
151 -       (target-thread (notmuch-search-find-thread-id))\r
152 +       (target-thread (notmuch-search-find-thread-id 'bare))\r
153         (query notmuch-search-query-string)\r
154         (continuation notmuch-search-continuation))\r
155      (notmuch-kill-this-buffer)\r
156 -- \r
157 1.7.9.1\r
158 \r