1 (setq load-path (cons "~/.emacs.d/emacs" load-path))
4 (add-to-list 'custom-theme-load-path "~/.emacs.d/themes")
5 (load-theme 'zenburn t)
11 (load "my-generic-stuff.el")
14 (load "my-org-mode.el")
16 (load "my-twitter.el")
20 (if (>= emacs-major-version 23)
21 (setq default-frame-alist '((font . "Inconsolata-12")))
23 "-Misc-Fixed-Medium-R-Normal--15-140-75-75-C-90-ISO8859-1"))
25 (setq-default indent-tabs-mode nil)
26 (add-hook 'emacs-lisp-mode-hook
27 (lambda () (which-function-mode t)))
33 (setq scroll-conservatively 1)
34 (put 'upcase-region 'disabled nil)
35 (put 'downcase-region 'disabled nil)
40 (defun match-paren (arg)
41 "Go to the matching paren if on a paren; otherwise insert %."
43 (cond ((looking-at "\\s\(") (forward-list 1) (backward-char 1))
44 ((looking-at "\\s\)") (forward-char 1) (backward-list 1))
45 (t (self-insert-command (or arg 1)))))
47 ;; emacs window size according to screen resolution
48 ;; from stackoverflow.com
49 ;; - <http://stackoverflow.com/questions/92971/how-do-i-set-the-size-of-emacs-window>
50 (defun set-frame-size-according-to-resolution ()
54 ;; use 120 char wide window for largeish displays
55 ;; and smaller 80 column windows for smaller displays
56 ;; pick whatever numbers make sense for you
57 (if (> (x-display-pixel-width) 1280)
58 (add-to-list 'default-frame-alist (cons 'width 80))
59 (add-to-list 'default-frame-alist (cons 'width 78)))
60 ;; for the height, subtract a couple hundred pixels
61 ;; from the screen height (for panels, menubars and
62 ;; whatnot), then divide by the height of a char to
63 ;; get the height we want
64 (add-to-list 'default-frame-alist
65 (cons 'height (/ (- (x-display-pixel-height) 0) (frame-char-height)))))))
67 (set-frame-size-according-to-resolution)
71 (setq tramp-default-method "ssh")
73 ;; cut and paste with the rest of ecosystem in X
74 (setq x-select-enable-clipboard t)
77 (if (> emacs-major-version 20)
81 (add-to-list 'load-path "~/.emacs.d/vendor/clojure-mode")
82 (require 'clojure-mode)
84 ;; highlight parentheses mode
85 (require 'highlight-parentheses)
88 ;; http://stackoverflow.com/questions/2413047/how-do-i-get-rainbow-parentheses-in-emacs
89 ;; (setq hl-paren-colors
90 ;; '(;"#8f8f8f" ; this comes from Zenburn
91 ;; ; and I guess I'll try to make the far-outer parens look like this
92 ;; "orange1" "yellow1" "greenyellow" "green1"
93 ;; "springgreen1" "cyan1" "slateblue1" "magenta1" "purple"))
96 (autoload 'paredit-mode "paredit"
97 "Minor mode for pseudo-structurally editing Lisp code." t)
99 (dolist (hook '(emacs-lisp-mode-hook
101 lisp-interaction-mode-hook
104 (add-hook hook #'(lambda ()
105 (highlight-parentheses-mode t)
108 (autoload 'clojure-test-mode "clojure-test-mode" "Clojure test mode" t)
109 (autoload 'clojure-test-maybe-enable "clojure-test-mode" "" t)
110 (add-hook 'clojure-mode-hook 'clojure-test-maybe-enable)
113 (autoload 'flyspell-mode "flyspell" "On-the-fly spelling checker." t)
116 (defun switch-full-screen ()
118 (shell-command "wmctrl -r :ACTIVE: -btoggle,fullscreen"))
120 (global-set-key [f10] 'switch-full-screen)
126 (setq browse-url-browser-function 'browse-url-generic
127 browse-url-generic-program "/usr/bin/iceweasel"
128 browse-url-new-window-flag t
129 browse-url-firefox-new-window-is-tab t)
130 (define-key global-map "\C-co" 'browse-url-at-point)
132 ;; nxml for editing xml files
133 (setq auto-mode-alist
134 (cons '("\\.\\(xml\\|xsl\\|rng\\|xhtml\\)\\'" . nxml-mode)
137 ;; completions enhancements
140 ;; Interactively Do Things mode
144 (setq ido-enable-flex-matching t)
145 (setq ido-enable-last-directory-history nil)
148 (when (require 'browse-kill-ring nil 'noerror)
149 (browse-kill-ring-default-keybindings))
151 ;; rainbox mode for CSS color highlighting
152 (require 'rainbow-mode)
154 (add-to-list 'auto-mode-alist '("\\.rkt$" . scheme-mode))
156 ;; scheme auto complete
157 (require 'scheme-complete)
158 (autoload 'scheme-smart-complete "scheme-complete" nil t)
159 (eval-after-load 'scheme
160 '(progn (define-key scheme-mode-map "\t" 'scheme-complete-or-indent)))
163 (add-to-list 'load-path "~/.emacs.d/vendor/popup/")
164 (add-to-list 'load-path "~/.emacs.d/vendor/auto-complete/")
165 (require 'auto-complete)
167 (set-default 'ac-sources
171 ac-source-words-in-buffer
172 ac-source-words-in-same-mode-buffers
175 (dolist (m '(c-mode c++-mode java-mode))
176 (add-to-list 'ac-modes m))
178 (global-auto-complete-mode t)
180 ;; slime autocomplete
181 (add-to-list 'load-path "~/.emacs.d/vendor/ac-slime/")
184 (set-default 'ac-sources 'ac-source-slime-simple)
185 (add-hook 'slime-mode-hook 'set-up-slime-ac)
186 (add-hook 'slime-repl-mode-hook 'set-up-slime-ac)
190 ;(setq scheme-program-name "racket")
191 ;(setq quack-default-program "racket -il racket/base")
192 ;(setq quack-switch-to-scheme-method 'other-window)
193 ;(setq quack-newline-behavior 'indent-newline-indent)
195 (defun racket-enter! ()
197 (comint-send-string (scheme-proc)
198 (format "(enter! (file \"%s\") #:verbose)\n" buffer-file-name))
199 (switch-to-scheme t))
200 (local-set-key "\C-c\C-v" 'racket-enter!)
203 (add-to-list 'load-path "~/.emacs.d/vendor/company-mode")
204 (autoload 'company-mode "company" nil t)
206 ;; handle trailing whitespaces
207 ;(add-hook 'before-save-hook 'delete-trailing-whitespace)
209 ;; update copyright years before saving.
210 ;(add-hook 'before-save-hook 'copyright-update)
212 ;; la carte mode (access menu from keyboard)
215 ;;; Based on code by Rudi Schlatte.
216 ;;; Needs this library:
217 ;;; http://www.emacswiki.org/cgi-bin/wiki/XmlRpc
220 (defvar lisppaste-nick "vu3rdd")
221 (defvar lisppaste-channel "None")
222 (defvar lisppaste-colorize-as "Scheme")
223 (defvar lisppaste-prev-title "")
225 (defun lisppaste-region (region-begin region-end
226 &optional channel username title annotate)
228 (let* ((content (buffer-substring region-begin region-end))
230 (read-from-minibuffer "Channel: " lisppaste-channel)))
231 (username (or username (read-from-minibuffer "Nick: " lisppaste-nick)))
232 (title (or title (read-from-minibuffer "Title: " lisppaste-prev-title)))
233 (annotate (or annotate (string-to-number (read-from-minibuffer "Annotate? "))))
234 (colorize-as (if (zerop annotate) (read-from-minibuffer "Colorize as (empty for default): " lisppaste-colorize-as))))
235 (setf lisppaste-prev-title title)
236 (let* ((ret (xml-rpc-method-call "http://common-lisp.net:8185/RPC2" 'newpaste
237 channel username title content (or colorize-as annotate)))
238 (url-beg (search "http://" ret))
239 (url-end (and url-beg (search " " ret :start2 url-beg)))
240 (url (and url-end (substring ret url-beg url-end))))
242 (and url (browse-url url))
245 ;;; displays "\" at the end of lines that wrap
246 (setq longlines-show-hard-newlines t)
249 (setq auto-mode-alist
250 (append auto-mode-alist
251 '(("\\.[hg]s$" . haskell-mode)
252 ("\\.hic?$" . haskell-mode)
253 ("\\.hsc$" . haskell-mode)
254 ("\\.chs$" . haskell-mode)
255 ("\\.l[hg]s$" . literate-haskell-mode))))
256 (autoload 'haskell-mode "haskell-mode"
257 "Major mode for editing Haskell scripts." t)
258 (autoload 'literate-haskell-mode "haskell-mode"
259 "Major mode for editing literate Haskell scripts." t)
261 ;adding the following lines according to which modules you want to use:
262 (require 'inf-haskell)
264 (add-hook 'haskell-mode-hook 'turn-on-font-lock)
265 (add-hook 'haskell-mode-hook 'turn-on-haskell-ghci)
266 (add-hook 'haskell-mode-hook 'turn-on-haskell-doc-mode)
267 (add-hook 'haskell-mode-hook 'turn-on-haskell-indent)
268 (set-variable 'haskell-program-name "ghci")
271 (autoload 'js2-mode "js2-mode" nil t)
272 (add-to-list 'auto-mode-alist '("\\.js$" . js2-mode))
275 (add-to-list 'load-path "~/src/swank-js/")
278 ;; geiser for Scheme programming
279 ;(load-file "~/src/geiser/elisp/geiser.el")
282 ;(setq geiser-guile-binary "racket")
283 ;(setq geiser-active-implementations '(racket))
287 (defun flymake-racket-init ()
288 (let* ((temp-file (flymake-init-create-temp-buffer-copy
289 'flymake-create-temp-inplace))
290 (local-file (file-relative-name
292 (file-name-directory buffer-file-name))))
293 (list "racket" (list "-qf" local-file))))
295 (push '("\\.rkt\\'" flymake-racket-init)
296 flymake-allowed-file-name-masks)
300 (autoload 'ghc-init "ghc" nil t)
301 (add-hook 'haskell-mode-hook
304 (require 'auto-complete-config)
305 (auto-complete-mode t)
306 (add-to-list 'ac-sources 'ac-source-ghc-mod)))
307 ;; haskell-mode hooks
308 (add-hook 'haskell-mode-hook 'capitalized-words-mode)
309 (add-hook 'haskell-mode-hook 'turn-on-haskell-decl-scan)
312 (autoload 'sml-mode "sml-mode" "Major mode for editing SML." t)
313 (autoload 'run-sml "sml-proc" "Run an inferior SML process." t)
315 ;; notmuch for email/searching
320 (setq message-send-mail-function 'message-send-mail-with-sendmail
321 mail-specify-envelope-from t ; Settings to work with msmtp
322 message-sendmail-f-is-evil nil
323 mail-envelope-from 'header
324 message-sendmail-envelope-from 'header
325 sendmail-program "/usr/bin/msmtp"
326 user-full-name "Ramakrishnan Muthukrishnan")
328 (setq message-kill-buffer-on-exit t) ; kill buffer after sending mail)
330 (setq notmuch-fcc-dirs "Gmail/Sent") ; stores sent mail to the specified directory
331 (setq message-directory "Gmail/Drafts") ; stores postponed messages to the specified directory