about summary refs log tree commit diff
path: root/emacs.d
diff options
context:
space:
mode:
Diffstat (limited to 'emacs.d')
-rw-r--r--emacs.d/init-bindings.el2
-rw-r--r--emacs.d/init-functions.el58
-rw-r--r--emacs.d/init-settings.el10
-rw-r--r--emacs.d/init.el3
4 files changed, 70 insertions, 3 deletions
diff --git a/emacs.d/init-bindings.el b/emacs.d/init-bindings.el
index 214ef5b48921..2593ddd6d010 100644
--- a/emacs.d/init-bindings.el
+++ b/emacs.d/init-bindings.el
@@ -42,3 +42,5 @@
 ;; Add a fullscreen toggle
 (global-set-key (kbd "M-RET") 'toggle-frame-fullscreen)
 
+;; Replace standard goto-line with goto-line-with-feedback
+(global-set-key (kbd "M-g g") 'goto-line-with-feedback)
diff --git a/emacs.d/init-functions.el b/emacs.d/init-functions.el
index 3a1c8c7e8e14..dfdfee08389a 100644
--- a/emacs.d/init-functions.el
+++ b/emacs.d/init-functions.el
@@ -12,7 +12,7 @@
   ;; there)
   (unless (member "~/.emacs.d/themes" custom-theme-load-path)
     (add-to-list 'custom-theme-load-path "~/.emacs.d/themes"))
- 
+
   ;; Download file if it doesn't exist.
 
   (let ((file
@@ -22,7 +22,7 @@
 
 (defun custom-download-script (url filename)
   "Downloads an Elisp script, places it in ~/.emacs/other and then loads it"
- 
+
   ;; Ensure the directory exists
   (unless (file-exists-p "~/.emacs.d/other")
     (make-directory "~/.emacs.d/other"))
@@ -44,6 +44,58 @@
       (shell-command (concat "git clone " url " " fullpath))))
   )
 
+;; These come from magnars, he's got some awesome things.
+
+(defun goto-line-with-feedback ()
+  "Show line numbers temporarily, while prompting for the line number input"
+  (interactive)
+  (unwind-protect
+      (progn
+        (linum-mode 1)
+        (call-interactively 'goto-line))
+    (linum-mode -1)))
+
+(defun rotate-windows ()
+  "Rotate your windows"
+  (interactive)
+  (cond ((not (> (count-windows)1))
+         (message "You can't rotate a single window!"))
+        (t
+         (setq i 1)
+         (setq numWindows (count-windows))
+         (while  (< i numWindows)
+           (let* (
+                  (w1 (elt (window-list) i))
+                  (w2 (elt (window-list) (+ (% i numWindows) 1)))
+
+                  (b1 (window-buffer w1))
+                  (b2 (window-buffer w2))
+
+                  (s1 (window-start w1))
+                  (s2 (window-start w2))
+                  )
+             (set-window-buffer w1  b2)
+             (set-window-buffer w2 b1)
+             (set-window-start w1 s2)
+             (set-window-start w2 s1)
+             (setq i (1+ i)))))))
+
+(defun untabify-buffer ()
+  (interactive)
+  (untabify (point-min) (point-max)))
+
+(defun indent-buffer ()
+  (interactive)
+  (indent-region (point-min) (point-max)))
+
+(defun cleanup-buffer ()
+  "Perform a bunch of operations on the whitespace content of a buffer.
+Including indent-buffer, which should not be called automatically on save."
+  (interactive)
+  (untabify-buffer)
+  (delete-trailing-whitespace)
+  (indent-buffer))
+
 ;; These come from the emacs starter kit
 (defun esk-pretty-lambdas ()
   (font-lock-add-keywords
@@ -75,4 +127,4 @@
 
 (defun speak (m &optional voice)
   (shell-command (if 'voice (concat "say -v " voice " \"" m "\"")
-		   (concat "say " m))))
+                   (concat "say " m))))
diff --git a/emacs.d/init-settings.el b/emacs.d/init-settings.el
index 02069a82f8c2..e2c7e6249bd4 100644
--- a/emacs.d/init-settings.el
+++ b/emacs.d/init-settings.el
@@ -111,6 +111,16 @@ comment as a filename."
 ;; Not the real deal without this ...
 (set-variable 'nyan-wavy-trail t)
 
+(setq linum-format (lambda (line)
+                     (propertize
+                      (format (concat " %"
+                                      (number-to-string
+                                       (length (number-to-string
+                                                (line-number-at-pos (point-max)))))
+                                      "d ")
+                              line)
+                      'face 'linum)))
+
 ;; Hiding JOIN, QUIT, PART
 (setq erc-hide-list '("JOIN" "PART" "QUIT"))
 
diff --git a/emacs.d/init.el b/emacs.d/init.el
index d9bc8d874b96..4551a7b9adad 100644
--- a/emacs.d/init.el
+++ b/emacs.d/init.el
@@ -74,6 +74,9 @@
 ;; Actual servers and such are loaded from irc.el
 (load "~/.emacs.d/irc")
 
+;; Load magnars' string manipulation library
+(require 's)
+
 ;; Seed RNG
 (random t)