1 Return-Path: <markwalters1009@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 150C0431FB6
\r
6 for <notmuch@notmuchmail.org>; Thu, 10 Jan 2013 03:15:01 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0.201 tagged_above=-999 required=5
\r
12 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
\r
13 FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,
\r
14 RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\r
15 Received: from olra.theworths.org ([127.0.0.1])
\r
16 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
17 with ESMTP id lJ3ZWrm7k-vU for <notmuch@notmuchmail.org>;
\r
18 Thu, 10 Jan 2013 03:15:00 -0800 (PST)
\r
19 Received: from mail-wi0-f180.google.com (mail-wi0-f180.google.com
\r
20 [209.85.212.180]) (using TLSv1 with cipher RC4-SHA (128/128 bits))
\r
21 (No client certificate requested)
\r
22 by olra.theworths.org (Postfix) with ESMTPS id 45BFA431FAF
\r
23 for <notmuch@notmuchmail.org>; Thu, 10 Jan 2013 03:15:00 -0800 (PST)
\r
24 Received: by mail-wi0-f180.google.com with SMTP id hj13so223281wib.1
\r
25 for <notmuch@notmuchmail.org>; Thu, 10 Jan 2013 03:14:59 -0800 (PST)
\r
26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
\r
27 h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to
\r
28 :references; bh=JKF7yvFI/xmIdMXQyPe1C42OHjgeCGnx58ddkz2vuEM=;
\r
29 b=nCGbg+Hh/E/GmezMo9asUrKNoZo2dDswymVl2Fnx5rOJIciSl6NpGXznmk0T3YDZLk
\r
30 O8KYsvSCpBDPV1ZGgmG8HWXiWpRQJyWHiVAxvYG8RJf33cxDCOtWruvGNBVznnL2KNJG
\r
31 rmDDj9EsANHBbPAdvDhgv76XUnHXMtWSslavw97dcyE+ILqtrLGWfUL6tybRSbDCx69S
\r
32 5b7QRb+ZMt9HviEmRbt9XrAEvRU5SUqe36eq6QKhV6j/Napz0SqQjxh5EnK0kL6VdUCo
\r
33 obEdyk3PeVppr/vC77O7gdIWEulCSBknpCSLFrgLEevAD4RhT86sABjs58B4g1myAX6U
\r
35 X-Received: by 10.180.79.37 with SMTP id g5mr8511121wix.8.1357816499127;
\r
36 Thu, 10 Jan 2013 03:14:59 -0800 (PST)
\r
37 Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31])
\r
38 by mx.google.com with ESMTPS id hu8sm7893443wib.6.2013.01.10.03.14.57
\r
39 (version=TLSv1.2 cipher=RC4-SHA bits=128/128);
\r
40 Thu, 10 Jan 2013 03:14:58 -0800 (PST)
\r
41 From: Mark Walters <markwalters1009@gmail.com>
\r
42 To: notmuch@notmuchmail.org
\r
43 Subject: [PATCH (corrected)] contrib: pick: add a target message for pick
\r
44 Date: Thu, 10 Jan 2013 11:14:58 +0000
\r
45 Message-Id: <1357816498-25085-1-git-send-email-markwalters1009@gmail.com>
\r
46 X-Mailer: git-send-email 1.7.9.1
\r
47 In-Reply-To: <1357814477-1348-3-git-send-email-markwalters1009@gmail.com>
\r
48 References: <1357814477-1348-3-git-send-email-markwalters1009@gmail.com>
\r
49 X-BeenThere: notmuch@notmuchmail.org
\r
50 X-Mailman-Version: 2.1.13
\r
52 List-Id: "Use and development of the notmuch mail system."
\r
53 <notmuch.notmuchmail.org>
\r
54 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
55 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
56 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
57 List-Post: <mailto:notmuch@notmuchmail.org>
\r
58 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
59 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
60 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
61 X-List-Received-Date: Thu, 10 Jan 2013 11:15:01 -0000
\r
63 This adds a target message for pick which it will jump to when (if) it
\r
64 appears. It adds the target to notmuch-pick-from-show-current-query so
\r
65 that pick goes straight to the message that was current in the show
\r
66 view and it adds target to notmuch-pick-refresh-view so that the
\r
67 current message is preserved.
\r
69 The previous version had an extra ). The version I was testing had the
\r
70 fix but git didn't; oh well.
\r
78 contrib/notmuch-pick/notmuch-pick.el | 30 +++++++++++++++++++++++-------
\r
79 1 files changed, 23 insertions(+), 7 deletions(-)
\r
81 diff --git a/contrib/notmuch-pick/notmuch-pick.el b/contrib/notmuch-pick/notmuch-pick.el
\r
82 index d597126..128fabf 100644
\r
83 --- a/contrib/notmuch-pick/notmuch-pick.el
\r
84 +++ b/contrib/notmuch-pick/notmuch-pick.el
\r
86 ;; The context of the search: i.e., useful but can be dropped.
\r
87 (defvar notmuch-pick-query-context nil)
\r
88 (make-variable-buffer-local 'notmuch-pick-query-context)
\r
89 +(defvar notmuch-pick-target-msg nil)
\r
90 +(make-variable-buffer-local 'notmuch-pick-target-msg)
\r
91 (defvar notmuch-pick-buffer-name nil)
\r
92 (make-variable-buffer-local 'notmuch-pick-buffer-name)
\r
93 ;; This variable is the window used for the message pane. It is set
\r
94 @@ -328,7 +330,9 @@ Does NOT change the database."
\r
95 (defun notmuch-pick-from-show-current-query ()
\r
96 "Call notmuch pick with the current query"
\r
98 - (notmuch-pick notmuch-show-thread-id notmuch-show-query-context))
\r
99 + (notmuch-pick notmuch-show-thread-id
\r
100 + notmuch-show-query-context
\r
101 + (notmuch-show-get-message-id)))
\r
103 ;; This function should be in notmuch.el but be we trying to minimise
\r
104 ;; impact on the rest of the codebase.
\r
105 @@ -344,6 +348,7 @@ Does NOT change the database."
\r
107 (notmuch-pick (notmuch-search-find-thread-id)
\r
108 notmuch-search-query-string
\r
110 (notmuch-prettify-subject (notmuch-search-find-subject)))
\r
111 (notmuch-pick-show-match-message-with-wait))
\r
113 @@ -506,9 +511,13 @@ will be reversed."
\r
114 (let ((inhibit-read-only t)
\r
115 (basic-query notmuch-pick-basic-query)
\r
116 (query-context notmuch-pick-query-context)
\r
117 + (target (notmuch-pick-get-message-id))
\r
118 (buffer-name notmuch-pick-buffer-name))
\r
120 - (notmuch-pick-worker basic-query query-context (get-buffer buffer-name))))
\r
121 + (notmuch-pick-worker basic-query
\r
124 + (get-buffer buffer-name))))
\r
126 (defmacro with-current-notmuch-pick-message (&rest body)
\r
127 "Evaluate body with current buffer set to the text of current message"
\r
128 @@ -639,10 +648,16 @@ unchanged ADDRESS if parsing fails."
\r
131 (defun notmuch-pick-goto-and-insert-msg (msg)
\r
132 - "Insert msg at the end of the buffer."
\r
133 + "Insert msg at the end of the buffer. Move point to msg if it is the target"
\r
135 (goto-char (point-max))
\r
136 - (notmuch-pick-insert-msg msg)))
\r
137 + (notmuch-pick-insert-msg msg))
\r
138 + (let ((msg-id (notmuch-id-to-query (plist-get msg :id))))
\r
139 + (when (string= msg-id notmuch-pick-target-msg)
\r
140 + (setq notmuch-pick-target-msg "found")
\r
141 + (goto-char (point-max))
\r
142 + (forward-line -1))))
\r
144 (defun notmuch-pick-insert-tree (tree depth tree-status first last)
\r
145 "Insert the message tree TREE at depth DEPTH in the current thread."
\r
146 (let ((msg (car tree))
\r
147 @@ -762,12 +777,13 @@ Complete list of currently available key bindings:
\r
148 'notmuch-pick-show-error
\r
151 -(defun notmuch-pick-worker (basic-query &optional query-context buffer)
\r
152 +(defun notmuch-pick-worker (basic-query &optional query-context target buffer)
\r
154 (notmuch-pick-mode)
\r
155 (setq notmuch-pick-basic-query basic-query)
\r
156 (setq notmuch-pick-query-context query-context)
\r
157 (setq notmuch-pick-buffer-name (buffer-name buffer))
\r
158 + (setq notmuch-pick-target-msg target)
\r
161 (goto-char (point-min))
\r
162 @@ -799,7 +815,7 @@ Complete list of currently available key bindings:
\r
163 (insert "End of search results.\n"))))))
\r
166 -(defun notmuch-pick (&optional query query-context buffer-name show-first-match)
\r
167 +(defun notmuch-pick (&optional query query-context target buffer-name show-first-match)
\r
168 "Run notmuch pick with the given `query' and display the results"
\r
169 (interactive "sNotmuch pick: ")
\r
171 @@ -813,7 +829,7 @@ Complete list of currently available key bindings:
\r
172 ;; Don't track undo information for this buffer
\r
173 (set 'buffer-undo-list t)
\r
175 - (notmuch-pick-worker query query-context buffer)
\r
176 + (notmuch-pick-worker query query-context target buffer)
\r
178 (setq truncate-lines t)
\r
179 (when show-first-match
\r