-(tool-bar-mode 0)
-(menu-bar-mode 0)
-
-(setq load-path (cons "~/.emacs.d/emacs" load-path))
-
-;; color themes
-(add-to-list 'custom-theme-load-path "~/.emacs.d/themes")
-;(load-theme 'zenburn t)
-
+(show-paren-mode 1)
+;; y-or-n instead of yes-or-no
+(defalias 'yes-or-no-p 'y-or-n-p)
+
+;; Don't use messages that you don't rea
+(setq make-backup-files nil)
+(setq initial-scratch-message "")
+(setq inhibit-startup-message t)
+
+;; cursor bar
+(setq-default cursor-type '(bar . 2))
+
+;; column number
+(column-number-mode 1)
+
+;; font
+;; (set-default-font "Inconsolata-12")
+
+;; Don't let Emacs hurt your ears
+(setq visible-bell t)
+
+;; This is bound to f11 in Emacs 24.4
+;; (toggle-frame-fullscreen)
+(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.
+ '(initial-frame-alist (quote ((fullscreen . maximized))))
+ '(send-mail-function (quote smtpmail-send-it)))
+;; Who use the bar to scroll?
+(when (display-graphic-p)
+ (progn
+ (scroll-bar-mode 0)
+
+ (tool-bar-mode 0)
+ (menu-bar-mode 0)))
+
+; my-packages.el
(require 'package)
-(add-to-list 'package-archives
- '("marmalade" .
- "http://marmalade-repo.org/packages/"))
+(add-to-list 'package-archives
+ '("melpa" . "http://melpa.milkbox.net/packages/") t)
+(add-to-list 'package-archives
+ '("marmalade" . "http://marmalade-repo.org/packages/") t)
(package-initialize)
-(load "my-c-mode.el")
-(load "my-generic-stuff.el")
-(load "my-search.el")
-(load "my-erc.el")
-;; (load "my-org-mode.el")
-;; (load "my-slime.el")
-;; (load "my-twitter.el")
-;; (load "my-python.el")
-;; (load "my-haskell.el")
-;; (load "my-swank-js.el")
-
-(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)))))
-
-;; highlight parentheses mode
-(require 'highlight-parentheses)
-
-
-;; 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))))
-
-;; flyspell
-(autoload 'flyspell-mode "flyspell" "On-the-fly spelling checker." t)
-
-;; handle trailing whitespaces
-;(add-hook 'before-save-hook 'delete-trailing-whitespace)
-
-;; update copyright years before saving.
-;(add-hook 'before-save-hook 'copyright-update)
-
-;; sending email
-(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")
-
-(setq message-kill-buffer-on-exit t) ; kill buffer after sending mail)
+; fetch the list of packages available
+(unless package-archive-contents
+ (package-refresh-contents))
+
+;; make sure my list of packages are installed
+(setq package-list '(go-mode
+ rust-mode
+ haskell-mode
+ ghc
+ restclient
+ tangotango-theme
+ fill-column-indicator
+ paredit
+ leuven-theme
+ notmuch
+ railscasts-theme
+ racket-mode
+ auto-complete
+ magit
+ ledger-mode))
+
+; install the missing packages
+(dolist (package package-list)
+ (unless (package-installed-p package)
+ (package-install package)))
+
+;; tangotango
+;; (load-theme 'tangotango t)
+;; (load-theme 'railscasts t)
+;; (load-theme 'leuven t)
+
+;; 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" "#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"))
+;; don't show any of this
+(setq erc-hide-list '("JOIN" "PART" "QUIT" "NICK"))
+
+(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")))
+
+;; switch to ERC with Ctrl+c e
+(global-set-key (kbd "C-c e") 'start-erc) ;; ERC
+
+;; haskell mode
+(setenv "PATH" (concat "~/.cabal/bin:" (getenv "PATH")))
+(add-to-list 'exec-path "~/.cabal/bin")
+(add-hook 'haskell-mode-hook 'turn-on-haskell-doc-mode)
+
+;; haskell mode
+(require 'haskell-interactive-mode)
+(require 'haskell-process)
+(add-hook 'haskell-mode-hook 'interactive-haskell-mode)
+
+(custom-set-variables
+ '(haskell-process-suggest-remove-import-lines t)
+ '(haskell-process-auto-import-loaded-modules t)
+ '(haskell-process-log t)
+ '(haskell-process-type 'stack-ghci))
+
+(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)
+(define-key haskell-mode-map (kbd "SPC") 'haskell-mode-contextual-space)
+
+;; 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)))
+
+;; ido
+(setq ido-enable-flex-matching t)
+(setq ido-everywhere t)
+(ido-mode 1)
+
+;; disable tabs for indentation
+(setq-default indent-tabs-mode nil)
+
+;; (require 'whitespace)
+;; (setq whitespace-style '(face lines-tail))
+;; (setq whitespace-line-column 80)
+;; (global-whitespace-mode t)
+
+;; ;; show trailing whitespaces
+;; (setq-default show-trailing-whitespace t)
+;; (setq-default indicate-empty-lines t)
+
+;; C style
+(setq c-default-style "k&r"
+ c-basic-offset 4)
+
+;; 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)
+
+;; 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
+ (cons '("\\.asp\\'" . asp-mode) auto-mode-alist))
+
+;; line-number-mode
+(global-linum-mode t)
+(global-hl-line-mode 0)
+
+;; fci -- fill-column-indicator
+(setq fci-rule-column 81)
+(setq fci-rule-width 1)
+(setq fci-rule-color "darkblue")
+
+;; turn off electric-indent-mode
+(when (fboundp 'electric-indent-mode) (electric-indent-mode -1))
;; notmuch
-(setq gnus-inhibit-images nil)
-(add-to-list 'load-path "~/.emacs.d/emacs/notmuch")
-(setq notmuch-command "~/bin/remote-notmuch.sh")
-(require 'notmuch)
-(when (memq window-system '(mac ns))
- (exec-path-from-shell-initialize)
- (setq starttls-use-gnutls t)
- (setq starttls-gnutls-program "gnutls-cli")
- (setq starttls-extra-arguments nil)
- )
-(setq smtpmail-starttls-credentials '(("rkrishnan.org" 587 nil nil))
- smtpmail-auth-credentials (expand-file-name "~/.authinfo")
- smtpmail-default-smtp-server "rkrishnan.org"
- smtpmail-smtp-server "rkrishnan.org"
- smtpmail-smtp-service 587)
-
-(setq notmuch-fcc-dirs nil)
-(add-hook 'message-header-setup-hook
- (lambda () (insert (format "Bcc: %s <%s>\n"
- (notmuch-user-name)
- (notmuch-user-primary-email)))))
+(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 "~/bin/addrlookup")
+(setq notmuch-address-command "/usr/bin/notmuch-addrlookup")
(notmuch-address-message-insinuate)
(require 'smtpmail)
;; sign all emails
(add-hook 'message-setup-hook 'mml-secure-message-sign-pgp)
-(set-default-font "Inconsolata-11")
+(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.
+ )
+
+;; auto complete
+(ac-config-default)
+(ac-linum-workaround)
+
+;; 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))
-;; spell check
-(setq ispell-program-name "aspell"
- ispell-extra-args '("--sug-mode=ultra"))
+(add-hook 'go-mode-hook 'go-mode-setup)
-(setq ispell-list-command "--list")
+;; alias man to w.o.man
+(defalias 'man 'woman)
-(dolist (hook '(text-mode-hook))
- (add-hook hook (lambda () (flyspell-mode 1))))
-(dolist (hook '(change-log-mode-hook log-edit-mode-hook))
- (add-hook hook (lambda () (flyspell-mode -1))))
+;; 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))))))
-;; new wonderful theme monokai
-(load-theme 'monokai t)
+;(desktop-save-mode 1)