From 98f2cd6b0753146526dd681c5f8c98ae5cc4fd0f Mon Sep 17 00:00:00 2001 From: Tomi Ollila Date: Thu, 18 Jul 2013 19:06:57 +0300 Subject: [PATCH] [PATCH] emacs: show/search: switch to caller/parent buffer when quit --- 8f/b7ba90f32e06970b8d59d817d50e811509b23d | 100 ++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 8f/b7ba90f32e06970b8d59d817d50e811509b23d diff --git a/8f/b7ba90f32e06970b8d59d817d50e811509b23d b/8f/b7ba90f32e06970b8d59d817d50e811509b23d new file mode 100644 index 000000000..79fca5790 --- /dev/null +++ b/8f/b7ba90f32e06970b8d59d817d50e811509b23d @@ -0,0 +1,100 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 19745431FAF + for ; Thu, 18 Jul 2013 09:07:17 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] + autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id nZ+yh1fjwFkr for ; + Thu, 18 Jul 2013 09:07:09 -0700 (PDT) +Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) + by olra.theworths.org (Postfix) with ESMTP id 82118431FAE + for ; Thu, 18 Jul 2013 09:07:09 -0700 (PDT) +Received: by guru.guru-group.fi (Postfix, from userid 501) + id 400F91000F4; Thu, 18 Jul 2013 19:06:59 +0300 (EEST) +From: Tomi Ollila +To: notmuch@notmuchmail.org +Subject: [PATCH] emacs: show/search: switch to caller/parent buffer when quit +Date: Thu, 18 Jul 2013 19:06:57 +0300 +Message-Id: <1374163617-23740-1-git-send-email-tomi.ollila@iki.fi> +X-Mailer: git-send-email 1.8.0 +Cc: tomi.ollila@iki.fi +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Thu, 18 Jul 2013 16:07:17 -0000 + +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 "") 'widget-backward) + (define-key map (kbd "M-TAB") 'notmuch-show-previous-button) + (define-key map (kbd "") '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 + -- 2.26.2