diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2020-08-12 21:04:59 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2020-08-12 21:04:59 -0700 |
commit | 1263fddb461ce7467a8b1a2655623eb25762773d (patch) | |
tree | 694e96261ba1fda1c88a345bf33d8146bb87de6e | |
parent | 6f14105d5821ac8119c59492bf9c0cb9a6071f53 (diff) | |
download | dotfiles-1263fddb461ce7467a8b1a2655623eb25762773d.tar.gz |
comments and messages
-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) |