(setq inhibit-splash-screen t)
(show-paren-mode t)
(fset 'yes-or-no-p 'y-or-n-p)
(blink-cursor-mode 0)
(delete-selection-mode t)
(column-number-mode t)
(package-initialize)
(setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
("marmalade" . "http://marmalade-repo.org/packages/")
("melpa" . "http://melpa.milkbox.net/packages/")))
(load-theme 'wombat t)
(require 'auto-complete-config)
(ac-config-default)
(ido-mode t)
(menu-bar-mode 0)
(tool-bar-mode 0)
(scroll-bar-mode 0)
(global-linum-mode 0)
(global-set-key (kbd "C-x k") 'kill-this-buffer)
(defvar emacs-autosave-directory "~/.emacs.d/autosaves/")
(setq backup-directory-alist
`((".*" . ,emacs-autosave-directory))
auto-save-file-name-transforms
`((".*" ,emacs-autosave-directory t)))
(defun hideshow-on ()
(local-set-key (kbd "C-c <right>") 'hs-show-block)
(local-set-key (kbd "C-c C-<right>") 'hs-show-block)
(local-set-key (kbd "C-c <left>") 'hs-hide-block)
(local-set-key (kbd "C-c C-<left>") 'hs-hide-block)
(local-set-key (kbd "C-c <up>") 'hs-hide-all)
(local-set-key (kbd "C-c C-<up>") 'hs-hide-all)
(local-set-key (kbd "C-c <down>") 'hs-show-all)
(local-set-key (kbd "C-c C-<down>") 'hs-show-all)
(hs-minor-mode t))
(add-hook 'c-mode-common-hook 'hideshow-on)
(defun java-shortcuts ()
(define-abbrev-table 'java-mode-abbrev-table
'(("psv" "public static void main(String[] args) {" nil 0)
("sop" "System.out.printf" nil 0)
("sopl" "System.out.println" nil 0)))
(abbrev-mode t))
(add-hook 'java-mode-hook 'java-shortcuts)
(defun java-setup ()
(set (make-variable-buffer-local 'compile-command)
(concat "javac " (buffer-name)))
(local-set-key (kbd "C-c C-c") 'compile))
(add-hook 'java-mode-hook 'java-setup)
(defun tidy ()
"Ident, untabify and unwhitespacify current buffer, or region if active."
(interactive)
(let ((beg (if (region-active-p) (region-beginning) (point-min)))
(end (if (region-active-p) (region-end) (point-max))))
(whitespace-cleanup)
(indent-region beg end nil)
(untabify beg end)))
(global-set-key (kbd "<C-tab>") 'tidy)