emacs config
(setq backup-directory-alist
`((".*" . ,temporary-file-directory)))
(setq auto-save-file-name-transforms
`((".*" ,temporary-file-directory t)))
(setq backup-directory-alist '(("." . "~/.emacs.d/backup"))
backup-by-copying t ; Dont delink hardlinks
version-control t ; Use version numbers on backups
delete-old-versions t ; Automatically delete excess
kept-new-versions 20 ; how many of the newest version
kept-old-versions 5 ; and how many of the old
)
(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.
'(show-paren-mode t))
(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 (:family "Inconsolata" :foundry "unknown" :slant normal :weight normal :height 143 :width normal)))))
(require 'package)
(add-to-list 'package-archives
'("melpa" . "http://melpa.milkbox.net/packages/") t)
(package-initialize)
(setq-default inhibit-startup-screen t)
;; Use only spaces (no tabs at all)
(setq-default indent-tabs-mode t)
;; Always show column numbers.
(setq-default columnt-number-mode t)
;; Hook for displaying full pathname for files.
(add-hook 'find-file-hooks
'(lambda ()
(setq mode-line-buffer-identification 'buffer-file-truename)))
;; For easy window scrolling up and down
(global-set-key "\M-n" 'scroll-up-line)
(global-set-key "\M-p" 'scroll-down-line)
;; yasnippet
(add-to-list 'load-path
"~/.emacs.d/plugins")
(require 'yasnippet)
;;(yas/load-directory "~/.emacs.d/plugins/yasnippet/snippets")
(yas/load-directory "~/.emacs.d/elpa/yasnippet-20120822/snippets")
(yas/global-mode 1)
(setq yas/also-auto-indent-first-line t)
;;;; Expand snippet synchronously
(defvar yas/recursive-edit-flag nil)
(defun yas/expand-sync ()
"Execute `yas/expand'. This function exits after expanding snippet."
(interactive)
(let ((yas/recursive-edit-flag t))
(call-interactively 'yas/expand)
(recursive-edit)))
(defun yas/expand-snippet-sync (content &optional start end expand-env)
"Execute `yas/expand-snippet'. This function exits after expanding snippet."
(let ((yas/recursive-edit-flag t))
(yas/expand-snippet content start end expand-env)
(recursive-edit)))
(defun yas/after-exit-snippet-hook--recursive-edit ()
(when yas/recursive-edit-flag
(throw 'exit nil)))
(add-hook 'yas/after-exit-snippet-hook 'yas/after-exit-snippet-hook--recursive-edit)
(global-set-key (kbd "C-q") 'yas/expand-sync)