[RFC][PATCH v1] emacs: Improve the behaviour of the 'q' binding.

David Edmondson dme at dme.org
Thu Oct 16 04:59:40 PDT 2014


When a user hits 'q' in a notmuch buffer, kill the buffer only if
there are no other windows currently showing it.
---

This arose from a discussion in #notmuch. Please try it and see if you
like the new behaviour.

 emacs/notmuch-lib.el | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index 1e166c6..bc6f119 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -240,9 +240,13 @@ depending on the value of `notmuch-poll-script'."
     (call-process notmuch-command nil nil nil "new")))
 
 (defun notmuch-kill-this-buffer ()
-  "Kill the current buffer."
+  "Undisplay the current buffer."
   (interactive)
-  (kill-buffer (current-buffer)))
+  ;; If more than one window is showing this buffer, bury rather than
+  ;; kill it.
+  (if (> (length (get-buffer-window-list nil nil t)) 1)
+      (bury-buffer)
+    (kill-buffer)))
 
 (defun notmuch-documentation-first-line (symbol)
   "Return the first line of the documentation string for SYMBOL."
-- 
2.1.1



More information about the notmuch mailing list