Re: Possible addtions to notmuch new ?
[notmuch-archives.git] / 65 / 364bc6eb8ed1b50419a2b78624e479cd04a636
1 Return-Path: <tomi.ollila@iki.fi>\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 9774F431FB6\r
6         for <notmuch@notmuchmail.org>; Tue, 25 Dec 2012 04:21:54 -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\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         autolearn=disabled\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 767GjA9O1tbR for <notmuch@notmuchmail.org>;\r
16         Tue, 25 Dec 2012 04:21:53 -0800 (PST)\r
17 Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
18         by olra.theworths.org (Postfix) with ESMTP id 3CD7D431FAE\r
19         for <notmuch@notmuchmail.org>; Tue, 25 Dec 2012 04:21:53 -0800 (PST)\r
20 Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
21         by guru.guru-group.fi (Postfix) with ESMTP id 8B9151000F2;\r
22         Tue, 25 Dec 2012 14:21:45 +0200 (EET)\r
23 From: Tomi Ollila <tomi.ollila@iki.fi>\r
24 To: Mark Walters <markwalters1009@gmail.com>, notmuch@notmuchmail.org\r
25 Subject: Re: [PATCH] contrib: pick: close message pane when quitting from show\r
26         in the message pane\r
27 In-Reply-To: <1356436037-15597-1-git-send-email-markwalters1009@gmail.com>\r
28 References: <1355650241-27196-1-git-send-email-markwalters1009@gmail.com>\r
29         <1356436037-15597-1-git-send-email-markwalters1009@gmail.com>\r
30 User-Agent: Notmuch/0.14+216~gd58661f (http://notmuchmail.org) Emacs/24.2.1\r
31         (x86_64-unknown-linux-gnu)\r
32 X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
33         $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
34         !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
35 Date: Tue, 25 Dec 2012 14:21:45 +0200\r
36 Message-ID: <m2r4mecofa.fsf@guru.guru-group.fi>\r
37 MIME-Version: 1.0\r
38 Content-Type: text/plain\r
39 X-BeenThere: notmuch@notmuchmail.org\r
40 X-Mailman-Version: 2.1.13\r
41 Precedence: list\r
42 List-Id: "Use and development of the notmuch mail system."\r
43         <notmuch.notmuchmail.org>\r
44 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
45         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
46 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
47 List-Post: <mailto:notmuch@notmuchmail.org>\r
48 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
49 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
50         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
51 X-List-Received-Date: Tue, 25 Dec 2012 12:21:54 -0000\r
52 \r
53 On Tue, Dec 25 2012, Mark Walters <markwalters1009@gmail.com> wrote:\r
54 \r
55 > We add a hook to the show buffer in the message window to close the\r
56 > message window when that buffer quits.  It checks that the\r
57 > message-window is still displaying the show-message buffer and then\r
58 > closes it.\r
59 > ---\r
60 > This is just a slightly tidier version of the previous patch. It is\r
61 > more natural to reuse the nomuch-pick-message-window variable (as it\r
62 > serves the same pupose) rather than adding a new variable and\r
63 > cluttering up the name space (and it also keeps the clutter in the\r
64 > notmuch-pick namespace).\r
65 >\r
66 > I think this a good candidate for 0.15: it fixes an annoying bug in pick. \r
67 >\r
68 > Best wishes\r
69 >\r
70 > Mark\r
71 >\r
72 >\r
73 >  contrib/notmuch-pick/notmuch-pick.el |   19 +++++++++++++++++++\r
74 >  1 files changed, 19 insertions(+), 0 deletions(-)\r
75 >\r
76 > diff --git a/contrib/notmuch-pick/notmuch-pick.el b/contrib/notmuch-pick/notmuch-pick.el\r
77 > index 1a553d4..7d01f4c 100644\r
78 > --- a/contrib/notmuch-pick/notmuch-pick.el\r
79 > +++ b/contrib/notmuch-pick/notmuch-pick.el\r
80 > @@ -157,6 +157,10 @@\r
81 >  (make-variable-buffer-local 'notmuch-pick-query-context)\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 > +;; in both the parent pick buffer and the child show buffer. It is\r
86 > +;; used to try and close the message pane when quitting pick or the\r
87 > +;; child show buffer.\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 > @@ -324,6 +328,16 @@ Does NOT change the database."\r
92 >                  (notmuch-prettify-subject (notmuch-search-find-subject)))\r
93 >    (notmuch-pick-show-match-message-with-wait))\r
94 >  \r
95 > +(defun notmuch-pick-message-window-kill-hook ()\r
96 > +  (let ((buffer (current-buffer)))\r
97 > +    (when (and (window-live-p notmuch-pick-message-window)\r
98 > +            (eq (window-buffer notmuch-pick-message-window) buffer))\r
99 > +      ;; We do not want an error if this is the sole window in the\r
100 > +      ;; frame and I do not know how to test for that in emacs pre\r
101 > +      ;; 24. Hence we just ignore-errors.\r
102 > +      (ignore-errors\r
103 > +     (delete-window notmuch-pick-message-window)))))\r
104 > +\r
105 >  (defun notmuch-pick-show-message ()\r
106 >    "Show the current message (in split-pane)."\r
107 >    (interactive)\r
108 > @@ -341,6 +355,11 @@ Does NOT change the database."\r
109 >       (let ((notmuch-show-indent-messages-width 0))\r
110 >         (setq current-prefix-arg '(4))\r
111 >         (setq buffer (notmuch-show id nil nil nil))))\r
112 > +      ;; We need the `let' as notmuch-pick-message-window is buffer local.\r
113 > +      (let ((window notmuch-pick-message-window))\r
114 > +     (with-current-buffer buffer\r
115 > +       (setq notmuch-pick-message-window window)\r
116 > +       (add-hook 'kill-buffer-hook 'notmuch-pick-message-window-kill-hook)))\r
117 >        (notmuch-pick-tag-update-display (list "-unread"))\r
118 >        (setq notmuch-pick-message-buffer buffer))))\r
119 \r
120 \r
121 LGTM. \r
122 \r
123 Tomi\r
124 \r
125 PS: (unrelated) Mark: check if notmuch-show-mark-read-tags should be used in\r
126    line:\r
127    (notmuch-pick-tag-update-display (list "-unread"))\r
128 \r
129 > -- \r
130 > 1.7.9.1\r