about summary refs log tree commit diff
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2008-02-04 16:21:20 +0100
committerChristian Neukirchen <chneukirchen@gmail.com>2008-02-04 16:21:20 +0100
commit0a97a9c3191884bcab237191c005df1d7f4e8d91 (patch)
tree925f9ada17f57c9878979dd29c02a63d1736035f
parent31660bd34441ccacfa28c57e1d5c39a2f6e9338e (diff)
downloadgitsum-0a97a9c3191884bcab237191c005df1d7f4e8d91.tar.gz
gitsum-0a97a9c3191884bcab237191c005df1d7f4e8d91.tar.xz
gitsum-0a97a9c3191884bcab237191c005df1d7f4e8d91.zip
Make `q' kill the buffer if unchanged
-rw-r--r--gitsum.el11
1 files changed, 9 insertions, 2 deletions
diff --git a/gitsum.el b/gitsum.el
index 91d0c61..2ae37d9 100644
--- a/gitsum.el
+++ b/gitsum.el
@@ -13,8 +13,9 @@
 
 (easy-mmode-defmap gitsum-diff-mode-shared-map
   '(("c" . gitsum-commit)
-    ("u" . gitsum-undo)
-    ("g" . gitsum-refresh))
+    ("g" . gitsum-refresh)
+    ("q" . gitsum-kill-buffer)
+    ("u" . gitsum-undo))
   "Basic keymap for `gitsum-diff-mode', bound to various prefix keys.")
 
 (define-derived-mode gitsum-diff-mode diff-mode "gitsum"
@@ -88,6 +89,12 @@ A numeric argument serves as a repeat count."
   (with-current-buffer log-edit-parent-buffer
     (gitsum-refresh)))
 
+(defun gitsum-kill-buffer ()
+  "Kill the current buffer if it has no manual changes."
+  (interactive)
+  (unless (buffer-modified-p)
+    (kill-buffer nil)))
+
 (defun gitsum ()
   "Entry point into gitsum-diff-mode."
   (interactive)