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)
9 (add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t)
12 (load "my-generic-stuff.el")
15 (load "my-org-mode.el")
17 (load "my-twitter.el")
19 (load "my-haskell.el")
20 (load "my-swank-js.el")
23 (if (>= emacs-major-version 23)
24 (setq default-frame-alist '((font . "Inconsolata-14")))
26 "-Misc-Fixed-Medium-R-Normal--15-140-75-75-C-90-ISO8859-1"))
28 (setq-default indent-tabs-mode nil)
29 (add-hook 'emacs-lisp-mode-hook
30 (lambda () (which-function-mode t)))
36 (setq scroll-conservatively 1)
37 (put 'upcase-region 'disabled nil)
38 (put 'downcase-region 'disabled nil)
43 (defun match-paren (arg)
44 "Go to the matching paren if on a paren; otherwise insert %."
46 (cond ((looking-at "\\s\(") (forward-list 1) (backward-char 1))
47 ((looking-at "\\s\)") (forward-char 1) (backward-list 1))
48 (t (self-insert-command (or arg 1)))))
50 ;; emacs window size according to screen resolution
51 ;; from stackoverflow.com
52 ;; - <http://stackoverflow.com/questions/92971/how-do-i-set-the-size-of-emacs-window>
53 (defun set-frame-size-according-to-resolution ()
57 ;; use 120 char wide window for largeish displays
58 ;; and smaller 80 column windows for smaller displays
59 ;; pick whatever numbers make sense for you
60 (if (> (x-display-pixel-width) 1280)
61 (add-to-list 'default-frame-alist (cons 'width 80))
62 (add-to-list 'default-frame-alist (cons 'width 78)))
63 ;; for the height, subtract a couple hundred pixels
64 ;; from the screen height (for panels, menubars and
65 ;; whatnot), then divide by the height of a char to
66 ;; get the height we want
67 (add-to-list 'default-frame-alist
68 (cons 'height (/ (- (x-display-pixel-height) 0) (frame-char-height)))))))
70 (set-frame-size-according-to-resolution)
74 (setq tramp-default-method "ssh")
76 ;; cut and paste with the rest of ecosystem in X
77 (setq x-select-enable-clipboard t)
80 (if (> emacs-major-version 20)
84 (add-to-list 'load-path "~/.emacs.d/vendor/clojure-mode")
85 (require 'clojure-mode)
87 ;; highlight parentheses mode
88 (require 'highlight-parentheses)
91 ;; http://stackoverflow.com/questions/2413047/how-do-i-get-rainbow-parentheses-in-emacs
92 ;; (setq hl-paren-colors
93 ;; '(;"#8f8f8f" ; this comes from Zenburn
94 ;; ; and I guess I'll try to make the far-outer parens look like this
95 ;; "orange1" "yellow1" "greenyellow" "green1"
96 ;; "springgreen1" "cyan1" "slateblue1" "magenta1" "purple"))
99 (autoload 'paredit-mode "paredit"
100 "Minor mode for pseudo-structurally editing Lisp code." t)
102 (dolist (hook '(emacs-lisp-mode-hook
104 lisp-interaction-mode-hook
107 (add-hook hook #'(lambda ()
108 (highlight-parentheses-mode t)
111 (autoload 'clojure-test-mode "clojure-test-mode" "Clojure test mode" t)
112 (autoload 'clojure-test-maybe-enable "clojure-test-mode" "" t)
113 (add-hook 'clojure-mode-hook 'clojure-test-maybe-enable)
116 (autoload 'flyspell-mode "flyspell" "On-the-fly spelling checker." t)
119 (defun switch-full-screen ()
121 (shell-command "wmctrl -r :ACTIVE: -btoggle,fullscreen"))
123 (global-set-key [f10] 'switch-full-screen)
129 (setq browse-url-browser-function 'browse-url-firefox
130 ; browse-url-generic-program "/usr/bin/iceweasel"
131 browse-url-new-window-flag t
132 browse-url-firefox-new-window-is-tab t)
133 (define-key global-map "\C-co" 'browse-url-at-point)
135 ;; nxml for editing xml files
136 (setq auto-mode-alist
137 (cons '("\\.\\(xml\\|xsl\\|rng\\|xhtml\\)\\'" . nxml-mode)
140 ;; completions enhancements
143 ;; Interactively Do Things mode
147 (setq ido-enable-flex-matching t)
148 (setq ido-enable-last-directory-history nil)
151 (when (require 'browse-kill-ring nil 'noerror)
152 (browse-kill-ring-default-keybindings))
154 ;; rainbox mode for CSS color highlighting
155 (require 'rainbow-mode)
157 (add-to-list 'auto-mode-alist '("\\.rkt$" . scheme-mode))
159 ;; scheme auto complete
160 (require 'scheme-complete)
161 (autoload 'scheme-smart-complete "scheme-complete" nil t)
162 (eval-after-load 'scheme
163 '(progn (define-key scheme-mode-map "\t" 'scheme-complete-or-indent)))
166 (add-to-list 'load-path "~/.emacs.d/vendor/popup/")
167 (add-to-list 'load-path "~/.emacs.d/vendor/auto-complete/")
168 (require 'auto-complete)
170 (set-default 'ac-sources
174 ac-source-words-in-buffer
175 ac-source-words-in-same-mode-buffers
178 (dolist (m '(c-mode c++-mode java-mode))
179 (add-to-list 'ac-modes m))
181 (global-auto-complete-mode t)
183 ;; slime autocomplete
184 (add-to-list 'load-path "~/.emacs.d/vendor/ac-slime/")
187 (set-default 'ac-sources 'ac-source-slime-simple)
188 (add-hook 'slime-mode-hook 'set-up-slime-ac)
189 (add-hook 'slime-repl-mode-hook 'set-up-slime-ac)
193 ;(setq scheme-program-name "racket")
194 ;(setq quack-default-program "racket -il racket/base")
195 ;(setq quack-switch-to-scheme-method 'other-window)
196 ;(setq quack-newline-behavior 'indent-newline-indent)
198 (defun racket-enter! ()
200 (comint-send-string (scheme-proc)
201 (format "(enter! (file \"%s\") #:verbose)\n" buffer-file-name))
202 (switch-to-scheme t))
203 (local-set-key "\C-c\C-v" 'racket-enter!)
206 (add-to-list 'load-path "~/.emacs.d/vendor/company-mode")
207 (autoload 'company-mode "company" nil t)
209 ;; handle trailing whitespaces
210 ;(add-hook 'before-save-hook 'delete-trailing-whitespace)
212 ;; update copyright years before saving.
213 ;(add-hook 'before-save-hook 'copyright-update)
215 ;; la carte mode (access menu from keyboard)
218 ;;; Based on code by Rudi Schlatte.
219 ;;; Needs this library:
220 ;;; http://www.emacswiki.org/cgi-bin/wiki/XmlRpc
223 (defvar lisppaste-nick "vu3rdd")
224 (defvar lisppaste-channel "None")
225 (defvar lisppaste-colorize-as "Scheme")
226 (defvar lisppaste-prev-title "")
228 (defun lisppaste-region (region-begin region-end
229 &optional channel username title annotate)
231 (let* ((content (buffer-substring region-begin region-end))
233 (read-from-minibuffer "Channel: " lisppaste-channel)))
234 (username (or username (read-from-minibuffer "Nick: " lisppaste-nick)))
235 (title (or title (read-from-minibuffer "Title: " lisppaste-prev-title)))
236 (annotate (or annotate (string-to-number (read-from-minibuffer "Annotate? "))))
237 (colorize-as (if (zerop annotate) (read-from-minibuffer "Colorize as (empty for default): " lisppaste-colorize-as))))
238 (setf lisppaste-prev-title title)
239 (let* ((ret (xml-rpc-method-call "http://common-lisp.net:8185/RPC2" 'newpaste
240 channel username title content (or colorize-as annotate)))
241 (url-beg (search "http://" ret))
242 (url-end (and url-beg (search " " ret :start2 url-beg)))
243 (url (and url-end (substring ret url-beg url-end))))
245 (and url (browse-url url))
248 ;;; displays "\" at the end of lines that wrap
249 (setq longlines-show-hard-newlines t)
252 (autoload 'js2-mode "js2-mode" nil t)
253 (add-to-list 'auto-mode-alist '("\\.js$" . js2-mode))
255 ;; geiser for Scheme programming
256 ;(load-file "~/src/geiser/elisp/geiser.el")
259 ;(setq geiser-guile-binary "racket")
260 ;(setq geiser-active-implementations '(racket))
264 (defun flymake-racket-init ()
265 (let* ((temp-file (flymake-init-create-temp-buffer-copy
266 'flymake-create-temp-inplace))
267 (local-file (file-relative-name
269 (file-name-directory buffer-file-name))))
270 (list "racket" (list "-qf" local-file))))
272 (push '("\\.rkt\\'" flymake-racket-init)
273 flymake-allowed-file-name-masks)
277 (autoload 'ghc-init "ghc" nil t)
278 (add-hook 'haskell-mode-hook
281 (require 'auto-complete-config)
282 (auto-complete-mode t)
283 (add-to-list 'ac-sources 'ac-source-ghc-mod)))
284 ;; haskell-mode hooks
285 (add-hook 'haskell-mode-hook 'capitalized-words-mode)
286 (add-hook 'haskell-mode-hook 'turn-on-haskell-decl-scan)
289 (autoload 'sml-mode "sml-mode" "Major mode for editing SML." t)
290 (autoload 'run-sml "sml-proc" "Run an inferior SML process." t)
295 (setq message-send-mail-function 'message-send-mail-with-sendmail
296 mail-specify-envelope-from t ; Settings to work with msmtp
297 message-sendmail-f-is-evil nil
298 mail-envelope-from 'header
299 message-sendmail-envelope-from 'header
300 sendmail-program "/usr/bin/msmtp"
301 user-full-name "Ramakrishnan Muthukrishnan")
303 (setq message-kill-buffer-on-exit t) ; kill buffer after sending mail)
307 (setq-default cursor-type '(bar . 2))
308 (set-cursor-color "#ff0000")
312 ;; wombat color theme
313 ;(set-background-color "Black")
314 (set-background-color "#242424")
315 ;(set-foreground-color "White")
316 (set-foreground-color "#f6f3e8")
317 (set-cursor-color "Red")
318 ;(set-cursor-color "#656565")
319 (set-mouse-color "LightSkyBlue")
320 (setq font-lock-maximum-decoration t)
321 (set-face-foreground 'font-lock-comment-face "#99968b")
322 (set-face-italic-p 'font-lock-comment-face t)
323 (set-face-foreground 'font-lock-doc-face "#99968b")
324 (set-face-italic-p 'font-lock-doc-face t)
325 (set-face-foreground 'font-lock-constant-face "#e5786d")
326 (set-face-foreground 'font-lock-string-face "#95e454")
327 (set-face-italic-p 'font-lock-string-face t)
328 (set-face-foreground 'font-lock-variable-name-face "#cae682")
329 (set-face-foreground 'font-lock-function-name-face "#cae682")
330 (set-face-foreground 'font-lock-type-face "#cae682")
331 (set-face-foreground 'font-lock-builtin-face "#8ac6f2")
332 (set-face-foreground 'font-lock-keyword-face "#8ac6f2")
333 (set-face-foreground 'font-lock-preprocessor-face "#e5786d")
334 (set-face-foreground 'font-lock-negation-char-face "#e7f6da")
335 (set-face-foreground 'link "#8ac6f2")
336 (set-face-bold-p 'link t)
337 (set-face-underline-p 'link t)
339 (set-face-foreground 'show-paren-match-face "#f6f3e8")
340 (set-face-background 'show-paren-match-face "#857b6f")
341 (set-face-bold-p 'show-paren-match t)
342 (set-face-foreground 'region "#f6f3e8")
343 (set-face-background 'region "#444444")
344 (set-face-foreground 'lazy-highlight "black")
345 (set-face-background 'lazy-highlight "yellow")
347 ;; color theme from Lau Jenson
348 (defun color-theme-dark-bliss ()
352 '(color-theme-dark-bliss
353 ((foreground-color . "#eeeeee")
354 (background-color . "#001122")
355 (background-mode . dark)
356 (cursor-color . "#ccffcc"))
357 (bold ((t (:bold t))))
358 (bold-italic ((t (:italic t :bold t))))
359 (default ((t (nil))))
361 (font-lock-builtin-face ((t (:foreground "#f0f0aa"))))
362 (font-lock-comment-face ((t (:italic t :foreground "#aaccaa"))))
363 (font-lock-delimiter-face ((t (:foreground "#aaccaa"))))
364 (font-lock-constant-face ((t (:bold t :foreground "#ffaa88"))))
365 (font-lock-doc-string-face ((t (:foreground "#eeccaa"))))
366 (font-lock-doc-face ((t (:foreground "#eeccaa"))))
367 (font-lock-reference-face ((t (:foreground "#aa99cc"))))
368 (font-lock-function-name-face ((t (:foreground "#ffbb66"))))
369 (font-lock-keyword-face ((t (:foreground "#ccffaa"))))
370 (font-lock-preprocessor-face ((t (:foreground "#aaffee"))))
371 (font-lock-string-face ((t (:foreground "#bbbbff")))))))
373 ;; (color-theme-dark-bliss)
376 (setq gnus-inhibit-images nil)
377 (add-to-list 'load-path "~/.emacs.d/emacs/notmuch")
378 (setq notmuch-command "/Users/rkrishnan/bin/remote-notmuch.sh")
380 (when (memq window-system '(mac ns))
381 (exec-path-from-shell-initialize)
382 (setq starttls-use-gnutls t)
383 (setq starttls-gnutls-program "gnutls-cli")
384 (setq starttls-extra-arguments nil)
386 (setq smtpmail-starttls-credentials '(("rkrishnan.org" 587 nil nil))
387 smtpmail-auth-credentials (expand-file-name "~/.authinfo")
388 smtpmail-default-smtp-server "rkrishnan.org"
389 smtpmail-smtp-server "rkrishnan.org"
390 smtpmail-smtp-service 587)
392 (setq notmuch-fcc-dirs nil)
393 (add-hook 'message-header-setup-hook
394 (lambda () (insert (format "Bcc: %s <%s>\n"
396 (notmuch-user-primary-email)))))
399 (require 'notmuch-address)
400 (setq notmuch-address-command "~/bin/addrlookup")
401 (notmuch-address-message-insinuate)
404 (setq message-send-mail-function 'smtpmail-send-it)
408 ;(add-hook 'message-setup-hook 'mml-secure-message-sign-pgpmime)
410 (setq default-frame-alist
411 '((font . "Menlo-13")