(global-font-lock-mode 1) ;dont mix tabs and spaces (setq-default indent-tabs-mode nil) ;hitting enter will auto indent too (global-set-key "\C-m" 'newline-and-indent) (defun prepend-path ( my-path ) (setq load-path (cons (expand-file-name my-path) load-path))) (defun append-path ( my-path ) (setq load-path (append load-path (list (expand-file-name my-path))))) (prepend-path "~/emacsfiles/flymake") (add-hook 'c-mode-hook '(lambda () (flymake-mode))) (add-hook 'c++-mode-hook '(lambda () (flymake-mode))) ;; Look first in the directory ~/elisp for elisp files (prepend-path "~/emacsfiles/py") ;; Load verilog mode only when needed (autoload 'python-mode "python-mode" "Python mode" t ) ;; Any files that end in .v should be in verilog mode (setq auto-mode-alist (cons '("\\.py\\'" . python-mode) auto-mode-alist)) ;; Any files in verilog mode should have their keywords colorized (add-hook 'python-mode-hook '(lambda () (font-lock-mode 1))) (add-to-list 'load-path "~/emacsfiles/slime/") (setq inferior-lisp-program "/usr/local/bin/sbcl") (require 'slime) (slime-setup) (prepend-path "~/emacsfiles/tcl") (require 'tcl-font) (add-to-list 'load-path "~/emacsfiles/scala/emacs/") (require 'scala-mode-auto) (add-to-list 'load-path "~/emacsfiles/ruby-mode/") (autoload 'ruby-mode "ruby-mode" "Major mode for editing ruby scripts." t) (setq auto-mode-alist (cons '(".rb$" . ruby-mode) auto-mode-alist)) (setq auto-mode-alist (cons '(".rhtml$" . html-mode) auto-mode-alist)) (load "~/emacsfiles/haskell-mode/haskell-site-file") (add-hook 'haskell-mode-hook 'turn-on-haskell-doc-mode) (add-hook 'haskell-mode-hook 'turn-on-haskell-indent) (setq tex-dvi-view-command "xdvi") ;(setq load-path (cons "~/emacsfiles/ultratex/lisp" load-path)) ;(require 'light) ;(require 'ultex-setup) ;yegge suggestions (global-set-key "\C-x\C-m" 'execute-extended-command) (global-set-key "\C-w" 'backward-kill-word) (global-set-key "\C-x\C-k" 'kill-region) (global-set-key "\C-c\C-k" 'kill-region) ;cntrl+z = undo (global-set-key "\C-z" 'undo) (if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1)) (if (fboundp 'tool-bar-mode) (tool-bar-mode -1)) (if (fboundp 'menu-bar-mode) (menu-bar-mode -1)) (defalias 'qrr 'query-replace-regexp) (defun scroll-up-one-line () (interactive) (scroll-up 1)) (defun scroll-down-one-line () (interactive) (scroll-down 1)) (global-set-key "\C-Q" 'scroll-up-one-line) (global-set-key "\C-T" 'scroll-down-one-line) ;; indent the entire buffer (defun c-indent-buffer () "Indent entire buffer of C source code." (interactive) (save-excursion (goto-char (point-min)) (while (< (point) (point-max)) (c-indent-command) (end-of-line) (forward-char 1)))) (global-set-key [ (control c) (control g) ] 'goto-line) (setq inhibit-startup-message t) ;; only scroll one line when reaching the bottom (setq scroll-step 1) (setq scroll-conservatively 1) ;; highlight marked region (setq-default transient-mark-mode t) ;;handle autosave and backup files (defvar autosave-dir (expand-file-name "~/.emacs_autosave/")) (defun auto-save-file-name-p (filename) (string-match "^#.*#$" (file-name-nondirectory filename))) (defun make-auto-save-file-name () (concat autosave-dir (if buffer-file-name (concat "#" (file-name-nondirectory buffer-file-name) "#") (expand-file-name (concat "#%" (buffer-name) "#"))))) (defvar backup-dir (expand-file-name "~/.emacs_backup")) (setq backup-directory-alist (list (cons "." backup-dir)))