]> git.bundesbrandschatzamt.de Git - emacsconfig.git/commitdiff
added jcs-kill-a-buffer
authorAndreas Gerler <baronNOSPAMbundesbrandschatzamt.de>
Sat, 8 Oct 2016 16:35:52 +0000 (18:35 +0200)
committerAndreas Gerler <baronNOSPAMbundesbrandschatzamt.de>
Sat, 8 Oct 2016 16:35:52 +0000 (18:35 +0200)
Kill the current buffer without asking if there is no prefix.

Signed-off-by: Andreas Gerler <baronNOSPAMbundesbrandschatzamt.de>
bba.org

diff --git a/bba.org b/bba.org
index 543b7fc261c74838d5de3f67737b749e1254dfe4..a9a3f0637b5982fd29062291daf7de948a36aded 100644 (file)
--- a/bba.org
+++ b/bba.org
@@ -2700,6 +2700,22 @@ positions.
        "python -mjson.tool" (current-buffer) t)))
 #+END_SRC
 
+* [[http://irreal.org/blog/?p=5585][kill this buffer]]
+[2016-09-26 Mon 13:22]
+
+Kill the current buffer without asking if there is no prefix.
+
+#+BEGIN_SRC emacs-lisp
+  (defun jcs-kill-a-buffer (askp)
+    (interactive "P")
+    (if askp
+        (kill-buffer (funcall completing-read-function
+                              "Kill buffer: "
+                              (mapcar #'buffer-name (buffer-list))))
+      (kill-this-buffer)))
+
+  (global-set-key (kbd "C-x k") 'jcs-kill-a-buffer)
+#+END_SRC
 * configure some default values
     [2014-10-02 Thu 00:27]