[project @ sridhar.ratna@gmail.com-20070901060725-fqfh17j8v77bosmb]
[srid.dotfiles.git] / emacs / dot-emacs
blobc5454aef06c8b65c267801d5e55c3da216eedb87
1 ;; .emacs of Sridhar Ratnakumar
2 ;; http://nearfar.org/
4 (add-to-list 'load-path "~/d/emacs")
5 (add-to-list 'load-path "~/d/emacs/org")
8 (when (locate-library "tramp")
9   (require 'tramp))
11 (when (locate-library "rcirc")
12   (load-file "~/d/emacs/rcirc-init.el"))
14 (autoload 'javascript-mode "javascript" nil t)
15 (add-to-list 'auto-mode-alist '("\\.js\\'" . javascript-mode))
18 (autoload 'css-mode "css-mode")
19 (setq auto-mode-alist       
20      (cons '("\\.css\\'" . css-mode) auto-mode-alist))
22 ;;;; mit-scheme
23 ;;;; ==========
25 (require 'xscheme)
26 ; since I use M-RET for ido-switch-buffer, ..
27 (add-hook 'scheme-interaction-mode-hook
28           (lambda ()
29             ; C-xC-e will work as usual.
30             (define-key scheme-interaction-mode-map "\e\C-m" nil)))
32 ;;;; Python
33 ;;;; ======
35 (add-hook 'python-mode-hook
36           (lambda ()
37             (define-key python-mode-map "\"" 'electric-pair)
38             (define-key python-mode-map "\'" 'electric-pair)
39             (define-key python-mode-map "(" 'electric-pair)
40             (define-key python-mode-map "[" 'electric-pair)
41             (define-key python-mode-map "{" 'electric-pair)))
43 ; TODO: replace this with http://www.loveshack.ukfsn.org/emacs/pair-mode.el
44 (defun electric-pair ()
45   "Insert character pair without sournding spaces"
46   (interactive)
47   (let (parens-require-spaces)
48     (insert-pair)))
52 ;;;; functions
53 ;;;; =========
55 (defun srid/alsa-play-sound-file (file)
56   "Play the sound file using 'aplay'"
57   (start-process "aplay" nil "aplay" (expand-file-name file)))
60 ;;;; general config
61 ;;;; ==============
63 (defun srid/general-config ()
64   "general emacs config preferences"
66   (server-start)
68   (setq inhibit-startup-message t)
70   (setq backup-inhibited t)
71   
72   (setq user-full-name "Sridhar Ratna")
73   (setq user-mail-address "sridhar.ratna@gmail.com")
75   ;; x11 copy-paste madness
76   ; this means, we use primary-selection and NOT clipboard
77   ; for cutting & pasting
78   (setq x-select-enable-clipboard nil)
79   ; this means, use clipboard or primary-selection for pasting in emacs
80   (setq interprogram-paste-function 'x-cut-buffer-or-selection-value)
81   
82   
83   ;(set-frame-font "8x13"))
84   ; this sets the font for *all* frames
85   (setq default-frame-alist
86         (append
87          '((font . "8x13"))
88          default-frame-alist))
90 ;  (setq frame-title-format
91 ;       "%b - Emacs")
92 ;  (setq icon-title-format
93 ;       "Emacs")
95   (when (locate-library "color-theme")
96     (require 'color-theme)
97     (load "themes/color-theme-cl-frame.el")
98     (color-theme-cl-frame)))
100 (srid/general-config)
102 ; this site-lisp path is not in load-path by default, so I
103 ; am adding it manually
104 ; this might be a bug in sawfish debian package
105 (add-to-list 'load-path "/usr/share/emacs/site-lisp/sawfish/")
106 (autoload 'sawfish-mode "sawfish" "sawfish-mode" t)
107 (setq auto-mode-alist (cons '("\\.sawfishrc$"  . sawfish-mode) auto-mode-alist)
108       auto-mode-alist (cons '("\\.jl$"         . sawfish-mode) auto-mode-alist)
109       auto-mode-alist (cons '("\\.sawfish/rc$" . sawfish-mode) auto-mode-alist))
112 ;;;; org-mode
113 ;;;; ========
115 (require 'org-install)
116 (require 'org-publish)
117 (add-to-list 'auto-mode-alist '("\\.org$" . org-mode))
118 (define-key global-map "\C-cl" 'org-store-link)
119 (define-key global-map "\C-ca" 'org-agenda)
120 (setq org-log-done t)
122 (setq org-agenda-files (list "~/org/Personal.org"
123                              "~/org/Umodl.org"))
126 ;; (setq org-publish-project-alist
127 ;;       (list
128 ;;        '("org" . (:base-directory "/home/htdocs/org/"
129 ;;                :base-extension "org"
130 ;;                :publishing-directory "/home/htdocs/"
131 ;;                :section-numbers nil
132 ;;                :table-of-contents nil
133 ;;                :auto-postamble nil))))
136 ;;;; ido
137 ;;;; ===
139 (when (locate-library "ido")
140   (require 'ido)
141   (ido-mode t)
142   (setq ido-enable-flex-matching t))
144 ;;;; rails, ruby, etc..
145 ;;;; ===
147 ;; yaml mode
148 (autoload 'yaml-mode "yaml-mode" "YAML" t)
149 (setq auto-mode-alist
150       (append '(("\\.yml$" . yaml-mode)) auto-mode-alist))
153 ;; my own keybindings
154 (global-set-key (kbd "<f11>") 'ido-switch-buffer)
155 (global-set-key (kbd "C-x b") nil) ;; use F11
157 (defun switch-to-im ()
158   (interactive)
159   (switch-to-buffer "&bitlbee@testing.bitlbee.org")
160   (rcirc-cmd-names "&bitlbee"))
161 (global-set-key (kbd "C-<f11>") 'switch-to-im)
164 (find-file "/home/srid/org/HackingIdeas.org")
166 (custom-set-variables
167   ;; custom-set-variables was added by Custom.
168   ;; If you edit it by hand, you could mess it up, so be careful.
169   ;; Your init file should contain only one such instance.
170   ;; If there is more than one, they won't work right.
171  '(backup-by-copying-when-linked t)
172  '(browse-url-browser-function (quote browse-url-mozilla))
173  '(global-font-lock-mode t nil (font-lock))
174  '(gnuserv-frame (quote gnuserv-main-frame-function))
175  '(hfy-optimisations (quote (skip-refontification keep-overlays)))
176  '(menu-bar-mode nil)
177  '(rcirc-auto-authenticate-flag t)
178  '(rcirc-default-nick "srid")
179  '(rcirc-default-user-name "srid")
180  '(rcirc-startup-channels-alist (quote (("^irc.freenode.net$" "#emacs" "#scheme" "#ruby-lang" "#gnusim8085"))))
181  '(rcirc-track-minor-mode t)
182  '(scroll-bar-mode nil)
183  '(show-paren-mode t)
184  '(tool-bar-mode nil nil (tool-bar))
185  '(transient-mark-mode t))
187 (custom-set-faces
188   ;; custom-set-faces was added by Custom.
189   ;; If you edit it by hand, you could mess it up, so be careful.
190   ;; Your init file should contain only one such instance.
191   ;; If there is more than one, they won't work right.
194 (put 'downcase-region 'disabled nil)