diff --git a/elpa/move-line-0.0.1/move-line-autoloads.el b/elpa/move-line-0.0.1/move-line-autoloads.el new file mode 100644 index 0000000..58bb6ae --- /dev/null +++ b/elpa/move-line-0.0.1/move-line-autoloads.el @@ -0,0 +1,18 @@ +;;; move-line-autoloads.el --- automatically extracted autoloads +;; +;;; Code: + + +;;;### (autoloads nil nil ("move-line-pkg.el" "move-line.el") (21553 +;;;;;; 16742 574441 73000)) + +;;;*** + +(provide 'move-line-autoloads) +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; coding: utf-8 +;; End: +;;; move-line-autoloads.el ends here diff --git a/elpa/move-line-0.0.1/move-line-pkg.el b/elpa/move-line-0.0.1/move-line-pkg.el new file mode 100644 index 0000000..f2c9dc5 --- /dev/null +++ b/elpa/move-line-0.0.1/move-line-pkg.el @@ -0,0 +1 @@ +(define-package "move-line" "0.0.1" "utilities for moving lines in file" (quote nil)) diff --git a/elpa/move-line-0.0.1/move-line.el b/elpa/move-line-0.0.1/move-line.el new file mode 100644 index 0000000..68e07a8 --- /dev/null +++ b/elpa/move-line-0.0.1/move-line.el @@ -0,0 +1,73 @@ +;;; move-line.el --- utilities for moving lines in file + +;; Copyright (C) 2014 Nathaniel Flath + +;; Author: Nathaniel Flath +;; URL: http://github.com/nflath/move-line +;; Version: 0.0.1 + +;; This file is not part of GNU Emacs. + +;;; Commentary: + +;; This file provides several utility functions for moving the current line +;; up/down. The functions provided are move-line-up and move-line-down, bound +;; to control-shift-up and control-shift-down by default. + +;;; Installation + +;; To use this mode, put the following in your init.el: +;; (require 'move-line) + +;;; License: + +;; 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 3 +;; 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 GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Code: + +(defun move-line (n) + "Move the current line up or down by N lines." + (interactive "p") + (let ((col (current-column)) + start + end) + (beginning-of-line) + (setq start (point)) + (end-of-line) + (forward-char) + (setq end (point)) + (let ((line-text (delete-and-extract-region start end))) + (forward-line n) + (insert line-text) + ;; restore point to original column in moved line + (forward-line -1) + (forward-char col)))) + +(defun move-line-up (n) + "Move the current line up by N lines." + (interactive "p") + (move-line (if (null n) -1 (- n)))) + +(defun move-line-down (n) + "Move the current line down by N lines." + (interactive "p") + (move-line (if (null n) 1 n))) + +(global-set-key [(control shift up)] 'move-line-up) +(global-set-key [(control shift down)] 'move-line-down) + +(provide 'move-line) +;;; move-line.el ends here