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 78FB9431FBD
\r
6 for <notmuch@notmuchmail.org>; Thu, 10 Jan 2013 02:41:25 -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 8cLoO3CNwTzH for <notmuch@notmuchmail.org>;
\r
18 Thu, 10 Jan 2013 02:41:24 -0800 (PST)
\r
19 Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com
\r
20 [209.85.212.181]) (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 97A02431FAF
\r
23 for <notmuch@notmuchmail.org>; Thu, 10 Jan 2013 02:41:24 -0800 (PST)
\r
24 Received: by mail-wi0-f181.google.com with SMTP id hq4so203671wib.14
\r
25 for <notmuch@notmuchmail.org>; Thu, 10 Jan 2013 02:41:23 -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=LvrvUEip4q1O9HWoLdPQQOOVuyHWqOaZic2nM/V6Ft4=;
\r
29 b=LVHceU7heCm4P+lwHNkhGeBfHuTjcKq2mdZHKcBALEXOYFMF/j8ESJYwVQH7A416AK
\r
30 3oW9iRkoYmNzEoQ5ckzt3oFYhwuwk0o5vJnD3R66Y4SZl7rmv+LmCdyr/KxZYNPCd3ts
\r
31 HOAtgbdvYVw5KFK4NOn5U9kwgp9g46Buji+lIkZ7ekivJcHvXxRLnnyBe2O8t2PL5BmS
\r
32 Wks/mnJnepa2A2jFCL/kIClLDyhK4PZaO+Z7PGs9fbhidJSaaXFEwTIpDdNq49E65VnW
\r
33 tkD4Zg6boOhl/l4pG8v3zWXlAwujMAqm+IItNvxMVtDX02KvDzuH+zagrXo1B3jgPANJ
\r
35 X-Received: by 10.180.97.68 with SMTP id dy4mr8333027wib.7.1357814483490;
\r
36 Thu, 10 Jan 2013 02:41:23 -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 eo10sm1672945wib.9.2013.01.10.02.41.22
\r
39 (version=TLSv1.2 cipher=RC4-SHA bits=128/128);
\r
40 Thu, 10 Jan 2013 02:41:23 -0800 (PST)
\r
41 From: Mark Walters <markwalters1009@gmail.com>
\r
42 To: notmuch@notmuchmail.org
\r
43 Subject: [PATCH 2/2] contrib: pick: add a target message for pick
\r
44 Date: Thu, 10 Jan 2013 10:41:17 +0000
\r
45 Message-Id: <1357814477-1348-3-git-send-email-markwalters1009@gmail.com>
\r
46 X-Mailer: git-send-email 1.7.9.1
\r
47 In-Reply-To: <1357814477-1348-1-git-send-email-markwalters1009@gmail.com>
\r
48 References: <1357814477-1348-1-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 10:41:25 -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 contrib/notmuch-pick/notmuch-pick.el | 28 ++++++++++++++++++++++------
\r
70 1 files changed, 22 insertions(+), 6 deletions(-)
\r
72 diff --git a/contrib/notmuch-pick/notmuch-pick.el b/contrib/notmuch-pick/notmuch-pick.el
\r
73 index d597126..974223d 100644
\r
74 --- a/contrib/notmuch-pick/notmuch-pick.el
\r
75 +++ b/contrib/notmuch-pick/notmuch-pick.el
\r
77 ;; The context of the search: i.e., useful but can be dropped.
\r
78 (defvar notmuch-pick-query-context nil)
\r
79 (make-variable-buffer-local 'notmuch-pick-query-context)
\r
80 +(defvar notmuch-pick-target-msg nil)
\r
81 +(make-variable-buffer-local 'notmuch-pick-target-msg)
\r
82 (defvar notmuch-pick-buffer-name nil)
\r
83 (make-variable-buffer-local 'notmuch-pick-buffer-name)
\r
84 ;; This variable is the window used for the message pane. It is set
\r
85 @@ -328,7 +330,9 @@ Does NOT change the database."
\r
86 (defun notmuch-pick-from-show-current-query ()
\r
87 "Call notmuch pick with the current query"
\r
89 - (notmuch-pick notmuch-show-thread-id notmuch-show-query-context))
\r
90 + (notmuch-pick notmuch-show-thread-id
\r
91 + notmuch-show-query-context
\r
92 + (notmuch-show-get-message-id)))
\r
94 ;; This function should be in notmuch.el but be we trying to minimise
\r
95 ;; impact on the rest of the codebase.
\r
96 @@ -344,6 +348,7 @@ Does NOT change the database."
\r
98 (notmuch-pick (notmuch-search-find-thread-id)
\r
99 notmuch-search-query-string
\r
101 (notmuch-prettify-subject (notmuch-search-find-subject)))
\r
102 (notmuch-pick-show-match-message-with-wait))
\r
104 @@ -506,9 +511,13 @@ will be reversed."
\r
105 (let ((inhibit-read-only t)
\r
106 (basic-query notmuch-pick-basic-query)
\r
107 (query-context notmuch-pick-query-context)
\r
108 + (target (notmuch-pick-get-message-id))
\r
109 (buffer-name notmuch-pick-buffer-name))
\r
111 - (notmuch-pick-worker basic-query query-context (get-buffer buffer-name))))
\r
112 + (notmuch-pick-worker basic-query
\r
115 + (get-buffer buffer-name))))
\r
117 (defmacro with-current-notmuch-pick-message (&rest body)
\r
118 "Evaluate body with current buffer set to the text of current message"
\r
119 @@ -639,10 +648,16 @@ unchanged ADDRESS if parsing fails."
\r
122 (defun notmuch-pick-goto-and-insert-msg (msg)
\r
123 - "Insert msg at the end of the buffer."
\r
124 + "Insert msg at the end of the buffer. Move point to msg if it is the target"
\r
126 (goto-char (point-max))
\r
127 (notmuch-pick-insert-msg msg)))
\r
128 + (let ((msg-id (notmuch-id-to-query (plist-get msg :id))))
\r
129 + (when (string= msg-id notmuch-pick-target-msg)
\r
130 + (setq notmuch-pick-target-msg "found")
\r
131 + (goto-char (point-max))
\r
132 + (forward-line -1))))
\r
134 (defun notmuch-pick-insert-tree (tree depth tree-status first last)
\r
135 "Insert the message tree TREE at depth DEPTH in the current thread."
\r
136 (let ((msg (car tree))
\r
137 @@ -762,12 +777,13 @@ Complete list of currently available key bindings:
\r
138 'notmuch-pick-show-error
\r
141 -(defun notmuch-pick-worker (basic-query &optional query-context buffer)
\r
142 +(defun notmuch-pick-worker (basic-query &optional query-context target buffer)
\r
144 (notmuch-pick-mode)
\r
145 (setq notmuch-pick-basic-query basic-query)
\r
146 (setq notmuch-pick-query-context query-context)
\r
147 (setq notmuch-pick-buffer-name (buffer-name buffer))
\r
148 + (setq notmuch-pick-target-msg target)
\r
151 (goto-char (point-min))
\r
152 @@ -799,7 +815,7 @@ Complete list of currently available key bindings:
\r
153 (insert "End of search results.\n"))))))
\r
156 -(defun notmuch-pick (&optional query query-context buffer-name show-first-match)
\r
157 +(defun notmuch-pick (&optional query query-context target buffer-name show-first-match)
\r
158 "Run notmuch pick with the given `query' and display the results"
\r
159 (interactive "sNotmuch pick: ")
\r
161 @@ -813,7 +829,7 @@ Complete list of currently available key bindings:
\r
162 ;; Don't track undo information for this buffer
\r
163 (set 'buffer-undo-list t)
\r
165 - (notmuch-pick-worker query query-context buffer)
\r
166 + (notmuch-pick-worker query query-context target buffer)
\r
168 (setq truncate-lines t)
\r
169 (when show-first-match
\r