Added eclipse-style line moving and eshell init.
authorLuke Hoersten <Luke@Hoersten.org>
Sun, 03 Apr 2011 11:26:27 -0500
changeset 34 8e91ec6fd0a2
parent 33 3be3d7b4cae4
child 35 4a9c440b6764
Added eclipse-style line moving and eshell init.
init.el
init_eshell.sh
move-line.el
--- a/init.el	Tue Dec 21 21:23:25 2010 -0500
+++ b/init.el	Sun Apr 03 11:26:27 2011 -0500
@@ -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)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/init_eshell.sh	Sun Apr 03 11:26:27 2011 -0500
@@ -0,0 +1,1 @@
+export LOCAL_QUOTES=~/Trade/localQuotes/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/move-line.el	Sun Apr 03 11:26:27 2011 -0500
@@ -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)