;; .emacs ;; created by Kyle Oliver, 2/5/2008 ;; updated 3/28/2008 ;; contains emacs customizations ;;; _Add-ons_ ;; set the load path for add-ons (setq load-path (append (list (expand-file-name "~/code/emacs/.")) load-path)) ;; get add-ons ;; buffer-stack contains Windows-Alt-Tab-style buffer-switching functions ;; http://www.sixfingeredman.net/proj/xemacs/buffer-stack.el (require 'buffer-stack) ;; matlab contains, for my purposes, a syntax-highlighting mode for .m files (require 'matlab) ;; mcnpgen-mode contains a syntax-highlighting mode for mcnp input files ;; http://homepages.cae.wisc.edu/~bohm/genericmode.html (load "mcnpgen-mode") ;; gams contains all kinds of GAMS plugins including syntax highlighting ;; and program execution (require 'gams) ;; Kills all buffers except scratch ;; optained from http://www.chrislott.org/geek/emacs/dotemacs.html ;; via http://www-cdf.fnal.gov/~sthrlnd/emacs_help.html (defun nuke-all-buffers () "kill all buffers, leaving *scratch* only" (interactive) (mapcar (lambda (x) (kill-buffer x)) (buffer-list)) (delete-other-windows)) ;;; _Key bindings_ ;; set the binding for buffer-stack switching (global-set-key [(control tab)] 'buffer-stack-bury) ;; fast compiler commands (global-set-key [(control o)] 'compile) (global-set-key [(control p)] 'next-error) (global-set-key [(control shift p)] 'previous-error) ;; fast debugger commands (global-set-key [(control shift ,)] 'gud-up) (global-set-key [(control shift .)] 'gud-down) ;; fast nuke-all (global-set-key [(control shift w)] 'nuke-all-buffers) ;;; _Display_ ;; set the correct mode for various source code files and ;; automatically apply syntax highlighting (setq auto-mode-alist (cons '("\\.java$" . java-mode) auto-mode-alist)) (setq auto-mode-alist (cons '("\\.cxx$" . c++-mode) auto-mode-alist)) (setq auto-mode-alist (cons '("\\.hxx$" . c++-mode) auto-mode-alist)) (setq auto-mode-alist (cons '("\\.h$" . c++-mode) auto-mode-alist)) (setq auto-mode-alist (cons '("\\.cpp$" . c++-mode) auto-mode-alist)) (setq auto-mode-alist (cons '("\\.C$" . c++-mode) auto-mode-alist)) (setq auto-mode-alist (cons '("\\.m$" . matlab-mode) auto-mode-alist)) (setq auto-mode-alist (cons '("\\.inp$" . mcnpgen-mode) auto-mode-alist)) (global-font-lock-mode t) ;; show line- and column-number in the mode line (line-number-mode 1) (column-number-mode 1) ;; supress the start-up message (setq inhibit-startup-message t) ;; require only y/n instead of yes/no at prompts (fset 'yes-or-no-p 'y-or-n-p) ;;; _Editing_ ;; set tab and indent width (setq default-tab-width 2) (setq standard-indent 2)