├── .gitignore ├── README.md └── move-border.el /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | *.elc 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | move-border 2 | =========== 3 | 4 | Move-border provides functions for resizing Emacs windows, considering the 5 | current window border instead of the window itself. 6 | 7 | So, by binding your keys to `move-border-up`, `move-border-down`, 8 | `move-border-left`, and `move-border-right`, you can resize your windows much 9 | more intuitively than if you were using `shrink-window`, `enlarge-window`, 10 | `shrink-window-horizontally` and `enlarge-window-horizontally`. 11 | 12 | ```lisp 13 | ;; example key bindings 14 | (global-set-key (kbd "M-S-") 'move-border-up) 15 | (global-set-key (kbd "M-S-") 'move-border-down) 16 | (global-set-key (kbd "M-S-") 'move-border-left) 17 | (global-set-key (kbd "M-S-") 'move-border-right) 18 | ``` 19 | 20 | 21 | Disclaimer 22 | ---------- 23 | 24 | I am not the author of this file, but found it on a blog where the blog author 25 | is also saying that he is not the author. So, no one knows who is the author. 26 | 27 | If you are the author, please send me a word (contact@ramnes.eu). 28 | 29 | 30 | License 31 | ------- 32 | 33 | (c) the unknown original author 34 | -------------------------------------------------------------------------------- /move-border.el: -------------------------------------------------------------------------------- 1 | ;;; move-border.el --- Move border to resize windows 2 | 3 | ;; Copyright (C) Unknown 4 | 5 | ;; Author: Unknown 6 | ;; Maintainer: Guillaume Gelin 7 | ;; Created 5 sep 2008 8 | ;; Keywords: window border 9 | ;; Homepage: https://github.com/ramnes/move-border 10 | 11 | ;; This file is not part of GNU Emacs. 12 | 13 | ;;; Commentary: 14 | 15 | ;; Add commands to move border 16 | ;; instead of using the built-in 17 | ;; window resizing functions 18 | 19 | ;;; Code: 20 | 21 | (defun xor (b1 b2) 22 | (or (and b1 b2) 23 | (and (not b1) (not b2)))) 24 | 25 | (defun move-border-left-or-right (arg dir) 26 | "General function covering move-border-left and move-border-right. If DIR is 27 | t, then move left, otherwise move right." 28 | (interactive) 29 | (if (null arg) (setq arg 3)) 30 | (let ((left-edge (nth 0 (window-edges)))) 31 | (if (xor (= left-edge 0) dir) 32 | (shrink-window arg t) 33 | (enlarge-window arg t)))) 34 | 35 | (defun move-border-up-or-down (arg dir) 36 | "General function covering move-border-up and move-border-down. If DIR is 37 | t, then move up, otherwise move down." 38 | (interactive) 39 | (if (null arg) (setq arg 3)) 40 | (let ((top-edge (nth 1 (window-edges)))) 41 | (if (xor (= top-edge 0) dir) 42 | (shrink-window arg nil) 43 | (enlarge-window arg nil)))) 44 | 45 | (defun move-border-left (arg) 46 | (interactive "P") 47 | (move-border-left-or-right arg t)) 48 | 49 | (defun move-border-right (arg) 50 | (interactive "P") 51 | (move-border-left-or-right arg nil)) 52 | 53 | (defun move-border-up (arg) 54 | (interactive "P") 55 | (move-border-up-or-down arg t)) 56 | 57 | (defun move-border-down (arg) 58 | (interactive "P") 59 | (move-border-up-or-down arg nil)) 60 | 61 | (provide 'move-border) 62 | 63 | ;;; move-border.el ends here 64 | 65 | --------------------------------------------------------------------------------