Re: [PATCH] contrib: pick: close message pane when quitting from show in the message...
authorTomi Ollila <tomi.ollila@iki.fi>
Tue, 25 Dec 2012 12:21:45 +0000 (14:21 +0200)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:52:45 +0000 (09:52 -0800)
65/364bc6eb8ed1b50419a2b78624e479cd04a636 [new file with mode: 0644]

diff --git a/65/364bc6eb8ed1b50419a2b78624e479cd04a636 b/65/364bc6eb8ed1b50419a2b78624e479cd04a636
new file mode 100644 (file)
index 0000000..4957234
--- /dev/null
@@ -0,0 +1,130 @@
+Return-Path: <tomi.ollila@iki.fi>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 9774F431FB6\r
+       for <notmuch@notmuchmail.org>; Tue, 25 Dec 2012 04:21:54 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+       autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id 767GjA9O1tbR for <notmuch@notmuchmail.org>;\r
+       Tue, 25 Dec 2012 04:21:53 -0800 (PST)\r
+Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
+       by olra.theworths.org (Postfix) with ESMTP id 3CD7D431FAE\r
+       for <notmuch@notmuchmail.org>; Tue, 25 Dec 2012 04:21:53 -0800 (PST)\r
+Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
+       by guru.guru-group.fi (Postfix) with ESMTP id 8B9151000F2;\r
+       Tue, 25 Dec 2012 14:21:45 +0200 (EET)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: Mark Walters <markwalters1009@gmail.com>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH] contrib: pick: close message pane when quitting from show\r
+       in the message pane\r
+In-Reply-To: <1356436037-15597-1-git-send-email-markwalters1009@gmail.com>\r
+References: <1355650241-27196-1-git-send-email-markwalters1009@gmail.com>\r
+       <1356436037-15597-1-git-send-email-markwalters1009@gmail.com>\r
+User-Agent: Notmuch/0.14+216~gd58661f (http://notmuchmail.org) Emacs/24.2.1\r
+       (x86_64-unknown-linux-gnu)\r
+X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
+       $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
+       !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
+Date: Tue, 25 Dec 2012 14:21:45 +0200\r
+Message-ID: <m2r4mecofa.fsf@guru.guru-group.fi>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Tue, 25 Dec 2012 12:21:54 -0000\r
+\r
+On Tue, Dec 25 2012, Mark Walters <markwalters1009@gmail.com> wrote:\r
+\r
+> We add a hook to the show buffer in the message window to close the\r
+> message window when that buffer quits.  It checks that the\r
+> message-window is still displaying the show-message buffer and then\r
+> closes it.\r
+> ---\r
+> This is just a slightly tidier version of the previous patch. It is\r
+> more natural to reuse the nomuch-pick-message-window variable (as it\r
+> serves the same pupose) rather than adding a new variable and\r
+> cluttering up the name space (and it also keeps the clutter in the\r
+> notmuch-pick namespace).\r
+>\r
+> I think this a good candidate for 0.15: it fixes an annoying bug in pick. \r
+>\r
+> Best wishes\r
+>\r
+> Mark\r
+>\r
+>\r
+>  contrib/notmuch-pick/notmuch-pick.el |   19 +++++++++++++++++++\r
+>  1 files changed, 19 insertions(+), 0 deletions(-)\r
+>\r
+> diff --git a/contrib/notmuch-pick/notmuch-pick.el b/contrib/notmuch-pick/notmuch-pick.el\r
+> index 1a553d4..7d01f4c 100644\r
+> --- a/contrib/notmuch-pick/notmuch-pick.el\r
+> +++ b/contrib/notmuch-pick/notmuch-pick.el\r
+> @@ -157,6 +157,10 @@\r
+>  (make-variable-buffer-local 'notmuch-pick-query-context)\r
+>  (defvar notmuch-pick-buffer-name nil)\r
+>  (make-variable-buffer-local 'notmuch-pick-buffer-name)\r
+> +;; This variable is the window used for the message pane. It is set\r
+> +;; in both the parent pick buffer and the child show buffer. It is\r
+> +;; used to try and close the message pane when quitting pick or the\r
+> +;; child show buffer.\r
+>  (defvar notmuch-pick-message-window nil)\r
+>  (make-variable-buffer-local 'notmuch-pick-message-window)\r
+>  (put 'notmuch-pick-message-window 'permanent-local t)\r
+> @@ -324,6 +328,16 @@ Does NOT change the database."\r
+>                  (notmuch-prettify-subject (notmuch-search-find-subject)))\r
+>    (notmuch-pick-show-match-message-with-wait))\r
+>  \r
+> +(defun notmuch-pick-message-window-kill-hook ()\r
+> +  (let ((buffer (current-buffer)))\r
+> +    (when (and (window-live-p notmuch-pick-message-window)\r
+> +           (eq (window-buffer notmuch-pick-message-window) buffer))\r
+> +      ;; We do not want an error if this is the sole window in the\r
+> +      ;; frame and I do not know how to test for that in emacs pre\r
+> +      ;; 24. Hence we just ignore-errors.\r
+> +      (ignore-errors\r
+> +    (delete-window notmuch-pick-message-window)))))\r
+> +\r
+>  (defun notmuch-pick-show-message ()\r
+>    "Show the current message (in split-pane)."\r
+>    (interactive)\r
+> @@ -341,6 +355,11 @@ Does NOT change the database."\r
+>      (let ((notmuch-show-indent-messages-width 0))\r
+>        (setq current-prefix-arg '(4))\r
+>        (setq buffer (notmuch-show id nil nil nil))))\r
+> +      ;; We need the `let' as notmuch-pick-message-window is buffer local.\r
+> +      (let ((window notmuch-pick-message-window))\r
+> +    (with-current-buffer buffer\r
+> +      (setq notmuch-pick-message-window window)\r
+> +      (add-hook 'kill-buffer-hook 'notmuch-pick-message-window-kill-hook)))\r
+>        (notmuch-pick-tag-update-display (list "-unread"))\r
+>        (setq notmuch-pick-message-buffer buffer))))\r
+\r
+\r
+LGTM. \r
+\r
+Tomi\r
+\r
+PS: (unrelated) Mark: check if notmuch-show-mark-read-tags should be used in\r
+   line:\r
+   (notmuch-pick-tag-update-display (list "-unread"))\r
+\r
+> -- \r
+> 1.7.9.1\r