From f19356b9fd514b9b0ed86172ec85d12206a9efa3 Mon Sep 17 00:00:00 2001 From: jao Date: Sun, 27 Mar 2022 05:35:41 +0100 Subject: ace-window --- attic/misc.org | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'attic/misc.org') diff --git a/attic/misc.org b/attic/misc.org index dbf621f..d3af11a 100644 --- a/attic/misc.org +++ b/attic/misc.org @@ -500,6 +500,47 @@ :diminish ((rcirc-omit-mode . ""))) #+end_src +* nth window + #+begin_src emacs-lisp + (defun jao--nth-window (n) + (let ((jao-minibuffer-mode nil) + (ignore-window-parameters t)) + (select-window (frame-first-window)) + (other-window n)) + (jao-minibuffer-refresh)) + + (defalias 'jao-other-window 'other-window) + + ;; (global-set-key (kbd "M-o") #'jao-other-window) + + (global-set-key (kbd "C-c 0") #'jao-first-window) + (dolist (n '(0 1 2 3 4 5 6 7 8)) + (global-set-key (format "\C-c%s" (1+ n)) + (lambda () (interactive) (jao--nth-window n)))) + + #+end_src +* transpose + #+begin_src emacs-lisp + (defun jao-transpose-windows (arg) + "Transpose the buffers shown in two windows." + (interactive "p") + (let ((selector (if (>= arg 0) 'next-window 'previous-window))) + (while (/= arg 0) + (let ((this-win (window-buffer)) + (next-win (window-buffer (funcall selector)))) + (set-window-buffer (selected-window) next-win) + (set-window-buffer (funcall selector) this-win) + (select-window (funcall selector))) + (setq arg (if (> arg 0) (1- arg) (1+ arg)))))) + + (defun jao-transpose-windows-prev () + (interactive) + (jao-transpose-windows -1)) + + (define-key ctl-x-4-map (kbd "t") #'jao-transpose-windows) + (global-set-key (kbd "M-O") #'jao-transpose-windows) + (global-set-key (kbd "M-P") #'jao-transpose-windows-prev) + #+end_src * ace-window #+begin_src emacs-lisp (defun jao-ace-switch-buffer-other-window () -- cgit v1.2.3