;;;; Brian's .emacs file ;; Filename: .emacs.el ;; Version: 2.0 ;; Description: GNU/emacs lisp init file ;; Author: Brian J Corcoran ;; Created: Wed Jul 16 12:46:03 2003 ;; Rewritten: Thu 20 Apr 2006 ;; Modified at: Thu Apr 20 18:51:24 2006 ;; Modified by: Brian J Corcoran ;; after editing this file, run (emacs-lisp-byte-compile) ;;;; Text mode and Auto Fill mode ;; Set up emacs to default to editing prose (setq default-major-mode 'text-mode) (add-hook 'text-mode-hook 'text-mode-hook-identify) (add-hook 'text-mode-hook 'turn-on-auto-fill) ;;; Turn off the startup message (setq inhibit-startup-message t) ;;; Use spaces instead of tabs for indentation ;; setq-default only changes the default; ;; buffers can specify their own value (setq-default indent-tabs-mode nil) (setq-default default-tab-width 4) ;;; Flash the screen instead of making noise ;; (emacs beeps way the hell too much) (setq visible-bell t) ;;; Show the selected region by default (transient-mark-mode t) ;;; Start an emacs server (if not already running) ;; This is used to so that other programs can access the currently ;; running emacs process. (server-start) ;;; Enable some emacs features disabled by default (put 'eval-expression 'disabled nil) ; M-: (put 'narrow-to-region 'disabled nil) ; C-x n n (put 'upcase-region 'disabled nil) ; C-xC-u (put 'downcase-region 'disabled nil) ; C-xC-l ;;; display time (load "time" nil t) (display-time) ;;; save abbrevs automatically ;;(setq-default abbrev-mode t) ;;(read-abbrev-file "~/.abbrev_defs") ;;(setq save-abbrevs t) ;;;;---------------------- ;;;; Modify the load path (defvar emacs-directory "~/.emacs.d/" "The directory containing the emacs config files.") ;; define the load-path (push emacs-directory load-path) (defun require-try (feature) "If feature is not loaded, load it. If not found, give an error in messages (rather than aborting)." (let ((feature-name (symbol-name feature))) (if (not (require feature feature-name t)) (message (concat "Warning: Cannot find " feature-name " package!"))))) ;; load mac os x bindings (if (equal system-type 'darwin) (require-try 'macosx)) ;;;; recent files (require-try 'recentf) (recentf-mode 1) (setq recentf-max-menu-items 25) (global-set-key "\C-c\ \C-r" 'recentf-open-files) ;;;;---------------------- ;;;; Personal Keybindings ;;; keybinding for `goto-line' (define-key ctl-x-map "\C-j" 'goto-line) ;;; keybinding for `occur' (recommended by rms) (global-set-key "\C-co" 'occur) ;; create replace shortcut (global-set-key "\M-r" 'replace-string) ;;;; Font Lock Settings ;;(load "font-lock" nil t) ;;; turn font lock on for all modes that support it (global-font-lock-mode 1) ;; set default colors (setq default-frame-alist '((foreground-color . "white") (background-color . "black") (cursor-color . "red"))) (make-face 'fl-normal-face) (set-face-foreground 'fl-normal-face "white") (setq font-lock-normal-face 'fl-normal-face) (make-face 'fl-comment-face) (set-face-foreground 'fl-comment-face "green") (setq font-lock-comment-face 'fl-comment-face) (make-face 'fl-string-face) (set-face-foreground 'fl-string-face "yellow") (setq font-lock-string-face 'fl-string-face) (make-face 'fl-function-name-face) (set-face-foreground 'fl-function-name-face "DeepSkyBlue") (setq font-lock-function-name-face 'fl-function-name-face) (make-face 'fl-keyword-face) (set-face-foreground 'fl-keyword-face "red") (setq font-lock-keyword-face 'fl-keyword-face) (make-face 'fl-type-face) (set-face-foreground 'fl-type-face "grey") (setq font-lock-type-face 'fl-type-face) (make-face 'fl-variable-face) (set-face-foreground 'fl-variable-face "gold") (setq font-lock-variable-face 'fl-variable-face) (make-face 'fl-xml-face) (set-face-foreground 'fl-xml-face "RosyBrown") (setq font-lock-xml-face 'fl-xml-face) ;;;-------- ;;; C mode ;; code to change indentation styles ; (c-set-style c-style-name) ; (setq c-default-style '((java-mode . "java") (other . "gnu"))) ; c-style-name includes gnu, k&r, bsd, stroustrup, linux, python, java ; whitesmith, ellemtel, cc-mode (setq c-default-style "stroustrup") ;;;----------------- ;;; emacs-lisp mode ; Byte-compile any modified emacs-lisp file (such as .emacs.el) ; when it is saved. ; Taken from: ; http://www-tsujii.is.s.u-tokyo.ac.jp/~yoshinag/tips/junk_elisp.html (add-hook 'after-save-hook (function (lambda () (if (eq major-mode 'emacs-lisp-mode) (save-excursion (byte-compile-file buffer-file-name)))))) ;;;-------------- ;;; Haskell mode (load "~/.emacs.d/haskell-mode/haskell-site-file") (add-hook 'haskell-mode-hook 'turn-on-haskell-doc-mode) (add-hook 'haskell-mode-hook 'turn-on-haskell-indent) ;;(add-hook 'haskell-mode-hook 'turn-on-haskell-simple-indent) (add-hook 'haskell-mode-hook 'turn-on-haskell-font-lock) (add-hook 'haskell-mode-hook 'turn-on-haskell-ghci) (setq haskell-ghci-program-args '("-fglasgow-exts")) ;;(setq auto-mode-alist ;; (append '( ;; ("\\.[hg]s$" . haskell-mode) ;; ("\\.hi$" . haskell-mode) ;; ;;("\\.l[hg]s$" . latex-mode) ;; ("\\.l[hg]s$" . literate-haskell-mode) ;; ) auto-mode-alist)) ;;(autoload 'haskell-mode "haskell-mode" ;; "Major mode for editing Haskell scripts." t) ;;(autoload 'literate-haskell-mode "haskell-mode" ;; "Major mode for editing literate Haskell scripts." t) ;;(eval-after-load "haskell-mode" ;; '(progn ;; (turn-on-haskell-font-lock) ;; (turn-on-haskell-decl-scan) ;; (turn-on-haskell-doc-mode) ;; (turn-on-haskell-indent) ;; ;; 'turn-on-haskell-simple-indent ;; ;; (turn-on-haskell-hugs) ;; (turn-on-haskell-ghci) ;; (setq haskell-hugs-program-args '("-98")))) ;;;------------------------------ ;;; Caml mode ;; (setq auto-mode-alist ;; (cons '("\\.ml[iylp]?$" . caml-mode) auto-mode-alist)) ;; (autoload 'caml-mode "caml" "Major mode for editing Caml code." t) ;; (autoload 'run-caml "inf-caml" "Run an inferior Caml process." t) ;; (add-hook 'caml-mode-hook ;; '(lambda () ;; (setq font-lock-mode 't) ;; 'turn-on-font-lock ;; )) ; for highlighting (if window-system (require 'caml-font)) (setq auto-mode-alist (cons '("\\.ml\\w?" . tuareg-mode) auto-mode-alist)) (autoload 'tuareg-mode "tuareg" "Major mode for editing Caml code" t) (autoload 'camldebug "camldebug" "Run the Caml debugger" t) ;; (add-hook 'tuareg-mode-hook ;; '(lambda () ;; (setq tuareg-lazy-= t) ; indent `=' like a standard keyword ;; (setq tuareg-lazy-paren t) ; indent [({ like standard keywords ;; (setq tuareg-in-indent 0) ;; (setq tuareg-default-indent 4) ;; (auto-fill-mode 1) ;; (font-lock-mode) ;; )) ;; (require 'caml+twt) ;;;-------- ;;; AUCTeX (load "auctex.el" nil t t) (load "preview-latex.el" nil t t) (autoload 'tex-site "tex-site" nil t) (eval-after-load "tex-site" '(progn (setq-default TeX-master nil) (setq TeX-auto-save t) (setq TeX-parse-self t))) ;;; Ruby mode ;; Based on http://infolab.stanford.edu/~manku/dotemacs.html (autoload 'ruby-mode "ruby-mode" "Mode for editing ruby source files") (add-to-list 'auto-mode-alist '("\\.rb$" . ruby-mode)) (add-to-list 'interpreter-mode-alist '("ruby" . ruby-mode)) (autoload 'run-ruby "inf-ruby" "Run an inferior Ruby process") (autoload 'inf-ruby-keys "inf-ruby" "Set local key defs for inf-ruby in ruby-mode") (add-hook 'ruby-mode-hook '(lambda () (inf-ruby-keys))) ;; If you have Emacs 19.2x or older, use rubydb2x (autoload 'rubydb "rubydb3x" "Ruby debugger" t) ;; uncomment the next line if you want syntax highlighting (add-hook 'ruby-mode-hook 'turn-on-font-lock) ;;; Links mode (setq links-tab-width 2) (add-to-list 'auto-mode-alist '("\\.links$" . links-mode)) ;; add links as the *.cgi default (but put it at the end) (add-to-list 'auto-mode-alist '("\\.cgi$" . links-mode) t) (autoload 'links-mode "links") ;;; Proof General for coq (let ((file "~/.emacs.d/ProofGeneral/generic/proof-site.el")) (if (file-exists-p file) (load-file file))) ;;; css-mode (autoload 'css-mode "css-mode") (setq auto-mode-alist (cons '("\\.css\\'" . css-mode) auto-mode-alist)) ;;; mdfind? ;(require 'mdfind) ;;;;------------------------------------------------------------ ;;;; Emacs automatically set custom variables ;;;; (don't edit by hand) (custom-set-variables ;; custom-set-variables was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. '(TeX-PDF-mode t) '(TeX-command-list (quote ( ("TeX" "%(PDF)%(tex) %S%(PDFout) \"%(mode)\\input %t\"" TeX-run-TeX nil (plain-tex-mode texinfo-mode ams-tex-mode) :help "Run plain TeX") ("LaTeX" "%l \"%(mode)\\input{%t}\"" TeX-run-TeX nil (latex-mode doctex-mode) :help "Run LaTeX") ("Makeinfo" "makeinfo %t" TeX-run-compile nil (texinfo-mode) :help "Run Makeinfo with Info output") ("Makeinfo HTML" "makeinfo --html %t" TeX-run-compile nil (texinfo-mode) :help "Run Makeinfo with HTML output") ("AmSTeX" "%(PDF)amstex %S%(PDFout) \"%(mode)\\input %t\"" TeX-run-TeX nil (ams-tex-mode) :help "Run AMSTeX") ("ConTeXt" "texexec --once --texutil %(execopts)%t" TeX-run-TeX nil (context-mode) :help "Run ConTeXt once") ("ConTeXt Full" "texexec %(execopts)%t" TeX-run-TeX nil (context-mode) :help "Run ConTeXt until completion") ("ConTeXt Clean" "texutil --purgeall" TeX-run-interactive nil (context-mode) :help "Clean temporary ConTeXt files") ("BibTeX" "bibtex %s" TeX-run-BibTeX nil t :help "Run BibTeX") ("View" "%V" TeX-run-discard nil t :help "Run Viewer") ("Print" "%p" TeX-run-command t t :help "Print the file") ("Queue" "%q" TeX-run-background nil t :help "View the printer queue" :visible TeX-queue-command) ("File" "%(o?)dvips %d -o %f " TeX-run-command t t :help "Generate PostScript file") ("Index" "makeindex %s" TeX-run-command nil t :help "Create index file") ("Check" "lacheck %s" TeX-run-compile nil (latex-mode) :help "Check LaTeX file for correctness") ("Spell" "" TeX-run-ispell-on-document nil t :help "Spell-check the document") ("Other" "" TeX-run-command t t :help "Run an arbitrary command")))) '(TeX-output-view-style (quote (("^dvi$" ("^landscape$" "^pstricks$\\|^pst-\\|^psfrag$") "%(o?)dvips -t landscape %d -o && gv %f") ("^dvi$" "^pstricks$\\|^pst-\\|^psfrag$" "%(o?)dvips %d -o && gv %f") ("^dvi$" ("^a4\\(?:dutch\\|paper\\|wide\\)\\|sem-a4$" "^landscape$") "%(o?)xdvi %dS -paper a4r -s 0 %d") ("^dvi$" "^a4\\(?:dutch\\|paper\\|wide\\)\\|sem-a4$" "%(o?)xdvi %dS -paper a4 %d") ("^dvi$" ("^a5\\(?:comb\\|paper\\)$" "^landscape$") "%(o?)xdvi %dS -paper a5r -s 0 %d") ("^dvi$" "^a5\\(?:comb\\|paper\\)$" "%(o?)xdvi %dS -paper a5 %d") ("^dvi$" "^b5paper$" "%(o?)xdvi %dS -paper b5 %d") ("^dvi$" "^letterpaper$" "%(o?)xdvi %dS -paper us %d") ("^dvi$" "^legalpaper$" "%(o?)xdvi %dS -paper legal %d") ("^dvi$" "^executivepaper$" "%(o?)xdvi %dS -paper 7.25x10.5in %d") ("^dvi$" "." "%(o?)xdvi %dS %d") ; ("^pdf$" "." "open -a /Applications/TeXShop.app %o") ("^pdf$" "." "open -a /Applications/Skim.app %o") ("^html?$" "." "open %o"))))) (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. )