Mercurial > dotfiles
view .emacs @ 24:d6fd2964258c
New version of textmate.el
author | Augie Fackler <durin42@gmail.com> |
---|---|
date | Tue, 16 Dec 2008 11:30:55 -0600 |
parents | 8715ccb6f61b |
children | 614a83a1c5dd |
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 'python-mode) (require 'ipython) (require 'show-wspace) (require 'mercurial) ; Clojure (require 'clojure-auto) (setq auto-mode-alist (cons '("\\.clj$" . clojure-mode) auto-mode-alist)) (require 'textmate) (textmate-mode) (textmate-also-ignore "eggs|cover|daisy|.*.pyc") ; 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 (and buffer-file-name (string-match "melange" buffer-file-name)) (set-variable 'python-indent 2)) (af-tab-fix) ) (add-hook 'python-mode-hook 'af-python-mode-hook) ; 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) ;; 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) ; M-l makes more sense to me for jumping to a line (global-set-key "\M-l" 'goto-line) ; Sometimes C-h is what Backspace sends in a terminal, and I never use C-h (global-set-key "\C-h" 'backward-delete-char-untabify) ; M-t is what I want for the textmate file finding (global-set-key [(meta t)] 'textmate-goto-file)