unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] emacs: show/search: switch to caller/parent buffer when quit
@ 2013-07-18 16:06 Tomi Ollila
  0 siblings, 0 replies; only message in thread
From: Tomi Ollila @ 2013-07-18 16:06 UTC (permalink / raw)
  To: notmuch; +Cc: tomi.ollila

hello/search: in notmuch-hello-search-continuation switch (eventually)
call notmuch-hello with nil as no-display argument so that notmuch-hello
buffer is always switched to, instead of possibly to some other buffer
user may have visited in between.

show: added function `notmuch-show-quit` which switches to parent buffer
(of that is live) after killing current buffer. Otherwise control may
go to some other buffer user may have visited in between. This function
is now bound to "q" in notmuch-show-mode-map.
---
 emacs/notmuch-hello.el |  2 +-
 emacs/notmuch-show.el  | 10 +++++++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 147c08c..00d8785 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -472,7 +472,7 @@ Such a list can be computed with `notmuch-hello-query-counts'."
 (defimage notmuch-hello-logo ((:type png :file "notmuch-logo.png")))
 
 (defun notmuch-hello-search-continuation()
-  (notmuch-hello-update t))
+  (notmuch-hello-update nil))
 
 (defun notmuch-hello-update (&optional no-display)
   "Update the current notmuch view."
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index e5de977..b346002 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1262,7 +1262,7 @@ reset based on the original query."
 (defvar notmuch-show-mode-map
       (let ((map (make-sparse-keymap)))
 	(define-key map "?" 'notmuch-help)
-	(define-key map "q" 'notmuch-kill-this-buffer)
+	(define-key map "q" 'notmuch-show-quit)
 	(define-key map (kbd "<C-tab>") 'widget-backward)
 	(define-key map (kbd "M-TAB") 'notmuch-show-previous-button)
 	(define-key map (kbd "<backtab>") 'notmuch-show-previous-button)
@@ -1540,6 +1540,14 @@ marked as unread, i.e. the tag changes in
 
 ;; Commands typically bound to keys.
 
+(defun notmuch-show-quit ()
+  "Exit the show buffer, switching to parent buffer if it is live."
+  (interactive)
+  (let ((parent-buffer notmuch-show-parent-buffer))
+    (notmuch-kill-this-buffer)
+    (if (buffer-live-p parent-buffer)
+	(switch-to-buffer parent-buffer))))
+
 (defun notmuch-show-advance ()
   "Advance through thread.
 
-- 
1.8.0

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2013-07-18 16:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-18 16:06 [PATCH] emacs: show/search: switch to caller/parent buffer when quit Tomi Ollila

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).