From 1263fddb461ce7467a8b1a2655623eb25762773d Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Wed, 12 Aug 2020 21:04:59 -0700 Subject: comments and messages --- .emacs.d/init-spw.el | 28 +++++++++++++++++++--------- 1 file 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 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))) + (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) -- cgit v1.2.3