(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. '(LaTeX-indent-level 0) '(blink-cursor-mode nil) '(case-fold-search nil) '(cdlatex-paired-parens "[{($") '(column-number-mode t) '(cua-mode t nil (cua-base)) '(doc-view-ghostscript-program "c:/CTeX/gs/gs8.51/bin/gswin32c.exe") '(doc-view-resolution 100) '(ess-indent-level 4 t) '(flyspell-delay 1) '(matlab-indent-level 4) '(org-export-latex-default-packages-alist (quote (("AUTO" "inputenc" t) ("T1" "fontenc" t) ("" "fixltx2e" nil) ("" "graphicx" t) ("" "longtable" nil) ("" "float" nil) ("" "wrapfig" nil) ("" "soul" t) ("" "textcomp" t) ("" "marvosym" t) ("" "wasysym" t) ("" "latexsym" t) ("" "amssymb" t) ("" "hyperref" nil) "\\tolerance=1000" ("margin=0.9in" "geometry" nil) ("" "amsmath" nil)))) '(org-export-with-LaTeX-fragments (quote dvipng)) '(preview-auto-cache-preamble t) '(preview-image-type (quote pnm)) '(save-place t nil (saveplace)) '(show-paren-mode t) '(text-mode-hook (quote (turn-on-auto-fill turn-on-visual-line-mode text-mode-hook-identify))) '(uniquify-buffer-name-style (quote forward) nil (uniquify))) (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. '(default ((t (:inherit nil :stipple nil :background "#0C1021" :foreground "#F8F8F8" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 120 :width normal :foundry "outline" :family "DejaVu Sans Mono")))) '(rainbow-delimiters-depth-1-face ((((background dark)) (:foreground "gray")))) '(rainbow-delimiters-depth-2-face ((((background dark)) (:foreground "darkcyan")))) '(rainbow-delimiters-depth-3-face ((((background dark)) (:foreground "orange")))) '(rainbow-delimiters-depth-4-face ((((background dark)) (:foreground "blue")))) '(rainbow-delimiters-depth-5-face ((((background dark)) (:foreground "darkgreen")))) '(rainbow-delimiters-depth-6-face ((((background dark)) (:foreground "yellow")))) '(rainbow-delimiters-depth-7-face ((((background dark)) (:foreground "purple")))) '(rainbow-delimiters-depth-8-face ((((background dark)) (:foreground "brown")))) '(rainbow-delimiters-depth-9-face ((((background dark)) (:foreground "red"))))) ;;--------------- general settings --------------- ;; maximize window on start-up and split window evenly (setq initial-frame-alist '((top . 0) (left . 0))) (defun w32-maximize-frame () "Maximize the current frame" (interactive) (w32-send-sys-command 61488)) (add-hook 'window-setup-hook 'w32-maximize-frame t) (add-hook 'window-setup-hook 'split-window-horizontally) ;; split windows evenly (defadvice split-window-horizontally (after rebalance-windows activate) (balance-windows)) (ad-activate 'split-window-horizontally) (defadvice split-window-vertically (after rebalance-windows activate) (balance-windows)) (setq w32-get-true-file-attributes nil) ;; change a few annoying default settings (setq-default fill-column 75) (setq make-backup-files nil) (setq inhibit-startup-message t) (tool-bar-mode -1) (scroll-bar-mode -1) ;(menu-bar-mode -1) (blink-cursor-mode -1) (setq visible-bell t) (fset 'yes-or-no-p 'y-or-n-p) (setq frame-title-format "Emacs@%b") (setq ediff-split-window-function 'split-window-horizontally) ;; tabbed buffers (require 'tabbar) (tabbar-mode 1) (global-set-key (kbd "M-") 'tabbar-backward-group) (global-set-key (kbd "M-") 'tabbar-forward-group) (global-set-key (kbd "M-") 'tabbar-backward) (global-set-key (kbd "M-") 'tabbar-forward) ;; auto pair some symbols globaly (setq skeleton-pair t) (global-set-key (kbd "(") 'skeleton-pair-insert-maybe) (global-set-key (kbd "[") 'skeleton-pair-insert-maybe) (global-set-key (kbd "{") 'skeleton-pair-insert-maybe) (global-set-key (kbd "\"") 'skeleton-pair-insert-maybe) ;(global-set-key (kbd "$") 'skeleton-pair-insert-maybe) ;; desktop-save mode (require 'saveplace) (desktop-save-mode 1) (setq-default save-place t) ;; open recent files, bind to [F1] (require 'recentf) (recentf-mode 1) (setq recentf-max-saved-items 40) (setq recentf-max-menu-items 40) ;; show line numbers, bind to [F5] (autoload 'linum-mode "linum" "toggle line numbers on/off" t) ;; save and restore buffer layout (require 'layout-restore) (global-set-key [?\C-c ?k] 'layout-save-current) (global-set-key [?\C-c ?\C-l ?\C-c] 'layout-restore) (global-set-key [?\C-c ?\C-l ?\C-j] 'layout-delete-current) ;; kill all other buffers (defun kill-other-buffers () "Kill all other buffers." (interactive) (mapc 'kill-buffer (delq (current-buffer) (buffer-list)))) ;; word-count-mode (autoload 'word-count-mode "word-count" "Minor mode to count words." t nil) ;; smooth scrolling (setq redisplay-dont-pause t scroll-margin 1 scroll-step 1 scroll-conservatively 10000 scroll-preserve-screen-position 1) ;; rainbow-delimiters (require 'rainbow-delimiters) (setq-default frame-background-mode 'dark) (when (require 'rainbow-delimiters nil 'noerror) (add-hook 'scheme-mode-hook 'rainbow-delimiters-mode) (add-hook 'LaTeX-mode-hook 'rainbow-delimiters-mode) (add-hook 'emacs-lisp-mode-hook 'rainbow-delimiters-mode) ) ;; color theme (add-to-list 'load-path "/color-theme") (require 'color-theme) (color-theme-initialize) (load-file "C:/emacs/site-lisp/color-theme/color-theme-blackboard.elc") (color-theme-blackboard) ;(color-theme-clarity) ;(color-theme-deep-blue) ;(color-theme-dark-blue2) ;(color-theme-gray30) ;; ido mode (require 'ido) (ido-mode 'both) ; for buffers and files (setq ido-everywhere t) (setq ido-use-filename-at-point nil) (setq ido-save-directory-list-file "~/ido.last" ido-ignore-buffers ;; ignore these guys '("\\` " "^\*Mess" "^\*Back" ".*Completion" "^\*Ido" "^\*trace" "^\*compilation" "^\*GTAGS" "^session\.*" "^\*scratch" "^\*ESS") ido-case-fold t ; be case-insensitive ido-enable-last-directory-history t ; remember last used dirs ido-max-work-directory-list 200 ; should be enough ido-max-work-file-list 200 ; remember many ido-max-dir-file-cache 200 ido-max-directory-size 200 ido-use-filename-at-point nil ; don't use filename at point (annoying) ido-use-url-at-point nil ; don't use url at point (annoying) ido-enable-flex-matching nil ; don't try to be too smart ido-max-prospects 5 ; don't spam my minibuffer ido-confirm-unique-completion t) ; wait for RET, even with unique completion ;; when using ido, the confirmation is rather annoying... (setq confirm-nonexistent-file-or-buffer nil) (setq ido-file-extensions-order '(".tex" ".pdf" ".org" ".R" ".m" ".dvi")) ;; make frame invisible instead of existing emacs when "C-x C-c" (require 'server) (defun my-done () (interactive) (server-edit) (make-frame-invisible nil t)) (global-set-key (kbd "C-x C-c") 'my-done) ;; add time-stamp when saving if we have "Time-stamp: <>" in the first line (setq time-stamp-active t ; enable time-stamps time-stamp-format "%04y-%02m-%02d %02H:%02M:%02S (%u)") ; date format (add-hook 'write-file-hooks 'time-stamp) ; update when saving ; byte-compile .emacs when saving (defun autocompile nil "compile itself if ~/.emacs.el" (interactive) (if (string= (buffer-file-name) (concat default-directory ".emacs")) (byte-compile-file (buffer-file-name)))) (add-hook 'after-save-hook 'autocompile) ;;key bindings (global-set-key [f1] 'recentf-open-files) (global-set-key [f2] 'split-window-horizontally ) (global-set-key [f3] 'split-window-vertically ) (global-set-key [f4] 'query-replace) (global-set-key [f5] 'linum-mode) (global-set-key [f6] 'kill-other-buffers) (global-set-key [f7] 'word-count-mode) (global-set-key [f8] 'align-current) (global-set-key "\C-w" 'backward-kill-word) (global-set-key "\C-c\C-k" 'kill-region) (global-set-key "\C-l" 'other-window) (global-set-key (kbd "M-p") 'scroll-down) (global-set-key (kbd "M-n") 'scroll-up) ;;--------------- settings for org-mode --------------- (setq load-path (cons "C:/emacs/org-7.7/lisp" load-path)) (setq load-path (cons "C:/emacs/org-7.7/contrib/lisp" load-path)) (add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode)) (require 'org-install) (add-hook 'org-mode-hook 'turn-on-org-cdlatex) (setq org-export-with-LaTeX-fragments t) (setq org-export-author-info nil org-export-email-info nil org-export-creator-info t org-export-time-stamp-file t org-export-himl-validation-link nil) (setq org-export-html-postamble-format 'auto) (org-babel-do-load-languages 'org-babel-load-languages '((R . t) (emacs-lisp . t))) (require 'orgstart) ;;--------------- settings for AUCTeX --------------- ;; load reftex & cdlatex (autoload 'reftex-mode "reftex" "RefTeX Minor Mode" t) (autoload 'turn-on-reftex "reftex" "RefTeX Minor Mode" nil) (autoload 'reftex-citation "reftex-cite" "Make citation" nil) (autoload 'reftex-index-phrase-mode "reftex-index" "Phrase mode" t) (autoload 'cdlatex-mode "cdlatex" "CDLaTeX Mode" t) (autoload 'turn-on-cdlatex "cdlatex" "CDLaTeX Mode" nil) (add-hook 'LaTeX-mode-hook 'turn-on-reftex) (add-hook 'LaTeX-mode-hook 'turn-on-cdlatex) (add-hook 'doc-view-mode-hook 'auto-revert-mode) ; auto revert doc-view (setq preview-scale-function 1.7) ; enlarge equation preview (add-hook 'LaTeX-mode-hook (lambda () (setq TeX-PDF-mode t) ; use pdflatex by default (setq TeX-auto-save t) ; recommended in quickstart (TeX-fold-mode t) (setq TeX-save-query nil) ; autosave before compiling )) ;;flyspell check (autoload 'flyspell-mode "flyspell" "On-the-fly spelling checker." t) (setq flyspell-issue-welcome-flag nil) (add-hook 'text-mode-hook 'flyspell-mode) ;; define more snippet for cdlatex (require 'cdlatex_snippet) ;--------------- settings for ESS-mode --------------- (setq inferior-R-program-name "C:/Program Files/R/R-2.13.1/bin/X64/Rterm.exe") (require 'ess-site) (require 'ess-eldoc) ; display args whenever you're in () (require 'ess-evaluation) (add-hook 'inferior-ess-mode-hook 'ess-use-eldoc) (setq ess-swv-plug-into-AUCTeX-p t) ; use AUCTeX when sweaving (setq ess-default-style 'C++) ; use C++ code style (setq ess-ask-for-ess-directory nil) ; use current directory (setq ess-eval-visibly-p nil) ; speed up R evaluation ;; use ess-tracebug to debug R code (require 'ess-tracebug) (add-hook 'ess-post-run-hook 'ess-tracebug t) (define-key ess-mode-map "\M-]" 'next-error) (define-key ess-mode-map "\M-[" 'previous-error) (define-key inferior-ess-mode-map "\M-]" 'next-error-no-select) (define-key inferior-ess-mode-map "\M-[" 'previous-error-no-select) ;;--------------- settings for matlab-mode --------------- (autoload 'matlab-mode "matlab" "Matlab Editing Mode" t) (add-to-list 'auto-mode-alist '("\\.m$" . matlab-mode)) (setq matlab-indent-function t) (setq matlab-shell-command "matlab")