From c8c4f3b7cabf2db5963eae5a64a4191010e86238 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Tue, 3 Feb 2015 02:29:28 -0500 Subject: Add save-some-buffers variant --- lisp/init-buffers.el | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/lisp/init-buffers.el b/lisp/init-buffers.el index 98207d1..18c19cc 100644 --- a/lisp/init-buffers.el +++ b/lisp/init-buffers.el @@ -26,9 +26,23 @@ kill this buffer and the window." (t (call-interactively #'kill-buffer)))) +(defun km/save-buffers () + "Run `save-some-buffers', but don't ask to save the current buffer. +`save-some-buffers' is called interactively." + (interactive) + (let* ((base-buf (buffer-base-buffer)) + (buf (or base-buf (current-buffer))) + (buf-file (buffer-file-name buf))) + (when (and (buffer-live-p buf) + (buffer-modified-p buf) + buf-file) + (with-current-buffer buf + (save-buffer)))) + (call-interactively #'save-some-buffers)) + (global-set-key (kbd "C-x K") 'km/kill-buffer) -(key-chord-define-global "js" 'save-buffer) +(key-chord-define-global "js" 'km/save-buffers) ;; Replace `list-buffers' with ibuffer. (global-set-key (kbd "C-x C-b") 'ibuffer) -- cgit v1.2.3