-
Notifications
You must be signed in to change notification settings - Fork 2
/
move-border.el
64 lines (48 loc) · 1.56 KB
/
move-border.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
;;; move-border.el --- Move border to resize windows
;; Copyright (C) Unknown
;; Author: Unknown
;; Maintainer: Guillaume Gelin <contact@ramnes.eu>
;; Created 5 sep 2008
;; Keywords: window border
;; Homepage: https://github.com/ramnes/move-border
;; This file is not part of GNU Emacs.
;;; Commentary:
;; Add commands to move border
;; instead of using the built-in
;; window resizing functions
;;; Code:
(defun xor (b1 b2)
(or (and b1 b2)
(and (not b1) (not b2))))
(defun move-border-left-or-right (arg dir)
"General function covering move-border-left and move-border-right. If DIR is
t, then move left, otherwise move right."
(interactive)
(if (null arg) (setq arg 3))
(let ((left-edge (nth 0 (window-edges))))
(if (xor (= left-edge 0) dir)
(shrink-window arg t)
(enlarge-window arg t))))
(defun move-border-up-or-down (arg dir)
"General function covering move-border-up and move-border-down. If DIR is
t, then move up, otherwise move down."
(interactive)
(if (null arg) (setq arg 3))
(let ((top-edge (nth 1 (window-edges))))
(if (xor (= top-edge 0) dir)
(shrink-window arg nil)
(enlarge-window arg nil))))
(defun move-border-left (arg)
(interactive "P")
(move-border-left-or-right arg t))
(defun move-border-right (arg)
(interactive "P")
(move-border-left-or-right arg nil))
(defun move-border-up (arg)
(interactive "P")
(move-border-up-or-down arg t))
(defun move-border-down (arg)
(interactive "P")
(move-border-up-or-down arg nil))
(provide 'move-border)
;;; move-border.el ends here