summaryrefslogtreecommitdiffhomepage
path: root/attic/misc.org
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2022-03-27 05:35:41 +0100
committerjao <jao@gnu.org>2022-03-27 05:35:41 +0100
commitf19356b9fd514b9b0ed86172ec85d12206a9efa3 (patch)
tree4a780f6e6b6cfb9fd2b5ff50c9b30a2353cb7ac2 /attic/misc.org
parentace91bad8ebdfea3ee115133863784bae8501cf5 (diff)
downloadelibs-f19356b9fd514b9b0ed86172ec85d12206a9efa3.tar.gz
elibs-f19356b9fd514b9b0ed86172ec85d12206a9efa3.tar.bz2
ace-window
Diffstat (limited to 'attic/misc.org')
-rw-r--r--attic/misc.org41
1 files changed, 41 insertions, 0 deletions
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 ()