use srid.dotfiles in path
[srid.dotfiles.git] / emacs / dot-emacs
blob34ad46d5233dfe342370b8f705e86c698feedc64
1 ;; .emacs of Sridhar Ratnakumar
2 ;; KISS (Keep It Simple Stupid)
4 (add-to-list 'load-path "~/Projects/srid.dotfiles/emacs/")
5 (add-to-list 'load-path "~/Projects/srid.dotfiles/emacs/tuareg")
7 (setq user-full-name "Sridhar Ratnakumar")
8 (setq user-mail-address "sridhar.ratna@gmail.com")
10 (setq inhibit-startup-message t)
11 (setq backup-inhibited t)
12 (fset 'yes-or-no-p 'y-or-n-p)
13 (set-default 'fill-column 80)
14 (setq frame-title-format "emacs")
16 (setq font-consolas-pt9
17           (concat "-outline-Consolas-normal-r-normal-normal"
18                           "-12-90-96-96-c-*-iso8859-1"))
19 (set-face-font 'default font-consolas-pt9)
21 (require 'color-theme)
22 (load "~/Projects/srid.dotfiles/emacs/color-theme-eon.el")
23 (color-theme-eon)
25 (require 'ido)
26 (ido-mode t)
27 (setq ido-enable-flex-matching t)
29 (global-set-key (kbd "<f11>") 'ido-switch-buffer)
31 ;; -----
32 ;; Etc
33 ;; -----
34 (add-to-list 'auto-mode-alist '("\\.js\\'" . javascript-mode))
35 (autoload 'javascript-mode "javascript" nil t)
37 (require 'twit "twit")
40 ;; org
41 (require 'org-install)
42 (add-to-list 'auto-mode-alist '("\\.org$" . org-mode))
43 (setq org-log-done t)
44 (global-set-key (kbd "C-c C-g") 'org-agenda-list)
45 (setq org-agenda-files (directory-files "~/org/" t ".*\\.org$"))
48 ;; Tuareg mode for F#
49 ;; fsharp
50 (require 'tuareg)
51 (setq auto-mode-alist (cons '("\\.fs\\w?" . tuareg-mode) auto-mode-alist))
53 (defadvice tuareg-find-alternate-file (around fsharp-find-alternate-file)
54   "Switch Implementation/Interface."
55   (interactive)
56   (let ((name (buffer-file-name)))
57     (if (string-match "\\`\\(.*\\)\\.fs\\(i\\)?\\'" name)
58         (find-file (concat (tuareg-match-string 1 name)
59                            (if (match-beginning 2) ".fs" ".fsi"))))))
61 (defconst tuareg-error-regexp-fs
62   "^\\([^(\n]+\\)(\\([0-9]+\\),\\([0-9]+\\)):"
63   "Regular expression matching the error messages produced by fsc.")
65 (add-hook 'tuareg-mode-hook
66           '(lambda ()
67              (ad-activate 'tuareg-find-alternate-file)
68              (setq tuareg-interactive-program "fsi")
69              (if (boundp 'compilation-error-regexp-alist)
70                  (or (assoc tuareg-error-regexp-fs
71                             compilation-error-regexp-alist)
72                      (setq compilation-error-regexp-alist
73                            (cons (list tuareg-error-regexp-fs 1 2 3)
74                                  compilation-error-regexp-alist))))))
77 ;; -----
78 ;; irc
79 ;; -----
80 (load "~/.freenode.el")
81 (setq rcirc-authinfo
82           (list (list "freenode" 'nickserv "srid" passwd)
83                         (list "oftc"     'nickserv "srid" passwd)
84                         (list "bitlbee"  'bitlbee  "srid" passwd)))
86 (defun im ()
87   (interactive)
88   (rcirc-connect "im.bitlbee.org" 6667
89                                  "srid" "srid" "Sridhar Ratnakumar"))
91 (defun switch-to-im ()
92   (interactive)
93   (let ((im-buffer (get-buffer "&bitlbee@im.bitlbee.org")))
94         (when im-buffer
95           (switch-to-buffer im-buffer)
96           (rcirc-cmd-names "&bitlbee"))))
97 (global-set-key (kbd "C-<f11>") 'switch-to-im)
99 (defun irc-count-nicks ()
100   (interactive)
101   (message
102    (format "%d"
103                    (length (rcirc-channel-nicks
104                                         (rcirc-buffer-process)
105                                         rcirc-target)))))
107 (defun rcirc-alert (p sender resp target txt)
108   (when (and (string-match (rcirc-nick p) txt)
109                          (not (string= (rcirc-nick p) sender))
110                          (not (string= (rcirc-server-name p) sender)))
111         (play-sound-file "~/Projects/srid.dotfiles/emacs/notify.wav")))
112 (add-hook 'rcirc-print-hooks 'rcirc-alert)
114 (server-start)
117 (custom-set-variables
118   ;; custom-set-variables was added by Custom.
119   ;; If you edit it by hand, you could mess it up, so be careful.
120   ;; Your init file should contain only one such instance.
121   ;; If there is more than one, they won't work right.
122  '(backup-by-copying-when-linked t)
123  '(browse-url-browser-function (quote browse-url-generic))
124  '(browse-url-generic-program "C:\\Program Files\\Internet Explorer\\ieuser.exe")
125  '(column-number-mode t)
126  '(global-font-lock-mode t nil (font-lock))
127  '(gnuserv-frame (quote gnuserv-main-frame-function))
128  '(hfy-optimisations (quote (skip-refontification keep-overlays)))
129  '(inhibit-splash-screen t)
130  '(javascript-indent-level 2)
131  '(line-number-mode t)
132  '(menu-bar-mode nil)
133  '(rcirc-auto-authenticate-flag t)
134  '(rcirc-default-nick "srid")
135  '(rcirc-default-user-name "srid")
136  '(rcirc-server-alist (quote (("irc.freenode.net" nick "srid" user-name "srid" full-name "Sridhar Ratnakumar" channels nil :channels ("#emacs" "#gnusim8085" "#ubuntu-in" "#haskell" "#git" "#comparewise" "#django-india" "#srid-interest" "#ilugchennai")))))
137  '(rcirc-track-minor-mode t)
138  '(scroll-bar-mode nil)
139  '(show-paren-mode t)
140  '(tab-width 4)
141  '(tool-bar-mode nil nil (tool-bar))
142  '(transient-mark-mode t)
143  '(visible-bell t))
145 (custom-set-faces
146   ;; custom-set-faces was added by Custom.
147   ;; If you edit it by hand, you could mess it up, so be careful.
148   ;; Your init file should contain only one such instance.
149   ;; If there is more than one, they won't work right.
152 (put 'downcase-region 'disabled nil)