unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Mark Walters <markwalters1009@gmail.com>
To: notmuch@notmuchmail.org
Subject: [PATCH (draft)] contrib: pick: close message pane when quitting from show in the message pane
Date: Thu, 13 Dec 2012 09:31:49 +0000	[thread overview]
Message-ID: <1355391109-4150-1-git-send-email-markwalters1009@gmail.com> (raw)

This is a way of trying to make sure notmuch-pick cleans up the split
buffer after itself.
---

Currently if the focus gets into the message pane and then the user
quits from that pane the display stays split. This is an attempt to
fix that. This seems to work but I don't know if there is a better
solution. However, I would welcome any feedback on the user experience
with this patch applied.

Best wishes

Mark




 contrib/notmuch-pick/notmuch-pick.el |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/contrib/notmuch-pick/notmuch-pick.el b/contrib/notmuch-pick/notmuch-pick.el
index 043e9e7..79ef319 100644
--- a/contrib/notmuch-pick/notmuch-pick.el
+++ b/contrib/notmuch-pick/notmuch-pick.el
@@ -160,6 +160,9 @@
 (defvar notmuch-pick-message-window nil)
 (make-variable-buffer-local 'notmuch-pick-message-window)
 (put 'notmuch-pick-message-window 'permanent-local t)
+(defvar notmuch-show-message-window nil)
+(make-variable-buffer-local 'notmuch-show-message-window)
+(put 'notmuch-show-message-window 'permanent-local t)
 (defvar notmuch-pick-message-buffer nil)
 (make-variable-buffer-local 'notmuch-pick-message-buffer-name)
 (put 'notmuch-pick-message-buffer-name 'permanent-local t)
@@ -389,6 +392,16 @@ Does NOT change the database."
                 (notmuch-prettify-subject (notmuch-search-find-subject)))
   (notmuch-pick-show-match-message-with-wait))
 
+;;over-ride this function to try and kill off message panes
+(defun notmuch-kill-this-buffer ()
+  "Kill the current buffer."
+  (interactive)
+  (let ((buffer (current-buffer)))
+    (when (and (window-live-p notmuch-show-message-window)
+	     (eq (window-buffer notmuch-show-message-window) buffer))
+      (delete-window notmuch-show-message-window))
+    (kill-buffer buffer)))
+
 (defun notmuch-pick-show-message ()
   "Show the current message (in split-pane)."
   (interactive)
@@ -406,6 +419,10 @@ Does NOT change the database."
 	(let ((notmuch-show-indent-messages-width 0))
 	  (setq current-prefix-arg '(4))
 	  (setq buffer (notmuch-show id nil nil nil))))
+      ;; We need the let as notmuch-pick-message-window is buffer local.
+      (let ((window notmuch-pick-message-window))
+	(with-current-buffer buffer
+	  (setq notmuch-show-message-window window)))
       (notmuch-pick-tag-update-display (list "-unread"))
       (setq notmuch-pick-message-buffer buffer))))
 
-- 
1.7.9.1

             reply	other threads:[~2012-12-13  9:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-13  9:31 Mark Walters [this message]
2012-12-16  9:30 ` [PATCH] contrib: pick: close message pane when quitting from show in the message pane Mark Walters
2012-12-25 11:47   ` Mark Walters
2012-12-25 12:21     ` Tomi Ollila
2012-12-26  3:08     ` David Bremner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1355391109-4150-1-git-send-email-markwalters1009@gmail.com \
    --to=markwalters1009@gmail.com \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).