summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2015-02-03 02:29:28 -0500
committerKyle Meyer <kyle@kyleam.com>2015-02-03 02:29:28 -0500
commitc8c4f3b7cabf2db5963eae5a64a4191010e86238 (patch)
tree4107e5a999f74929de73ca0c686ad25324f1a805 /lisp
parent633b12c952300d55dabaf27e3e305d4e2d481cfb (diff)
downloademacs.d-c8c4f3b7cabf2db5963eae5a64a4191010e86238.tar.gz
Add save-some-buffers variant
Diffstat (limited to 'lisp')
-rw-r--r--lisp/init-buffers.el16
1 files changed, 15 insertions, 1 deletions
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)