diff .emacs @ 7:9541f7e47514

Some edits to .emacs after my playing with Clojure, also added Clojure support files.
author Augie Fackler <durin42@gmail.com>
date Sun, 30 Nov 2008 20:50:18 -0600
parents c30d68fbd368
children 6b651c7265f2
line wrap: on
line diff
--- a/.emacs
+++ b/.emacs
@@ -12,6 +12,10 @@
 (require 'show-wspace)
 (require 'doctest-mode)
 
+; Clojure
+(require 'clojure-auto)
+(setq auto-mode-alist (cons '("\\.clj$" . clojure-mode) auto-mode-alist))
+
 ; Start the server so that emacsclient will work
 ; TODO: is there a way to *not* start a server if one was already running?
 (server-start)
@@ -23,6 +27,26 @@
 (setq tab-width 4)
 (setq-default indent-tabs-mode nil)
 
+; use tab for indent or complete
+(defun indent-or-expand (arg)
+  "Either indent according to mode, or expand the word preceding
+point."
+  (interactive "*P")
+  (if (and
+       (or (bobp) (= ?w (char-syntax (char-before))))
+       (or (eobp) (not (= ?w (char-syntax (char-after))))))
+      (dabbrev-expand arg)
+    (indent-according-to-mode)))
+
+(defun af-tab-fix ()
+  (local-set-key [tab] 'indent-or-expand))
+
+;; add hooks for modes you want to use the tab completion for:
+(add-hook 'c-mode-hook          'af-tab-fix)
+(add-hook 'sh-mode-hook         'af-tab-fix)
+(add-hook 'emacs-lisp-mode-hook 'af-tab-fix)
+(add-hook 'clojure-mode-hook    'af-tab-fix)
+
 (defun af-python-mode-hook ()
   ; highlight tabs in Python
   (make-variable-buffer-local 'font-lock-mode-hook)
@@ -30,6 +54,7 @@
   (make-variable-buffer-local 'python-indent)
   (if (string-match "melange" buffer-file-name)
       (set-variable 'python-indent 2))
+  (af-tab-fix)
 )
 (add-hook 'python-mode-hook 'af-python-mode-hook)
 
@@ -70,6 +95,8 @@
 	(background-color . "black")
 	)
       )
+; always highlight matching paren
+(show-paren-mode 1)
 
 ;; Desktop mode to remember buffers
 (load "desktop")