about summary refs log tree commit diff
diff options
context:
space:
mode:
authorVincent Ambo <vincent@spotify.com>2013-10-17T12·17+0200
committerVincent Ambo <vincent@spotify.com>2013-10-17T12·17+0200
commit2acc9f23fa214d4b661387c17d4c19312eb49c35 (patch)
tree05e5d9b7742d00626220562462905c041e0bf552
parentcbecd5031d57528c39b61e16f2aad850f40b49a1 (diff)
Cleanup and evil setup
Removed several functions from init-functions that I didn't
actually use.

Lots of other cleanup.

The variable "is-vim-user" in init.el controls whether or not
evil packages should be installed and configured.
-rw-r--r--init-bindings.el4
-rw-r--r--init-eshell.el2
-rw-r--r--init-functions.el50
-rw-r--r--init-modes.el18
-rw-r--r--init-settings.el70
-rw-r--r--init.el64
6 files changed, 71 insertions, 137 deletions
diff --git a/init-bindings.el b/init-bindings.el
index 2242bf733e9a..24517fd36c48 100644
--- a/init-bindings.el
+++ b/init-bindings.el
@@ -39,8 +39,8 @@
 ;; So good!
 (global-set-key (kbd "C-c g") 'magit-status)
 
-;; Add a fullscreen toggle
-(global-set-key (kbd "M-RET") 'toggle-frame-fullscreen)
+;; Add a fullscreen toggle - TODO: reenable in next Emacs release
+; (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/init-eshell.el b/init-eshell.el
index 66ee9513151f..912f8ee82bd9 100644
--- a/init-eshell.el
+++ b/init-eshell.el
@@ -11,9 +11,7 @@
 
 (defun eshell-mode-hook-setup ()
   "Sets up EShell when it is loaded"
-
   (setq eshell-path-env (concat
-                         "/Applications/Postgres.app/Contents/MacOS/bin:"
 			 "/usr/local/bin:"
 			 (concat home-dir "/bin:")
 			 "/usr/local/share/python:"
diff --git a/init-functions.el b/init-functions.el
index 033c525eb5ce..233d40dd8b2e 100644
--- a/init-functions.el
+++ b/init-functions.el
@@ -20,13 +20,13 @@
     (unless (file-exists-p file)
       (url-copy-file url file))))
 
- (defun custom-download-script (url filename)
+(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"))
-
+  
   ;; Download file if it doesn't exist.
   (let ((file
          (concat "~/.emacs.d/other/" filename)))
@@ -69,30 +69,6 @@
         (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)
@@ -111,22 +87,6 @@ Including indent-buffer, which should not be called automatically on save."
   (indent-buffer))
 
 ;; These come from the emacs starter kit
-(defun esk-pretty-lambdas ()
-  (font-lock-add-keywords
-   nil `(("(?\\(lambda\\>\\)"
-          (0 (progn (compose-region (match-beginning 1) (match-end 1)
-                                    ,(make-char 'greek-iso8859-7 107))
-                    nil))))))
-
-(defun esk-eval-and-replace ()
-  "Replace the preceding sexp with its value."
-  (interactive)
-  (backward-kill-sexp)
-  (condition-case nil
-      (prin1 (eval (read (current-kill 0)))
-             (current-buffer))
-    (error (message "Invalid expression")
-           (insert (current-kill 0)))))
 
 (defun esk-add-watchwords ()
   (font-lock-add-keywords
@@ -139,8 +99,4 @@ Including indent-buffer, which should not be called automatically on save."
       (find-file (concat "/sudo:root@localhost:" (ido-read-file-name "File: ")))
     (find-alternate-file (concat "/sudo:root@localhost:" buffer-file-name))))
 
-(defun speak (m &optional voice)
-  (shell-command (if 'voice (concat "say -v " voice " \"" m "\"")
-                   (concat "say " m))))
-
 (provide 'init-functions)
diff --git a/init-modes.el b/init-modes.el
index 9c766de69d54..55b25358bfc2 100644
--- a/init-modes.el
+++ b/init-modes.el
@@ -1,13 +1,9 @@
 (mapc 'require '(projectile hi2 ac-nrepl yasnippet))
 ;; Initializes modes I use.
 
-(add-hook 'prog-mode-hook 'esk-pretty-lambdas)
 (add-hook 'prog-mode-hook 'esk-add-watchwords)
 (add-hook 'prog-mode-hook 'idle-highlight-mode)
 
-;; Yasnippet everywhere + activate Clojure snippets!
-(yas-global-mode 1)
-
 ;; Configure markdown-mode
 (autoload 'markdown-mode "markdown-mode"
   "Major mode for editing Markdown files" t)
@@ -15,14 +11,12 @@
 (add-to-list 'auto-mode-alist '("\\.markdown\\'" . markdown-mode))
 (add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode))
 
-;; Add keybindings to move nested blocks with C-, rsp. C-.
-(define-key haskell-mode-map (kbd "C-,") 'haskell-move-nested-left)
-(define-key haskell-mode-map (kbd "C-.") 'haskell-move-nested-right)
-
 ;; Use auto-complete as completion at point
 (defun set-auto-complete-as-completion-at-point-function ()
   (setq completion-at-point-functions '(auto-complete)))
-(add-hook 'auto-complete-mode-hook 'set-auto-complete-as-completion-at-point-function)
+
+(add-hook 'auto-complete-mode-hook
+          'set-auto-complete-as-completion-at-point-function)
 
 
 ;; Configure nrepl (Clojure REPL) and clojure-mode
@@ -30,12 +24,12 @@
 (defun nrepl-mode-setup ()
   "Activates paredit, rainbow delimiters and ac-nrepl"
   (ac-nrepl-setup)
-  (rainbow-delimiters-mode)
-  (paredit-mode))
+  (rainbow-delimiters-mode 1)
+  (paredit-mode 1))
 
 ;; Use ac-nrepl for completion
 (add-hook 'nrepl-mode-hook 'nrepl-mode-setup)
-(add-hook 'nrepl-interaction-mode-hook 'ac-nrepl-setup)
+(add-hook 'nrepl-interaction-mode-hook 'nrepl-mode-setup)
 
 ;; I want history up/down without modifiers
 (define-key nrepl-repl-mode-map (kbd "<up>") 'nrepl-backward-input)
diff --git a/init-settings.el b/init-settings.el
index e691328e132d..4f78a8cc104c 100644
--- a/init-settings.el
+++ b/init-settings.el
@@ -1,6 +1,7 @@
 (require 'uniquify)
-;; ## Generic settings ##
+; ## Generic settings ##
 
+; Hide those ugly tool bars
 (tool-bar-mode -1)
 (scroll-bar-mode -1)
 
@@ -12,11 +13,8 @@
 
 ;;; Code:
 
-(add-to-list 'load-path "/usr/local/share/emacs/site-lisp/mu4e")
-
 (add-to-list 'exec-path "/usr/local/bin")
 (add-to-list 'exec-path (expand-file-name "~/bin"))
-(add-to-list 'exec-path "/Applications/Racket/bin")
 
 
 (when window-system
@@ -25,6 +23,7 @@
   (mouse-wheel-mode t)
   (blink-cursor-mode -1))
 
+; Fix some defaults
 (setq visible-bell t
       inhibit-startup-message t
       color-theme-is-global t
@@ -75,43 +74,22 @@
 (prefer-coding-system 'utf-8) ; with sugar on top
 
 (require 'ffap)
-(defvar ffap-c-commment-regexp "^/\\*+"
-  "Matches an opening C-style comment, like \"/***\".")
-
-(defadvice ffap-file-at-point (after avoid-c-comments activate)
-  "Don't return paths like \"/******\" unless they actually exist.
-
-This fixes the bug where ido would try to suggest a C-style
-comment as a filename."
-  (ignore-errors
-    (when (and ad-return-value
-               (string-match-p ffap-c-commment-regexp
-                               ad-return-value)
-               (not (ffap-file-exists-string ad-return-value)))
-      (setq ad-return-value nil))))
 
 (defalias 'yes-or-no-p 'y-or-n-p)
 (defalias 'auto-tail-revert-mode 'tail-mode)
 
-;; Hippie expand: at times perhaps too hip
-(eval-after-load 'hippie-exp
-  '(progn
-     (dolist (f '(try-expand-line try-expand-list try-complete-file-name-partially))
-       (delete f hippie-expand-try-functions-list))
-     
-     ;; Add this back in at the end of the list.
-     (add-to-list 'hippie-expand-try-functions-list 'try-complete-file-name-partially t)))
-
 ;; ## Look and feel ##
 
 ;; Themes! I download and install the ones I like and default the one
 ;; I currently like most. This changes a lot because I hate
 ;; everything. (It's in my nature, don't judge)
-(custom-download-theme "https://raw.github.com/owainlewis/emacs-color-themes/master/themes/hickey-theme.el"
-                       "hickey-theme.el")
+(custom-download-theme
+ "https://raw.github.com/owainlewis/emacs-color-themes/master/themes/hickey-theme.el"
+ "hickey-theme.el")
 
-(custom-download-theme "https://raw.github.com/rexim/gruber-darker-theme/master/gruber-darker-theme.el"
-                       "gruber-darker-theme.el")
+(custom-download-theme
+ "https://raw.github.com/rexim/gruber-darker-theme/master/gruber-darker-theme.el"
+ "gruber-darker-theme.el")
 
 (load-theme 'gruber-darker t)
 
@@ -126,18 +104,16 @@ comment as a filename."
 (set-variable 'nyan-wavy-trail t)
 
 ;; Style line numbers (shown with M-g g)
-(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"))
+(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)))
 
 (eval-after-load 'diff-mode
   '(progn
@@ -173,9 +149,6 @@ comment as a filename."
 ;; Menu bar doesn't take up additional space, so lets use it.
 (menu-bar-mode 1)
 
-;; Don't use Apple's native fullscreen (FIXME: Change with Mavericks)
-(setq ns-use-native-fullscreen nil)
-
 ;; Auto refresh buffers
 (global-auto-revert-mode 1)
 
@@ -192,11 +165,6 @@ comment as a filename."
 ;; Make emacs behave sanely (overwrite selected text)
 (delete-selection-mode 1)
 
-(defun toggle-native-fullscreen ()
-  "Toggles between native and non-native OS X fullscreen"
-  (interactive)
-  (setq ns-use-native-fullscreen (not ns-use-native-fullscreen)))
-
 ;; ## Navigation and key bindings ##
 
 (setq windmove-wrap-around t)
diff --git a/init.el b/init.el
index 473a7b677789..861f64ce225e 100644
--- a/init.el
+++ b/init.el
@@ -1,3 +1,7 @@
+;; Emacs 24 or higher!
+(when (< emacs-major-version 24)
+  (error "This setup requires Emacs v24, or higher. You have: v%d" emacs-major-version))
+
 ;; Configure package manager
 (require 'package)
 
@@ -6,7 +10,7 @@
 
 ;; ... and melpa. Melpa packages that exist on marmalade will have
 ;; precendence.
-(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/"))
+;(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/"))
 
 (package-initialize)
 
@@ -14,21 +18,16 @@
   (package-refresh-contents))
 
 (defvar my-pkgs
-  '(ac-nrepl
+  '(; Basic functionality
     ace-jump-mode
     browse-kill-ring
-    clojure-mode
-    flycheck
     flx-ido
-    haskell-mode
-    hi2
+    flycheck
     idle-highlight-mode
     ido-ubiquitous
     iy-go-to-char
     magit
-    markdown-mode
     multiple-cursors
-    nrepl
     nyan-mode
     paredit
     projectile
@@ -37,9 +36,26 @@
     smex
     switch-window
     undo-tree
-    yasnippet)
+
+    ; Clojure
+    ac-nrepl
+;    clojure-cheatsheet
+    clojure-mode
+    nrepl
+;    nrepl-eval-sexp-fu
+)
   "A list of packages to install at launch.")
 
+(defvar evil-pkgs
+  '(evil
+    evil-leader
+;    evil-tabs
+    evil-paredit
+    key-chord
+    surround)
+  "Evil related packages"
+)
+
 (dolist (p my-pkgs)
   (when (not (package-installed-p p))
     (package-install p)))
@@ -47,39 +63,41 @@
 ;; Are we on a mac?
 (setq is-mac (equal system-type 'darwin))
 
-(add-to-list 'load-path user-emacs-directory)
-
-(require 'init-functions)
+;; Is this being used by a vim user?
+(setq is-vim-mode t)
 
-(unless (file-exists-p "~/.emacs.d/snippets")
-  (make-directory "~/.emacs.d/snippets"))
+(when is-vim-mode
+  (dolist (p evil-pkgs)
+    (when (not (package-installed-p p))
+      (package-install p))))
 
-(custom-clone-git "http://github.com/swannodette/clojure-snippets"
-                  "snippets/clojure-mode")
+(add-to-list 'load-path user-emacs-directory)
 
-(mapc 'require '(init-settings
+(mapc 'require '(init-functions
+                 init-settings
                  init-modes
                  init-bindings
                  init-eshell))
 
+(when is-vim-mode
+  (require 'init-evil))
+
 (add-to-list 'load-path "~/.emacs.d/scripts/")
 
 (setq custom-file "~/.emacs.d/init-custom.el")
 (load custom-file)
 
-(custom-download-script "https://gist.github.com/gongo/1789605/raw/526e3f21dc7d6cef20951cf0ce5d51b90b7821ff/json-reformat.el"
-                        "json-reformat.el")
+(custom-download-script
+ "https://gist.github.com/gongo/1789605/raw/526e3f21dc7d6cef20951cf0ce5d51b90b7821ff/json-reformat.el"
+ "json-reformat.el")
 
 ;; A file with machine specific settings.
 (load-file-if-exists "~/.emacs.d/init-local.el")
 
-;; IRC configuration (erc)
+;; IRC configuration
 ;; Actual servers and such are loaded from irc.el
 (load-file-if-exists "~/.emacs.d/init-irc.el")
 
-;; Mail configuration (mu4e && mbsync)
-(load-file-if-exists "~/.emacs.d/init-mail.el")
-
 ;; Load magnars' string manipulation library
 (require 's)