view .emacs @ 8:6b651c7265f2

Flex matching for ido-mode.
author Augie Fackler <durin42@gmail.com>
date Tue, 02 Dec 2008 13:49:31 -0600
parents 9541f7e47514
children d4d720c4c416
line wrap: on
line source

;; Augie Fackler's .emacs file
; Places I've stolen from:
;  Karl Fogel: http://svn.red-bean.com/repos/kfogel/trunk
;  Dave Anderson:

(setq load-path (cons (expand-file-name "~/.elisp") load-path))
; Better buffer switching and file loading (load first in case we need the
; * Messages * buffer)
(require 'ido)
(setq ido-enable-flex-matching t)
(ido-mode t)

(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)

; All lines should end in a newline
(setq require-final-newline t)

; disable tabs
(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)
  (add-hook 'font-lock-mode-hook 'show-ws-highlight-tabs)
  (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)

;;pymacs
(setenv "PYTHONPATH" (concat (getenv "HOME") "/unixSoft/lib/python"))
(autoload 'pymacs-apply "pymacs")
(autoload 'pymacs-call "pymacs")
(autoload 'pymacs-eval "pymacs" nil t)
(autoload 'pymacs-exec "pymacs" nil t)
(autoload 'pymacs-load "pymacs" nil t)
(eval-after-load "pymacs"
  '(add-to-list 'pymacs-load-path "~/unixSoft/lib/python"))
;(pymacs-load "ropemacs" "rope-")
;(setq ropemacs-enable-autoimport t)

; text-mode tries to use M-s for something other than my save shortcut.
; That's evil. Stop it from doing that.
(add-hook 'text-mode-hook '(lambda ()
			     (define-key text-mode-map "\M-s"
			       'save-buffer)))

; Cleanup whitespace before saves.
(add-hook 'before-save-hook '(lambda ()
			       (whitespace-cleanup)))

; Disable that startup screen
(setq inhibit-startup-message t)

; Basically everything I do is in version control, stop saving backup files
(setq make-backup-files nil)

; Set some pretty colors that are gentler on my eyes
(setq default-frame-alist
      '((width . 80)
	(cursor-color . "white")
	(cursor-type . box)
	(foreground-color . "white")
	(background-color . "black")
	)
      )
; always highlight matching paren
(show-paren-mode 1)

;; Desktop mode to remember buffers
(load "desktop")
(setq desktop-enable t)

;; Automatically revert unedited files that change on the underlying
;; system.
(global-auto-revert-mode)

;; Key Bindings
; M-backspace kills the current buffer
(global-set-key [(meta backspace)] 'kill-this-buffer)
; Save early and often, with only one keystroke
(global-set-key [(meta s)] 'save-buffer)
; Typing tab is for lesser editors, make hitting return do that
(global-set-key "\C-m" 'newline-and-indent)