From 7b7198a4194ce0a0d41d2b2f14cd7e7df30a865e Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Mon, 10 Aug 2020 16:39:01 -0700 Subject: replace C-c W with C-c b --- .emacs.d/init-spw.el | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.emacs.d/init-spw.el b/.emacs.d/init-spw.el index 4ab440f2..fd93eb3e 100644 --- a/.emacs.d/init-spw.el +++ b/.emacs.d/init-spw.el @@ -491,13 +491,23 @@ add places the library might be available to `load-path'." ;; bit complicated but we want these commands to be easily repeatable but also ;; avoid setting a transient map containing self-insert chars, as might want ;; to type those right after switching +(defun spw/maybe-next-buffer () + (interactive) + (message + (if (window-next-buffers) + "Went forwards; use to go back, or C-c b again." + "Went backwards; use to go back, or C-c b again.")) + (call-interactively + (if (window-next-buffers) + #'next-buffer + #'previous-buffer))) (spw/bind-command-with-cycling ;; Note `previous-buffer' and `next-buffer' actually use ;; `switch-to-prev-buffer' and `switch-to-next-buffer' as subroutines, so ;; buffers previously shown in the selected window come up first, as ;; desired. 'w' is for "window's buffers". (("\C-cw" . previous-buffer) - ("\C-cW" . next-buffer)) + ("\C-cb" . spw/maybe-next-buffer)) (lambda (count) (interactive "p") (if (> count 0) @@ -1449,6 +1459,8 @@ I use by default)." ;; available on M-1 C-x o (interactive (call-interactively #'other-window)) + ;; Thanks to C-c b will probably never take advantage of this branch; drop + ;; it? ((one-window-p) (switch-to-buffer (other-buffer) nil t)) (t -- cgit v1.2.3