From 32d137889aec790248343d21ee4bccc4acaa69bd Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Fri, 4 Sep 2020 09:46:16 -0700 Subject: simplify C-x o binding --- .emacs.d/init-spw.el | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/.emacs.d/init-spw.el b/.emacs.d/init-spw.el index ba66fea8..503d8812 100644 --- a/.emacs.d/init-spw.el +++ b/.emacs.d/init-spw.el @@ -1556,19 +1556,13 @@ I use by default)." (setq best-time time) (setq best-window window))))) -(defun spw/back-and-forth (interactive) +(defun spw/back-and-forth (arg) (interactive "P") - (cond - ;; if there's a prefix arg then just `other-window', so that's still - ;; 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 - (select-window (spw/get-mru-window))))) + (if arg + ;; if there's a prefix arg then just `other-window', so that's still + ;; available on M-1 C-x o + (call-interactively #'other-window) + (select-window (spw/get-mru-window)))) (global-set-key [remap other-window] #'spw/back-and-forth) (defun spw/set-other-window-to-scroll (arg) -- cgit v1.2.3