From 5167a3947fb5a713a38668414bf99c6263fc9108 Mon Sep 17 00:00:00 2001 From: Luke Hoersten Date: Sun, 3 Apr 2011 11:26:27 -0500 Subject: Added eclipse-style line moving and eshell init. --- init.el | 8 +++++++- init_eshell.sh | 1 + move-line.el | 30 ++++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 init_eshell.sh create mode 100644 move-line.el diff --git a/init.el b/init.el index 989b561..dc9596e 100644 --- a/init.el +++ b/init.el @@ -52,6 +52,7 @@ (cond ((string-match "darwin" (emacs-version)) "Menlo-12") ((string-match "HoldenCaulfield" (system-name)) "monospace-7") + ((string-match "lhoersten-66113" (system-name)) "monospace-8") ("monospace-10"))) (tool-bar-mode -1) ; remove tool bar @@ -68,7 +69,11 @@ ;;; terminal (global-set-key (kbd "C-c s") 'eshell) ; start shell -(add-hook 'eshell-mode-hook '(lambda () (setenv "TERM" "emacs"))) ; enable colors +(add-hook + 'eshell-mode-hook + '(lambda () + (setenv "TERM" "emacs") ; enable colors + (setenv "PATH" (concat "~/.cabal/bin:" (getenv "PATH"))))) ; add cabal binaries ;;;; Mode-Specific ;;;; @@ -158,6 +163,7 @@ (require 'hoersten-pastebin-region) ; send selected text to pastebin (require 'hoersten-c-style) ; load c specific lisp (require 'vala-mode) ; vala programming language +(require 'move-line) ; move line up or down ;;; pretty-mode - unicode character replacement (require 'pretty-mode) diff --git a/init_eshell.sh b/init_eshell.sh new file mode 100644 index 0000000..9c09327 --- /dev/null +++ b/init_eshell.sh @@ -0,0 +1 @@ +export LOCAL_QUOTES=~/Trade/localQuotes/ diff --git a/move-line.el b/move-line.el new file mode 100644 index 0000000..6020a63 --- /dev/null +++ b/move-line.el @@ -0,0 +1,30 @@ +;; http://www.emacswiki.org/emacs/MoveLine + +(defun move-line (n) + "Move the current line up or down by N lines." + (interactive "p") + (setq col (current-column)) + (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 (kbd "M-p") 'move-line-up) +(global-set-key (kbd "M-n") 'move-line-down) + +(message "Loaded move-line function") +(provide 'move-line) -- cgit v1.2.3