diff options
-rw-r--r-- | .emacs.d/init-spw.el | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/.emacs.d/init-spw.el b/.emacs.d/init-spw.el index d58a9522..81f05e14 100644 --- a/.emacs.d/init-spw.el +++ b/.emacs.d/init-spw.el @@ -496,19 +496,29 @@ add places the library might be available to `load-path'." ;; to type those right after switching (defun spw/maybe-next-buffer () (interactive) - (message - (if (window-next-buffers) - "Went forwards; use <left> to go back, or C-c b again." - "Went backwards; use <right> to go back, or C-c b again.")) - (call-interactively - (if (window-next-buffers) - #'next-buffer - #'previous-buffer))) + (cl-destructuring-bind + (message command) + (if (window-next-buffers) + '("Went forwards" next-buffer) + '("Went backwards" previous-buffer)) + (call-interactively `,command) + (message message))) (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". + ;; desired. + ;; + ;; Although C-c b can go backwards, really it's for going forwards; it is a + ;; little tricky to use the arrow keys correctly right after C-c b if it + ;; unexpectedly took us backwards (if we were expecting to go backwards, + ;; would have used C-c w). + ;; + ;; The fallback to going backwards is there only because it would be worse to + ;; go round to the end of the list of buffers, but perhaps it should just do + ;; nothing? + ;; + ;; 'w' is for "window's buffers". (("\C-cw" . previous-buffer) ("\C-cb" . spw/maybe-next-buffer)) (lambda (count) |