diff options
| author | jao <jao@gnu.org> | 2026-11-25 22:43:11 +0000 |
|---|---|---|
| committer | jao <jao@gnu.org> | 2026-11-25 22:43:11 +0000 |
| commit | 9842f1ee27c2839d082958a7d9c6b72be17dc92e (patch) | |
| tree | ccb70891cfe757c8d039e3995204683978b8edb9 /lib/eos | |
| parent | e1236d902dd7f7a6cf5a4396ad4074c1e30e7016 (diff) | |
| download | elibs-9842f1ee27c2839d082958a7d9c6b72be17dc92e.tar.gz elibs-9842f1ee27c2839d082958a7d9c6b72be17dc92e.tar.bz2 | |
more tweaks to window switching
Diffstat (limited to 'lib/eos')
| -rw-r--r-- | lib/eos/jao-buffers.el | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/lib/eos/jao-buffers.el b/lib/eos/jao-buffers.el index ae4f14f..800b264 100644 --- a/lib/eos/jao-buffers.el +++ b/lib/eos/jao-buffers.el @@ -45,7 +45,6 @@ (setq arg (if (> arg 0) (1- arg) (1+ arg)))))) ;;;; window navigation (nth) -;;;###autoload (defun jao-nth-window (n) (if (zerop n) 'jao-first-window @@ -55,6 +54,11 @@ (dotimes (x ,n) (other-window 1))))) ;;;###autoload +(defun jao-nth-window-activate () + (mapc (lambda (n) (global-set-key (format "\C-c%s" (1+ n)) (jao-nth-window n))) + '(0 1 2 3 4 5 6 7 8))) + +;;;###autoload (defun jao-prev-window () "Go to previous window." (interactive) @@ -62,20 +66,25 @@ ;;;; window switching (defvar jao--previous-window nil) +(defvar jao--previous-buffer nil) (defun jao-save-current-window (&rest _ignore) (unless (active-minibuffer-window) + (setq jao--previous-buffer (current-buffer)) (setq jao--previous-window (get-buffer-window (current-buffer))))) ;;;###autoload (defun jao-switch-with-previous-window () (interactive) - (let ((previous-window jao--previous-window)) + (let ((previous-window jao--previous-window) + (previous-buffer jao--previous-buffer)) (jao-save-current-window) (if (and (window-live-p previous-window) (not (equal previous-window (get-buffer-window (current-buffer))))) (select-window previous-window) - (other-window 1)))) + (if (buffer-live-p previous-buffer) + (switch-to-buffer previous-buffer nil t) + (other-window 1))))) ;;;###autoload (defun jao-switch-with-first-window () @@ -85,7 +94,10 @@ (jao-save-current-window) (select-window (frame-first-window)))) -(advice-add 'other-window :before #'jao-save-current-window) +;;;###autoload +(defun jao-switch-window-activate (&optional switcher) + (advice-add 'other-window :before #'jao-save-current-window) + (when switcher (advice-add switcher :before #'jao-save-current-window))) ;;; attached buffers (defun jao-display-buffer-below-selected (buffer alist) |
