From fb29d3b591fae74f2cb9c75047970e72008a3b22 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Sun, 5 Oct 2014 16:26:35 +0200 Subject: [PATCH] Add buffer-move package --- elpa/buffer-move-0.4/buffer-move-autoloads.el | 18 +++ elpa/buffer-move-0.4/buffer-move-pkg.el | 1 + elpa/buffer-move-0.4/buffer-move.el | 135 ++++++++++++++++++ 3 files changed, 154 insertions(+) create mode 100644 elpa/buffer-move-0.4/buffer-move-autoloads.el create mode 100644 elpa/buffer-move-0.4/buffer-move-pkg.el create mode 100644 elpa/buffer-move-0.4/buffer-move.el diff --git a/elpa/buffer-move-0.4/buffer-move-autoloads.el b/elpa/buffer-move-0.4/buffer-move-autoloads.el new file mode 100644 index 0000000..a12d61c --- /dev/null +++ b/elpa/buffer-move-0.4/buffer-move-autoloads.el @@ -0,0 +1,18 @@ +;;; buffer-move-autoloads.el --- automatically extracted autoloads +;; +;;; Code: + + +;;;### (autoloads nil nil ("buffer-move-pkg.el" "buffer-move.el") +;;;;;; (21553 16645 222241 807000)) + +;;;*** + +(provide 'buffer-move-autoloads) +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; coding: utf-8 +;; End: +;;; buffer-move-autoloads.el ends here diff --git a/elpa/buffer-move-0.4/buffer-move-pkg.el b/elpa/buffer-move-0.4/buffer-move-pkg.el new file mode 100644 index 0000000..ebda4a8 --- /dev/null +++ b/elpa/buffer-move-0.4/buffer-move-pkg.el @@ -0,0 +1 @@ +(define-package "buffer-move" "0.4" "swap buffers between windows" (quote nil)) diff --git a/elpa/buffer-move-0.4/buffer-move.el b/elpa/buffer-move-0.4/buffer-move.el new file mode 100644 index 0000000..f877368 --- /dev/null +++ b/elpa/buffer-move-0.4/buffer-move.el @@ -0,0 +1,135 @@ +;;; buffer-move.el --- swap buffers between windows + +;; Copyright (C) 2004 Lucas Bonnet + +;; Author: Lucas Bonnet +;; Keywords: lisp,convenience +;; Version: 0.4 +;; URL: http://www.emacswiki.org/cgi-bin/wiki/buffer-move.el + +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License +;; as published by the Free Software Foundation; either version 2 +;; of the License, or (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program; if not, write to the Free Software +;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +;; 02111-1307, USA. + +;;; Commentary: + +;; This file is for lazy people wanting to swap buffers without +;; typing C-x b on each window. This is useful when you have : + +;; +--------------+-------------+ +;; | | | +;; | #emacs | #gnus | +;; | | | +;; +--------------+-------------+ +;; | | +;; | .emacs | +;; | | +;; +----------------------------+ + +;; and you want to have : + +;; +--------------+-------------+ +;; | | | +;; | #gnus | .emacs | +;; | | | +;; +--------------+-------------+ +;; | | +;; | #emacs | +;; | | +;; +----------------------------+ + +;; With buffer-move, just go in #gnus, do buf-move-left, go to #emacs +;; (which now should be on top right) and do buf-move-down. + +;; To use it, simply put a (require 'buffer-move) in your ~/.emacs and +;; define some keybindings. For example, i use : + +;; (global-set-key (kbd "") 'buf-move-up) +;; (global-set-key (kbd "") 'buf-move-down) +;; (global-set-key (kbd "") 'buf-move-left) +;; (global-set-key (kbd "") 'buf-move-right) + + +;;; Code: + + +(require 'windmove) + +(defun buf-move-up () + "Swap the current buffer and the buffer above the split. +If there is no split, ie now window above the current one, an +error is signaled." +;; "Switches between the current buffer, and the buffer above the +;; split, if possible." + (interactive) + (let* ((other-win (windmove-find-other-window 'up)) + (buf-this-buf (window-buffer (selected-window)))) + (if (null other-win) + (error "No window above this one") + ;; swap top with this one + (set-window-buffer (selected-window) (window-buffer other-win)) + ;; move this one to top + (set-window-buffer other-win buf-this-buf) + (select-window other-win)))) + +(defun buf-move-down () +"Swap the current buffer and the buffer under the split. +If there is no split, ie now window under the current one, an +error is signaled." + (interactive) + (let* ((other-win (windmove-find-other-window 'down)) + (buf-this-buf (window-buffer (selected-window)))) + (if (or (null other-win) + (string-match "^ \\*Minibuf" (buffer-name (window-buffer other-win)))) + (error "No window under this one") + ;; swap top with this one + (set-window-buffer (selected-window) (window-buffer other-win)) + ;; move this one to top + (set-window-buffer other-win buf-this-buf) + (select-window other-win)))) + +(defun buf-move-left () +"Swap the current buffer and the buffer on the left of the split. +If there is no split, ie now window on the left of the current +one, an error is signaled." + (interactive) + (let* ((other-win (windmove-find-other-window 'left)) + (buf-this-buf (window-buffer (selected-window)))) + (if (null other-win) + (error "No left split") + ;; swap top with this one + (set-window-buffer (selected-window) (window-buffer other-win)) + ;; move this one to top + (set-window-buffer other-win buf-this-buf) + (select-window other-win)))) + +(defun buf-move-right () +"Swap the current buffer and the buffer on the right of the split. +If there is no split, ie now window on the right of the current +one, an error is signaled." + (interactive) + (let* ((other-win (windmove-find-other-window 'right)) + (buf-this-buf (window-buffer (selected-window)))) + (if (null other-win) + (error "No right split") + ;; swap top with this one + (set-window-buffer (selected-window) (window-buffer other-win)) + ;; move this one to top + (set-window-buffer other-win buf-this-buf) + (select-window other-win)))) + + +(provide 'buffer-move) + +;;; buffer-move.el ends here