Re: new "crypto" branch providing full PGP/MIME support
[notmuch-archives.git] / 81 / 36ddb01ba85ef4a7e4f3a55a3fe963b7cee564
1 Return-Path: <prvs=jrosenthal=65281eaca@jhu.edu>\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 6DB08431FBC\r
6         for <notmuch@notmuchmail.org>; Fri, 12 Feb 2010 10:24:15 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -2.929\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-2.929 tagged_above=-999 required=5 tests=[AWL=1.070,\r
12         BAYES_50=0.001, RCVD_IN_DNSWL_MED=-4] autolearn=ham\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 VA4x8UoGdz+p for <notmuch@notmuchmail.org>;\r
16         Fri, 12 Feb 2010 10:24:14 -0800 (PST)\r
17 X-Greylist: delayed 3602 seconds by postgrey-1.32 at olra;\r
18         Fri, 12 Feb 2010 10:24:14 PST\r
19 Received: from ipex3.johnshopkins.edu (ipex3.johnshopkins.edu\r
20         [128.220.161.140])\r
21         by olra.theworths.org (Postfix) with ESMTP id A498B431FAE\r
22         for <notmuch@notmuchmail.org>; Fri, 12 Feb 2010 10:24:14 -0800 (PST)\r
23 X-IronPort-Anti-Spam-Filtered: true\r
24 X-IronPort-Anti-Spam-Result:\r
25  ApAFALsddUuA3DZF/2dsb2JhbACPRAGLPHSzS4QxiFWEWASDEw\r
26 X-IronPort-AV: E=Sophos;i="4.49,462,1262581200"; d="scan'208";a="349840089"\r
27 Received: from watt.gilman.jhu.edu ([128.220.54.69])\r
28         by ipex3.johnshopkins.edu with ESMTP/TLS/ADH-AES256-SHA;\r
29         12 Feb 2010 12:24:11 -0500\r
30 Received: by watt.gilman.jhu.edu (Postfix, from userid 502)\r
31         id 859BC3FBE66; Fri, 12 Feb 2010 12:24:10 -0500 (EST)\r
32 From: Jesse Rosenthal <jrosenthal@jhu.edu>\r
33 To: notmuch@notmuchmail.org\r
34 Date: Fri, 12 Feb 2010 12:10:41 -0500\r
35 Message-ID: <m1y6iybc5h.fsf@watt.gilman.jhu.edu>\r
36 MIME-Version: 1.0\r
37 Content-Type: text/plain; charset=us-ascii\r
38 Subject: [notmuch] [PATCH] notmuch.el: Make notmuch-show buffer name first\r
39         subject, instead of thread-id\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: Fri, 12 Feb 2010 18:24:15 -0000\r
53 \r
54 \r
55 Change the buffer name to the subject of the thread instead of\r
56 the thread-id. This is more meaningful to the user, and will make it easier\r
57 to scroll through numerous open buffers.\r
58 \r
59 Note that this patch adds a required `buffer-name' argument to notmuch-show.\r
60 \r
61 Signed-off-by: Jesse Rosenthal <jrosenthal@jhu.edu>\r
62 ---\r
63  notmuch.el |   24 ++++++++++++++++++------\r
64  1 files changed, 18 insertions(+), 6 deletions(-)\r
65 \r
66 diff --git a/notmuch.el b/notmuch.el\r
67 index 040997e..fbf547e 100644\r
68 --- a/notmuch.el\r
69 +++ b/notmuch.el\r
70 @@ -1041,7 +1041,7 @@ All currently available key bindings:\r
71           (lambda()\r
72             (hl-line-mode 1) ))\r
73  \r
74 -(defun notmuch-show (thread-id &optional parent-buffer query-context)\r
75 +(defun notmuch-show (thread-id buffer-name &optional parent-buffer query-context)\r
76    "Run \"notmuch show\" with the given thread ID and display results.\r
77  \r
78  The optional PARENT-BUFFER is the notmuch-search buffer from\r
79 @@ -1051,7 +1051,7 @@ thread from that buffer can be show when done with this one).\r
80  The optional QUERY-CONTEXT is a notmuch search term. Only messages from the thread\r
81  matching this search term are shown if non-nil. "\r
82    (interactive "sNotmuch show: ")\r
83 -  (let ((buffer (get-buffer-create (concat "*notmuch-show-" thread-id "*"))))\r
84 +  (let ((buffer (get-buffer-create buffer-name)))\r
85      (switch-to-buffer buffer)\r
86      (notmuch-show-mode)\r
87      (set (make-local-variable 'notmuch-show-parent-buffer) parent-buffer)\r
88 @@ -1063,8 +1063,10 @@ matching this search term are shown if non-nil. "\r
89        (erase-buffer)\r
90        (goto-char (point-min))\r
91        (save-excursion\r
92 -       (let* ((basic-args (list notmuch-command nil t nil "show" "--entire-thread" thread-id))\r
93 -               (args (if query-context (append basic-args (list "and (" query-context ")")) basic-args)))\r
94 +       (let* ((basic-args (list notmuch-command nil t nil "show" "--entire-thread" "\'" thread-id))\r
95 +               (args (if query-context\r
96 +                         (append basic-args (list "and (" query-context ")\'"))\r
97 +                       (append basic-args (list "\'")))))\r
98           (apply 'call-process args)\r
99           (when (and (eq (buffer-size) 0) query-context)\r
100             (apply 'call-process basic-args)))\r
101 @@ -1242,9 +1244,19 @@ Complete list of currently available key bindings:\r
102  (defun notmuch-search-show-thread ()\r
103    "Display the currently selected thread."\r
104    (interactive)\r
105 -  (let ((thread-id (notmuch-search-find-thread-id)))\r
106 +  (let ((thread-id (notmuch-search-find-thread-id))\r
107 +       (subject (notmuch-search-find-subject))\r
108 +       buffer-name)\r
109 +    (when (string-match "^[ \t]*$" subject)\r
110 +      (setq subject "[No Subject]"))\r
111 +    (setq buffer-name (concat "*"\r
112 +                             (truncate-string-to-width subject 32 nil nil t)\r
113 +                             "*"))\r
114      (if (> (length thread-id) 0)\r
115 -       (notmuch-show thread-id (current-buffer) notmuch-search-query-string)\r
116 +       (notmuch-show thread-id\r
117 +                     buffer-name\r
118 +                     (current-buffer)\r
119 +                     notmuch-search-query-string)\r
120        (error "End of search results"))))\r
121  \r
122  (defun notmuch-search-reply-to-thread ()\r
123 -- \r
124 1.6.5.3\r
125 \r