Re: [PATCH 0/4] Allow specifying alternate names for addresses in other_email
[notmuch-archives.git] / a1 / e092f6a84334c9db435e7d906e7ac47aeb07f1
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 CF919431FC2\r
6         for <notmuch@notmuchmail.org>; Sun, 16 Dec 2012 01:30:47 -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: 0.201\r
10 X-Spam-Level: \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 UtAoBCWBM8el for <notmuch@notmuchmail.org>;\r
18         Sun, 16 Dec 2012 01:30:47 -0800 (PST)\r
19 Received: from mail-wi0-f175.google.com (mail-wi0-f175.google.com\r
20         [209.85.212.175]) (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 2EAE2431FB6\r
23         for <notmuch@notmuchmail.org>; Sun, 16 Dec 2012 01:30:46 -0800 (PST)\r
24 Received: by mail-wi0-f175.google.com with SMTP id hm11so1351241wib.2\r
25         for <notmuch@notmuchmail.org>; Sun, 16 Dec 2012 01:30:44 -0800 (PST)\r
26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
27         h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;\r
28         bh=bst34kfln3z5t1lBP8Rmkjk/Qld78nML4zWKE18xYsg=;\r
29         b=Cqx4SrFYFv+21fTYDMp6kuY0UHQ3ip3NuHDXulQvciY1NDp87ejDe/ptqGwo+yrhwv\r
30         N13lAN94RrHhwC1iEtTucSMNZxkVeSJco3KkzQWfO7jzmOd+92e2hnuoosJdUl4dzZu4\r
31         Bi8CUMRZRc7GWKL510q6Z30HF9l43+1eN2+kfa2JZLXPHBdWVD5/D+sKaBvvsUEl4gcU\r
32         h5ArtlRz8hgaayBZispst79bH0yk1KWmbSsBK1CJSsWuFUBct35jNe2Ibqho7wNWWT3z\r
33         Rw82QhKYaYV26RJHxbmhbsQGl3vR7XMeJjrTIbVPQIkdI8ZzpSzggAz3rmi8DhFFjNtL\r
34         x+HA==\r
35 Received: by 10.194.86.72 with SMTP id n8mr11374134wjz.19.1355650243204;\r
36         Sun, 16 Dec 2012 01:30:43 -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 p3sm5649301wic.8.2012.12.16.01.30.41\r
39         (version=TLSv1/SSLv3 cipher=OTHER);\r
40         Sun, 16 Dec 2012 01:30:42 -0800 (PST)\r
41 From: Mark Walters <markwalters1009@gmail.com>\r
42 To: notmuch@notmuchmail.org\r
43 Subject: [PATCH] contrib: pick: close message pane when quitting from show in\r
44         the message pane\r
45 Date: Sun, 16 Dec 2012 09:30:41 +0000\r
46 Message-Id: <1355650241-27196-1-git-send-email-markwalters1009@gmail.com>\r
47 X-Mailer: git-send-email 1.7.9.1\r
48 In-Reply-To: <1355391109-4150-1-git-send-email-markwalters1009@gmail.com>\r
49 References: <1355391109-4150-1-git-send-email-markwalters1009@gmail.com>\r
50 X-BeenThere: notmuch@notmuchmail.org\r
51 X-Mailman-Version: 2.1.13\r
52 Precedence: list\r
53 List-Id: "Use and development of the notmuch mail system."\r
54         <notmuch.notmuchmail.org>\r
55 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
56         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
57 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
58 List-Post: <mailto:notmuch@notmuchmail.org>\r
59 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
60 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
61         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
62 X-List-Received-Date: Sun, 16 Dec 2012 09:30:47 -0000\r
63 \r
64 We add a hook to the show buffer in the message window to close the\r
65 message window when that buffer quits.  It checks that the\r
66 message-window is still displaying the show-message buffer and then\r
67 closes it.\r
68 ---\r
69 \r
70 This is (probably) a rather better version than the previous\r
71 attempt. It uses hooks rather than redefining notmuch-kill-this-buffer\r
72 and it avoids errors if the user has made the message pane the whole\r
73 frame.\r
74 \r
75 Best wishes\r
76 \r
77 Mark\r
78 \r
79 \r
80  contrib/notmuch-pick/notmuch-pick.el |   18 ++++++++++++++++++\r
81  1 files changed, 18 insertions(+), 0 deletions(-)\r
82 \r
83 diff --git a/contrib/notmuch-pick/notmuch-pick.el b/contrib/notmuch-pick/notmuch-pick.el\r
84 index 043e9e7..8383589 100644\r
85 --- a/contrib/notmuch-pick/notmuch-pick.el\r
86 +++ b/contrib/notmuch-pick/notmuch-pick.el\r
87 @@ -160,6 +160,9 @@\r
88  (defvar notmuch-pick-message-window nil)\r
89  (make-variable-buffer-local 'notmuch-pick-message-window)\r
90  (put 'notmuch-pick-message-window 'permanent-local t)\r
91 +(defvar notmuch-show-message-window nil)\r
92 +(make-variable-buffer-local 'notmuch-show-message-window)\r
93 +(put 'notmuch-show-message-window 'permanent-local t)\r
94  (defvar notmuch-pick-message-buffer nil)\r
95  (make-variable-buffer-local 'notmuch-pick-message-buffer-name)\r
96  (put 'notmuch-pick-message-buffer-name 'permanent-local t)\r
97 @@ -389,6 +392,16 @@ Does NOT change the database."\r
98                  (notmuch-prettify-subject (notmuch-search-find-subject)))\r
99    (notmuch-pick-show-match-message-with-wait))\r
100  \r
101 +(defun notmuch-pick-message-window-kill-hook ()\r
102 +  (let ((buffer (current-buffer)))\r
103 +    (when (and (window-live-p notmuch-show-message-window)\r
104 +              (eq (window-buffer notmuch-show-message-window) buffer))\r
105 +      ;; We do not want an error if this is the sole window in the\r
106 +      ;; frame and I do not know how to test for that in emacs pre\r
107 +      ;; 24. Hence we just ignore-errors.\r
108 +      (ignore-errors\r
109 +       (delete-window notmuch-show-message-window)))))\r
110 +\r
111  (defun notmuch-pick-show-message ()\r
112    "Show the current message (in split-pane)."\r
113    (interactive)\r
114 @@ -406,6 +419,11 @@ Does NOT change the database."\r
115         (let ((notmuch-show-indent-messages-width 0))\r
116           (setq current-prefix-arg '(4))\r
117           (setq buffer (notmuch-show id nil nil nil))))\r
118 +      ;; We need the `let' as notmuch-pick-message-window is buffer local.\r
119 +      (let ((window notmuch-pick-message-window))\r
120 +       (with-current-buffer buffer\r
121 +         (setq notmuch-show-message-window window)\r
122 +         (add-hook 'kill-buffer-hook 'notmuch-pick-message-window-kill-hook)))\r
123        (notmuch-pick-tag-update-display (list "-unread"))\r
124        (setq notmuch-pick-message-buffer buffer))))\r
125  \r
126 -- \r
127 1.7.9.1\r
128 \r