]> git.rkrishnan.org Git - .emacs.d.git/blobdiff - init.el
add dumb-jump mode
[.emacs.d.git] / init.el
diff --git a/init.el b/init.el
index 90160e6db8edfc71c5c37ab3e2d21bf869b14a0f..638d24df44275ec1c76a66a572e790ee9d8d833c 100644 (file)
--- a/init.el
+++ b/init.el
-(setq load-path (cons "~/.emacs.d/emacs" load-path))
+(package-initialize)
+(show-paren-mode 1)
+;; y-or-n instead of yes-or-no
+(defalias 'yes-or-no-p 'y-or-n-p)
 
-(load "my-c-mode.el")
-(load "my-generic-stuff.el")
-(load "my-search.el")
+;; Don't show startup msg, don't store tilde files
+(setq make-backup-files nil)
+(setq initial-scratch-message "")
+(setq inhibit-startup-message t)
 
-;; color themes
-(add-to-list 'custom-theme-load-path "~/.emacs.d/themes")
-(load-theme 'zenburn t)
+(setq initial-frame-alist (quote ((fullscreen . maximized))))
+(setq send-mail-function (quote smtpmail-send-it))
 
-;; setup font
+;; turn OFF syntax highlighting
+;; (global-font-lock-mode 0)
 
-(if (>= emacs-major-version 23)
-    (setq default-frame-alist '((font . "Inconsolata-12")))
-  (set-default-font
-   "-Misc-Fixed-Medium-R-Normal--15-140-75-75-C-90-ISO8859-1"))
+;; cursor bar
+(setq-default cursor-type '(bar . 2))
 
-;; (set-default-font "-unknown-Inconsolata-normal-normal-normal-*-16-*-*-*-m-8-iso10646-1")
+;; column number
+(column-number-mode 1)
 
-(setq-default indent-tabs-mode nil)
-
-(add-hook 'emacs-lisp-mode-hook
-         (lambda () (which-function-mode t)))
+;; font
+;; (set-default-font "Inconsolata-12")
+;; (set-default-font "InconsolataGo-12")
+;; set a default font
+(when (member "DejaVu Sans Mono" (font-family-list))
+  (set-face-attribute 'default nil :font "DejaVu Sans Mono-11"))
 
-;;; erc
-(require 'erc)
+;; Don't let Emacs hurt your ears
+(setq visible-bell t)
 
-;; Load authentication info from an external source.  Put sensitive
-;; passwords and the like in here.
-(load "~/.emacs.d/emacs/.erc-auth")
+;; Who use the bar to scroll?
+(when (display-graphic-p)
+  (progn
+    (scroll-bar-mode 0)
 
-(require 'erc-services)
-(require 'erc-match)
-(erc-services-mode 1)
+    (tool-bar-mode 0)
+    (menu-bar-mode 0)))
 
-(setq erc-prompt-for-nickserv-password nil)
+;; tangotango
+;;(load-theme 'tangotango t)
+;; (load-theme 'railscasts t)
+(load-theme 'leuven t)
 
-(setq erc-nickserv-passwords
-      `((freenode     (("vu3rdd" . ,freenode-nick-pass)))
-       (debian       (("vu3rdd" . ,debian-nick-pass)))))
+;; erc
+(require 'erc)
+(require 'tls)
+;; (setq tls-program '("openssl s_client -connect %h:%p -no_ssl2 -ign_eof"))
 
+(erc-autojoin-mode t)
 (setq erc-autojoin-channels-alist
-      '((".*\\.freenode.net" "#racket" "#haskell")
-       (".*\\.oftc.net" "#debian-arm" "#debian" "#debian-devel")))
-
-(global-set-key "\C-cef" (lambda () (interactive)
-                          (erc :server "irc.freenode.net" :port "8000"
-                               :nick "vu3rdd")))
-(global-set-key "\C-ced" (lambda () (interactive)
-                          (erc :server "irc.debian.org" :port "6668"
-                               :nick "vu3rdd")))
-
-(setq erc-user-full-name "Ramakrishnan Muthukrishnan")
-(setq erc-email-userid "vu3rdd@gmail.com")
-
-(require 'erc-track)
-(erc-track-mode 1)
-(setq erc-track-switch-direction 'importance)
-
-;; Only track my nick(s)
-(defadvice erc-track-find-face (around erc-track-find-face-promote-query activate)
-  (if (erc-query-buffer-p)
-      (setq ad-return-value (intern "erc-current-nick-face"))
-    ad-do-it))
-
-(setq erc-keywords '("vu3rdd" "rkrishnan"))
+      '((".*\\.freenode.net" "#tahoe-lafs")
+        (".*\\.oftc.net" "#leastauthority")
+        ;;(".*\\.mozilla.org" "#rust-beginners")
+        ))
 
+;; check channels
+(erc-track-mode t)
 (setq erc-track-exclude-types '("JOIN" "NICK" "PART" "QUIT" "MODE"
-                                "324" "329" "332" "333" "353" "477"))
-
-(global-set-key (kbd "C-c SPC") 'erc-track-switch-buffer)
-
-;; erc notification via notify
-(defun clean-message (s)
-  (setq s (replace-regexp-in-string "'" "'"
-  (replace-regexp-in-string "\"" """
-  (replace-regexp-in-string "&" "&"
-  (replace-regexp-in-string "<" "&lt;"
-  (replace-regexp-in-string ">" "&gt;" s)))))))
-
-(defun call-libnotify (matched-type nick msg)
-  (let* ((cmsg  (split-string (clean-message msg)))
-        (nick   (first (split-string nick "!")))
-        (msg    (mapconcat 'identity (rest cmsg) " ")))
-    (shell-command-to-string
-     (format "notify-send -t 5000 -u critical '%s says:' '%s'" nick msg))))
-
-(add-hook 'erc-text-matched-hook 'call-libnotify)
-
-;; Enable logging
-(setq erc-log-insert-log-on-open nil)
-(setq erc-log-channels t)
-(setq erc-log-channels-directory "~/.erc/logs/")
-(setq erc-save-buffer-on-part t)
-(setq erc-save-queries-on-quit nil
-      erc-log-write-after-send t
-      erc-log-write-after-insert t)
-(defadvice save-buffers-kill-emacs (before save-logs (arg) activate)
-  (save-some-buffers t (lambda () (when (and (eq major-mode 'erc-mode)
-                                            (not (null buffer-file-name)))))))
-(add-hook 'erc-insert-post-hook 'erc-save-buffer-in-logs)
-
-;; iswitch
-(iswitchb-mode 1)
-
-;; smooth scroll
-(setq scroll-conservatively 1)
-(put 'upcase-region 'disabled nil)
-
-(put 'downcase-region 'disabled nil)
-
-;; cscope
-(require 'xcscope)
-
-(defun match-paren (arg)
-  "Go to the matching paren if on a paren; otherwise insert %."
-  (interactive "p")
-  (cond ((looking-at "\\s\(") (forward-list 1) (backward-char 1))
-       ((looking-at "\\s\)") (forward-char 1) (backward-list 1))
-       (t (self-insert-command (or arg 1)))))
-
-;; emacs window size according to screen resolution
-;; from stackoverflow.com
-;;  - <http://stackoverflow.com/questions/92971/how-do-i-set-the-size-of-emacs-window>
-(defun set-frame-size-according-to-resolution ()
-  (interactive)
-  (if window-system
-      (progn
-       ;; use 120 char wide window for largeish displays
-       ;; and smaller 80 column windows for smaller displays
-       ;; pick whatever numbers make sense for you
-       (if (> (x-display-pixel-width) 1280)
-           (add-to-list 'default-frame-alist (cons 'width 80))
-         (add-to-list 'default-frame-alist (cons 'width 78)))
-       ;; for the height, subtract a couple hundred pixels
-       ;; from the screen height (for panels, menubars and
-       ;; whatnot), then divide by the height of a char to
-       ;; get the height we want
-       (add-to-list 'default-frame-alist
-                    (cons 'height (/ (- (x-display-pixel-height) 0) (frame-char-height)))))))
-
-(set-frame-size-according-to-resolution)
-
-(require 'tramp)
-
-;; cut and paste with the rest of ecosystem in X
-(setq x-select-enable-clipboard t)
-
-;; tramp
- (setq tramp-default-method "ssh")
-
-;; copy a line
-(defun duplicate-current-line ()
-  (interactive)
-  (beginning-of-line nil)
-  (let ((b (point)))
-    (end-of-line nil)
-    (copy-region-as-kill b (point)))
-  (back-to-indentation))
-
-;; (global-set-key "\C-b" 'duplicate-current-line)
-
-;;
-;;  Start GNUServe process when starting up.  This lets us send new files
-;; to previously spawned emacs process.
-;;
-;(load "gnuserv-compat")
-;(load-library "gnuserv")
-;(gnuserv-start)
-;; When loading files reuse existing frames.
-;(setq gnuserv-frame (car (frame-list)))
-
-;; remove toolbar
-(if (> emacs-major-version 20)
-    (tool-bar-mode -1))
-
-;; org mode
-(require 'org-install)
-(add-to-list 'auto-mode-alist '("\\.org$" . org-mode))
-(define-key global-map "\C-cl" 'org-store-link)
-(define-key global-map "\C-ca" 'org-agenda)
-(define-key global-map "\C-cb" 'org-iswitchb)
-(setq org-log-done 'time)
-(setq org-startup-indented t)
-
-(setq org-agenda-files (list "~/org/work.org"
-                            "~/org/remember.org"
-                            "~/org/debian.org"
-                            "~/org/clojure.org"
-                            "~/org/learning.org"
-                            "~/org/reading.org"
-                            "~/org/investments.org"))
-
-;; adapted from <http://doc.norang.ca/org-mode.html>
-(setq org-todo-keywords '((sequence "TODO(t)"
-                                    "STARTED(s!)"
-                                    "|"
-                                    "DONE(d!/!)")
-                          (sequence "WAITING(w@/!)"
-                                    "SOMEDAY(S!)"
-                                    "|"
-                                    "CANCELLED(c@/!)")))
-
-(setq org-todo-keyword-faces (quote (("TODO" :foreground "red" :weight bold)
-                                    ("STARTED" :foreground "blue" :weight bold)
-                                    ("DONE" :foreground "forest green" :weight bold)
-                                    ("WAITING" :foreground "orange" :weight bold)
-                                    ("SOMEDAY" :foreground "magenta" :weight bold)
-                                    ("CANCELLED" :foreground "forest green" :weight bold))))
-
-;; common lisp
-;; Set up the Common Lisp environment
-;(add-to-list 'load-path "/usr/share/common-lisp/source/slime/")
-;(setq inferior-lisp-program "/usr/bin/sbcl")
-;(require 'slime)
-;(slime-setup)
-
-;; cl-doc
-;(autoload 'turn-on-cldoc-mode "cldoc" nil t)
-
-;; clojure mode
-(add-to-list 'load-path "~/src/clojure-mode")
-(require 'clojure-mode)
-
-;; highlight parentheses mode
-(require 'highlight-parentheses)
-
-;; rainbow effect
-;; http://stackoverflow.com/questions/2413047/how-do-i-get-rainbow-parentheses-in-emacs
-;; (setq hl-paren-colors
-;;       '(;"#8f8f8f" ; this comes from Zenburn
-;;                    ; and I guess I'll try to make the far-outer parens look like this
-;;         "orange1" "yellow1" "greenyellow" "green1"
-;;         "springgreen1" "cyan1" "slateblue1" "magenta1" "purple"))
-
-;; slime
-(add-to-list 'load-path "~/src/slime")
-
-(eval-after-load "slime"
-  '(progn
-     (setq slime-use-autodoc-mode nil)
-     (slime-setup '(inferior-slime
-                    ;; slime-asdf
-                    ;; slime-autodoc
-                    slime-banner
-                    ;; slime-c-p-c
-                    ;; slime-editing-commands
-                    slime-fancy-inspector
-                    slime-fancy
-                    slime-fuzzy
-                    ;; slime-highlight-edits
-                    ;; slime-parse
-                    ;; slime-presentation-streams
-                    ;; slime-presentations
-                    ;; slime-references
-                    slime-repl
-                    slime-scratch
-                    ;;slime-tramp
-                    ;;slime-typeout-frame
-                    slime-xref-browser
-                    slime-scheme))
-
-     (setq slime-protocol-version 'ignore)
-     (setq slime-complete-symbol*-fancy t)
-     (setq slime-complete-symbol-function 'slime-fuzzy-complete-symbol)))
-
-(require 'slime)
-;(setq inferior-lisp-program "~/src/sbcl/src/runtime/sbcl")
-(add-to-list 'slime-lisp-implementations '(sbcl ("/usr/bin/sbcl")))
-(setq slime-default-lisp 'sbcl)
-
-(add-to-list 'load-path "~/src/swank-clojure-extra")
-
-(setq  swank-clojure-classpath (append (list "/usr/share/java/clojure.jar"
-                                            "~/src/swank-clojure/src"
-                                            "~/.clojure")
-                                      (directory-files "/usr/share/java/"
-                                                       t
-                                                       ".jar$")))
-
-(setq swank-clojure-extra-vm-args (list "-server"
-                                       "-noverify"
-                                       "-Xincgc"
-                                       "-Djava.net.preferIPv4Stack=true"
-                                       "-Xms256m"
-                                       "-Xmx1024m"
-                                       "-XX:CompileThreshold=1500"
-                                       "-XX:+UseConcMarkSweepGC"
-                                       "-XX:+UseParNewGC"
-                                       "-XX:+ExplicitGCInvokesConcurrent"
-                                       "-XX:+CMSClassUnloadingEnabled"
-                                       "-XX:MaxPermSize=250m"
-                                       "-XX:+UseAdaptiveSizePolicy"
-                                       "-XX:+AggressiveOpts"
-                                       "-XX:+UseFastAccessorMethods"
-                                       "-XX:+UseFastEmptyMethods"
-                                       "-XX:+UseFastJNIAccessors"
-                                       "-Xverify:none"
-                                       "-XX:+UseCompressedOops"
-                                       "-XX:MaxInlineSize=1024"
-                                       "-XX:FreqInlineSize=1024"))
-
-;; swank gauche
-(setq swank-gauche-path "~/src/swank-gauche")
-(setq swank-gauche-gauche-source-path nil)
-
-(push swank-gauche-path load-path)
-(require 'swank-gauche)
-
-(add-to-list 'slime-lisp-implementations
-             '(gauche ("gosh") :init gauche-init :coding-system utf-8-unix))
-
-(eval-after-load "slime"
-  '(progn
-     (require 'swank-clojure-extra)
-     (add-to-list 'slime-lisp-implementations `(clojure ,(swank-clojure-cmd)
-                                                       :init swank-clojure-init)
-                 t)
-     (add-hook 'slime-indentation-update-hooks 'swank-clojure-update-indentation)
-     (add-hook 'slime-repl-mode-hook 'swank-clojure-slime-repl-modify-syntax t)
-     (add-hook 'clojure-mode-hook 'swank-clojure-slime-mode-hook t)))
-
-;; enable cldoc for slime
-;; (dolist (hook '(lisp-mode-hook
-;;                 slime-repl-mode-hook))
-;;   (add-hook hook 'turn-on-cldoc-mode))
-
-;; needed for overriding default method for invoking slime
-(ad-activate 'slime-read-interactive-args)
-
-;; paredit
-(autoload 'paredit-mode "paredit"
-  "Minor mode for pseudo-structurally editing Lisp code." t)
-
-(dolist (hook '(emacs-lisp-mode-hook
-                lisp-mode-hook
-                lisp-interaction-mode-hook
-                clojure-mode-hook
-                scheme-mode-hook))
-  (add-hook hook #'(lambda ()
-                     (highlight-parentheses-mode t)
-                     (paredit-mode +1))))
-
-;; clojure-test-mode
-(autoload 'clojure-test-mode "clojure-test-mode" "Clojure test mode" t)
-(autoload 'clojure-test-maybe-enable "clojure-test-mode" "" t)
-(add-hook 'clojure-mode-hook 'clojure-test-maybe-enable)
-
-;; pressing newline, should also indent automatically
-;; (global-set-key "\r" 'newline-and-indent)
-
-;; flyspell
-(autoload 'flyspell-mode "flyspell" "On-the-fly spelling checker." t)
-
-;;; fullscreen mode
-(defun switch-full-screen ()
-  (interactive)
-  (shell-command "wmctrl -r :ACTIVE: -btoggle,fullscreen"))
-
-(global-set-key [f10] 'switch-full-screen)
-
-;; (defun fullscreen (&optional f)
-;;   (interactive)
-;;   (set-frame-parameter f 'fullscreen
-;;                    (if (frame-parameter f 'fullscreen) nil 'fullboth)))
-
-;; (global-set-key [f10] 'fullscreen)
-
-;; (add-hook 'after-make-frame-functions 'fullscreen)
-
-;; gist integration
-(require 'gist)
+                                 "324" "329" "332" "333" "353" "477"))
+;; don't show any of this
+(setq erc-hide-list '("JOIN" "PART" "QUIT" "NICK"))
 
-;; mozrepl
-(autoload 'moz-minor-mode "moz" "Mozilla Minor and Inferior Mozilla Modes" t)
-
-(add-hook 'espresso-mode-hook 'espresso-custom-setup)
-(defun espresso-custom-setup ()
-  (moz-minor-mode 1))
-
-;; browse url
-(setq browse-url-browser-function 'browse-url-generic
-      browse-url-generic-program "/usr/bin/iceweasel"
-      browse-url-new-window-flag  t
-      browse-url-firefox-new-window-is-tab t)
-(define-key global-map "\C-co" 'browse-url-at-point)
-
-;; nxml for editing xml files
-(setq auto-mode-alist
-      (cons '("\\.\\(xml\\|xsl\\|rng\\|xhtml\\)\\'" . nxml-mode)
-            auto-mode-alist))
-
-;; completions enhancements
-(icomplete-mode t)
+(defun start-erc ()
+  "Connect to IRC."
+  (interactive)
+  (when (y-or-n-p "Do you want to start IRC? ")
+    ;; (erc-tls :server "irc.mozilla.org" :port 6697 :nick "rkrishnan" :full-name "Ramakrishnan Muthukrishnan")
+    (erc-tls :server "irc.freenode.net" :port 6697 :nick "rkrishnan" :full-name "Ramakrishnan Muthukrishnan")
+    (erc-tls :server "irc.oftc.net" :port 6697 :nick "rkrishnan" :full-name "Ramakrishnan Muthukrishnan")))
 
-;; Interactively Do Things mode
-(require 'ido)
+;; switch to ERC with Ctrl+c e
+(global-set-key (kbd "C-c e") 'start-erc) ;; ERC
 
-(ido-mode t)
+;; ido
 (setq ido-enable-flex-matching t)
-(setq ido-enable-last-directory-history nil)
-
-;; browse kill ring
-(when (require 'browse-kill-ring nil 'noerror)
-  (browse-kill-ring-default-keybindings))
-
-;; magit-status bound to Cx-g
-(global-set-key (kbd "C-x g") 'magit-status)
-
-;; sql mode
-(require 'sql)
+(setq ido-everywhere t)
+(ido-mode 1)
 
-;; rainbox mode for CSS color highlighting
-(require 'rainbow-mode)
+;; disable tabs for indentation
+(setq-default indent-tabs-mode nil)
 
-;; rudel (remote pairing/collaborative editing)
-;(add-to-list 'load-path "~/src/rudel")
-;(load-file "~/src/rudel/rudel-loaddefs.el")
+;; (require 'whitespace)
+;; (setq whitespace-style '(face lines-tail))
+;; (setq whitespace-line-column 80)
+;; (global-whitespace-mode t)
 
-(add-to-list 'auto-mode-alist '("\\.rkt$" . scheme-mode))
+;; ;; show trailing whitespaces
+;; (setq-default show-trailing-whitespace t)
+;; (setq-default indicate-empty-lines t)
 
-;; scheme auto complete
-(require 'scheme-complete)
-(autoload 'scheme-smart-complete "scheme-complete" nil t)
-(eval-after-load 'scheme
-  '(progn (define-key scheme-mode-map "\t" 'scheme-complete-or-indent)))
+;; C style
+(setq c-default-style "k&r"
+      c-basic-offset 4)
 
-;; autocomplete
-(add-to-list 'load-path "~/src/auto-complete/")
-(require 'auto-complete)
-(global-auto-complete-mode t)
+;; haskell
+(setenv "PATH" (concat "~/.cabal/bin:" (getenv "PATH")))
+(add-to-list 'exec-path "~/.cabal/bin")
+(add-hook 'haskell-mode-hook 'turn-on-haskell-doc-mode)
 
-;; slime autocomplete
-(add-to-list 'load-path "~/src/ac-slime/")
+;; haskell mode
+(require 'haskell-process)
+(require 'haskell-interactive-mode)
+(add-hook 'haskell-mode-hook 'interactive-haskell-mode)
 
-(require 'ac-slime)
-(set-default 'ac-sources 'ac-source-slime-simple)
-(add-hook 'slime-mode-hook 'set-up-slime-ac)
-(add-hook 'slime-repl-mode-hook 'set-up-slime-ac)
+(setq haskell-process-suggest-remove-import-lines t)
+(setq haskell-process-auto-import-loaded-modules t)
+(setq haskell-process-log t)
 
-;; scheme/quack
-;(require 'quack)
-;(setq scheme-program-name "racket")
-;(setq quack-default-program "racket -il racket/base")
-;(setq quack-switch-to-scheme-method 'other-window)
-;(setq quack-newline-behavior 'indent-newline-indent)
+(define-key haskell-mode-map (kbd "C-c C-l") 'haskell-process-load-or-reload)
+(define-key haskell-mode-map (kbd "C-`") 'haskell-interactive-bring)
+(define-key haskell-mode-map (kbd "C-c C-t") 'haskell-process-do-type)
+(define-key haskell-mode-map (kbd "C-c C-i") 'haskell-process-do-info)
+(define-key haskell-mode-map (kbd "C-c C-c") 'haskell-process-cabal-build)
+(define-key haskell-mode-map (kbd "C-c C-k") 'haskell-interactive-mode-clear)
+(define-key haskell-mode-map (kbd "C-c c") 'haskell-process-cabal)
 
-(defun racket-enter! ()
-  (interactive)
-  (comint-send-string (scheme-proc)
-        (format "(enter! (file \"%s\") #:verbose)\n" buffer-file-name))
-  (switch-to-scheme t))
-(local-set-key "\C-c\C-v" 'racket-enter!)
-
-;; company-mode
-(add-to-list 'load-path "~/src/company-mode")
-(autoload 'company-mode "company" nil t)
-
-;; handle trailing whitespaces
-;(add-hook 'before-save-hook 'delete-trailing-whitespace)
-
-;; update copyright years before saving.
-;(add-hook 'before-save-hook 'copyright-update)
-
-;; la carte mode (access menu from keyboard)
-(require 'lacarte)
-
-;;; Based on code by Rudi Schlatte.
-;;; Needs this library:
-;;; http://www.emacswiki.org/cgi-bin/wiki/XmlRpc
-(require 'xml-rpc)
-
-(defvar lisppaste-nick "vu3rdd")
-(defvar lisppaste-channel "None")
-(defvar lisppaste-colorize-as "Scheme")
-(defvar lisppaste-prev-title "")
-
-(defun lisppaste-region (region-begin region-end
-                                      &optional channel username title annotate)
-  (interactive "r")
-  (let* ((content (buffer-substring region-begin region-end))
-         (channel (or channel
-                      (read-from-minibuffer "Channel: " lisppaste-channel)))
-         (username (or username (read-from-minibuffer "Nick: " lisppaste-nick)))
-         (title (or title (read-from-minibuffer "Title: " lisppaste-prev-title)))
-         (annotate (or annotate (string-to-number (read-from-minibuffer "Annotate? "))))
-         (colorize-as (if (zerop annotate) (read-from-minibuffer "Colorize as (empty for default): " lisppaste-colorize-as))))
-    (setf lisppaste-prev-title title)
-    (let* ((ret (xml-rpc-method-call "http://common-lisp.net:8185/RPC2" 'newpaste
-                                     channel username title content (or colorize-as annotate)))
-           (url-beg (search "http://" ret))
-           (url-end (and url-beg (search " " ret :start2 url-beg)))
-           (url (and url-end (substring ret url-beg url-end))))
-      (print ret)
-      (and url (browse-url url))
-      (or url ret))))
-
-;; (require 'color-theme-zenburn)
-;;(color-theme-zenburn)
-
-(add-to-list 'load-path "~/.emacs.d/emacs/twittering-mode")
-(require 'twittering-mode)
-(add-hook 'twittering-edit-mode-hook (lambda () (ispell-minor-mode) (flyspell-mode)))
-
-(require 'ac-python)
-
-;;; Use python-mode with files with these extensions
-(add-to-list 'auto-mode-alist '("\\.py\\'" . python-mode))
-(add-to-list 'auto-mode-alist '("\\.pyx\\'" . python-mode))
-
-;;; Turn on auto-complete in python shells
-(add-hook 'inferior-python-mode-hook (lambda () (auto-complete-mode 1)))
-
-;;; Use python major mode if 'python' is in hashbang.
-(add-to-list 'interpreter-mode-alist '("python" . python-mode))
-
-;;; Use python as the python interpreter (can be changed to "ipython" in time
-;;; when it works)
-(setq python-python-command "python")
-
-;;; Check files for pep8 mistakes
-(autoload 'python-pep8 "python-pep8")
-(autoload 'pep8 "python-pep8")
-
-;;; displays "\" at the end of lines that wrap
-(setq longlines-show-hard-newlines t)
-
-;;; haskell mode
+;; ghc-mod
+;;(autoload 'ghc-init "ghc" nil t)
+;;(autoload 'ghc-debug "ghc" nil t)
+;;(setq ghc-debug t)
+;;(add-hook 'haskell-mode-hook (lambda () (ghc-init)))
+
+;; hlint
+(add-to-list 'load-path "~/.emacs.d/hs-lint")
+(require 'hs-lint)
+(defun my-haskell-mode-hook ()
+   (local-set-key "\C-cl" 'hs-lint))
+
+(add-hook 'haskell-mode-hook 'my-haskell-mode-hook)
+
+;; hindent
+(add-hook 'haskell-mode-hook #'hindent-mode)
+
+;; gofmt
+(add-hook 'before-save-hook #'gofmt-before-save)
+(add-hook 'go-mode-hook (lambda ()
+                          (local-set-key (kbd "C-c C-r")
+                                         'go-remove-unused-imports)))
+(add-hook 'go-mode-hook (lambda ()
+                          (local-set-key (kbd "C-c i")
+                                         'go-goto-imports)))
+
+;; asp
+(add-to-list 'load-path "~/.emacs.d/asp-mode")
+(autoload 'asp-mode "asp-mode")
 (setq auto-mode-alist
-      (append auto-mode-alist
-              '(("\\.[hg]s$"  . haskell-mode)
-                ("\\.hic?$"   . haskell-mode)
-                ("\\.hsc$"    . haskell-mode)
-                ("\\.chs$"    . haskell-mode)
-                ("\\.l[hg]s$" . literate-haskell-mode))))
-(autoload 'haskell-mode "haskell-mode"
-  "Major mode for editing Haskell scripts." t)
-(autoload 'literate-haskell-mode "haskell-mode"
-  "Major mode for editing literate Haskell scripts." t)
-
-;adding the following lines according to which modules you want to use:
-(require 'inf-haskell)
-
-(add-hook 'haskell-mode-hook 'turn-on-font-lock)
-(add-hook 'haskell-mode-hook 'turn-on-haskell-ghci)
-(add-hook 'haskell-mode-hook 'turn-on-haskell-doc-mode)
-(add-hook 'haskell-mode-hook 'turn-on-haskell-indent)
-(set-variable 'haskell-program-name "ghci")
-
-;; chicken swank
-(add-to-list 'load-path "/var/lib/chicken/6/")
-(autoload 'chicken-slime "chicken-slime" "SWANK backend for Chicken" t)
-(setq slime-csi-path "/usr/bin/csi")
-(add-hook 'scheme-mode-hook
-          (lambda ()
-            (slime-mode t)))
-
-;; javascript mode
-(autoload 'js2-mode "js2-mode" nil t)
-(add-to-list 'auto-mode-alist '("\\.js$" . js2-mode))
-
-;; swank-js
-(add-to-list 'load-path "~/src/swank-js/")
-(require 'slime-js)
-
-;; geiser for Scheme programming
-;(load-file "~/src/geiser/elisp/geiser.el")
-
-;; geiser racket
-;(setq geiser-guile-binary "racket")
-;(setq geiser-active-implementations '(racket))
-
-;; flymake
-(require 'flymake)
-(defun flymake-racket-init ()
-  (let* ((temp-file (flymake-init-create-temp-buffer-copy
-                     'flymake-create-temp-inplace))
-         (local-file (file-relative-name
-                      temp-file
-                      (file-name-directory buffer-file-name))))
-    (list "racket" (list "-qf" local-file))))
-
-(push '("\\.rkt\\'" flymake-racket-init)
-      flymake-allowed-file-name-masks)
+      (cons '("\\.asp\\'" . asp-mode) auto-mode-alist))
 
+;; line-number-mode
+(global-linum-mode t)
+(global-hl-line-mode 0)
 
-;; ghc-mod
-(autoload 'ghc-init "ghc" nil t)
-(add-hook 'haskell-mode-hook
-          (lambda ()
-            (ghc-init)
-            (require 'auto-complete-config)
-            (auto-complete-mode t)
-            (add-to-list 'ac-sources 'ac-source-ghc-mod)))
-;; haskell-mode hooks
-(add-hook 'haskell-mode-hook 'capitalized-words-mode)
-(add-hook 'haskell-mode-hook 'turn-on-haskell-decl-scan)
-
-;; sml
-(autoload 'sml-mode "sml-mode" "Major mode for editing SML." t)
-(autoload 'run-sml "sml-proc" "Run an inferior SML process." t)
-
-;; notmuch for email/searching
-(require 'notmuch)
-(require 'gnus-art)
-
-;; sending email
-;; sending mail
-(setq message-send-mail-function 'message-send-mail-with-sendmail
-      mail-specify-envelope-from t      ; Settings to work with msmtp
-      message-sendmail-f-is-evil nil  
-      mail-envelope-from 'header
-      message-sendmail-envelope-from 'header
-      sendmail-program "/usr/bin/msmtp"
-      user-full-name "Ramakrishnan Muthukrishnan")
+;; fci -- fill-column-indicator
+(setq fci-rule-column 81)
+(setq fci-rule-width 1)
+(setq fci-rule-color "darkblue")
 
-(setq message-kill-buffer-on-exit t) ; kill buffer after sending mail)
+;; turn off electric-indent-mode
+(when (fboundp 'electric-indent-mode) (electric-indent-mode -1))
 
-(setq notmuch-fcc-dirs "Gmail/Sent") ; stores sent mail to the specified directory
-(setq message-directory "Gmail/Drafts") ; stores postponed messages to the specified directory
+;; notmuch
+(setq mail-user-agent 'message-user-agent)
+(setq user-mail-address "ram@rkrishnan.org"
+      user-full-name "Ramakrishnan Muthukrishnan")
 
+;; smtp
+(setq smtpmail-stream-type 'ssl
+      smtpmail-smtp-server "mail.messagingengine.com"
+      smtpmail-smtp-service 465)
+
+;; addressbook
+(require 'notmuch-address)
+(setq notmuch-address-command "/usr/bin/notmuch-addrlookup")
+;;(notmuch-address-message-insinuate)
+
+(require 'smtpmail)
+(setq message-send-mail-function 'smtpmail-send-it)
+(require 'starttls)
+
+;; sign all emails
+(add-hook 'message-setup-hook 'mml-secure-message-sign-pgp)
+
+;; company mode for auto completion
+(add-hook 'after-init-hook 'global-company-mode)
+
+;; Reduce the time after which the company auto completion popup opens
+(setq company-idle-delay 0.2)
+
+;; Reduce the number of characters before company kicks in
+(setq company-minimum-prefix-length 1)
+
+;; Set path to racer binary
+(setq racer-cmd "/home/ram/.cargo/bin/racer")
+
+(add-hook 'rust-mode-hook
+          '(lambda ()
+             (racer-activate)
+             (racer-turn-on-eldoc)
+             (add-hook 'flycheck-mode-hook #'flycheck-rust-setup)
+             (set (make-local-variable 'company-backends) '(company-racer))
+             (local-set-key (kbd "M-.") #'racer-find-definition)
+             (local-set-key (kbd "TAB") #'racer-complete-or-indent)))
+
+;; highlight todo
+;; (add-hook 'prog-mode-hook 'highlight-todos)
+
+;; Ledger
+(setq ledger-binary-path "~/.cabal/bin/hledger")
+
+;; golang
+(setq exec-path (cons "/usr/local/go/bin" exec-path))
+(add-to-list 'exec-path (concat (getenv "GOPATH") "/bin"))
+
+(defun go-mode-setup ()
+  (go-eldoc-setup)
+  (setq gofmt-command "goimports")
+  (add-hook 'before-save-hook 'gofmt-before-save))
+
+(add-hook 'go-mode-hook 'go-mode-setup)
+
+;; alias man to w.o.man
+(defalias 'man 'woman)
+
+;; eshell aliases
+(defun eshell/emacs (&rest args)
+  "open a file in emacs"
+  (if (null args)
+      (bury-buffer)
+    (mapc #'find-file (mapcar #'expand-file-name (eshell-flatten-list (reverse args))))))
+
+;(desktop-save-mode 1)
+
+;; which function?
+(which-func-mode 1)
+(add-to-list 'which-func-modes '(c-mode c++-mode rust-mode haskell-mode))
+
+;; flysheck
+(add-hook 'after-init-hook #'global-flycheck-mode)
+
+;; org-mode
+(setq org-todo-keywords
+      '((sequence "TODO(t)" "INPROGRESS(p)" "WAITING(w)" "|" "DONE" "CANCELLED")))
+
+(setq org-agenda-files '("~/src/org/"))
+(add-to-list 'load-path "~/.emacs.d/elisp")
+
+(require 'org-bullets)
+(add-hook 'org-mode-hook (lambda () (org-bullets-mode 1)))
+
+;; key shortcut for org-agenda
+(global-set-key (kbd "C-c a") 'org-agenda)
+
+(custom-set-variables
+ ;; custom-set-variables was added by Custom.
+ ;; If you edit it by hand, you could mess it up, so be careful.
+ ;; Your init file should contain only one such instance.
+ ;; If there is more than one, they won't work right.
+ '(package-selected-packages
+   (quote
+    (dumb-jump tangotango-theme restclient railscasts-theme racket-mode racer paredit notmuch markdown-mode magit leuven-theme ledger-mode hindent go-mode flycheck-rust flycheck-haskell fill-column-indicator company-racer color-theme-sanityinc-tomorrow auto-complete))))
+(custom-set-faces
+ ;; custom-set-faces was added by Custom.
+ ;; If you edit it by hand, you could mess it up, so be careful.
+ ;; Your init file should contain only one such instance.
+ ;; If there is more than one, they won't work right.
+ )
+
+(dumb-jump-mode)