Move window manipulating functions to window-manip.el

This commit is contained in:
Gergely Polonkai 2016-11-17 13:35:33 +01:00
parent 6ee76de7db
commit 954881e661
3 changed files with 14 additions and 15 deletions

View File

@ -887,15 +887,14 @@
;; Load my own functions
(load "gnu-c-header.el")
(load "toggle-window-split.el")
(load "round-number-to-decimals.el")
(load "transpose-windows.el")
(load "zim.el")
(load "enclose-string.el")
(load "buf-manipulation.el")
(load "text-manip")
(load "frame-manip")
(load "file-manip")
(load "window-manip")
;; Define aliases
(defalias 'yes-or-no-p 'y-or-n-p)
@ -960,6 +959,7 @@
("C-r" . rename-current-buffer-file)
("C-d" . delete-current-buffer-file)
("~" . toggle-char-case)
("|" . toggle-window-split)
:map isearch-mode-map
("<C-return>" . isearch-exit-other-end)
:map gpolonkai/pers-map

View File

@ -1,11 +0,0 @@
(defun 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 (plusp arg) (1- arg) (1+ arg))))))

View File

@ -1,3 +1,15 @@
(defun 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 (plusp arg) (1- arg) (1+ arg))))))
(defun toggle-window-split ()
(interactive)
(if (= (count-windows) 2)
@ -23,5 +35,3 @@
(select-window first-win)
(if this-win-2nd (other-window 1))))
(error "This works only for two windows!")))
(global-set-key (kbd "C-x |") 'toggle-window-split)