Emacs導入しました。

Emacsは、ちょっと前に友人に設定とか全部貰って使ったり使わなかったりはしていた。
何かの手違いでホームディレクトリでsudo rm -R ./ ってしてしまったので、設定全部飛んだから自分で設定作り直した。
バックアップも兼ねてメモ

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; 基本的な感じの設定
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ロードパスの追加
(setq load-path (append
                 '("~/.emacs.d"
                   "~/.emacs.d/packages"
				   "~/.emacs.d/auto-install"
				   )
                 load-path))

;; 追加設定
(load "config/builtins") ;;; 標準Elispの設定
(load "config/packages") ;;; 非標準Elispの設定

;; Localeに合わせた環境の設定
(set-locale-environment nil)

;; 文字
(set-language-environment 'Japanese)
(set-default-coding-systems 'utf-8-unix)
(set-terminal-coding-system 'utf-8-unix)
(set-keyboard-coding-system 'sjis-mac)
(set-clipboard-coding-system 'sjis-mac)
(setq-default buffer-file-coding-system 'utf-8)
(prefer-coding-system 'utf-8)

;; 画面
(if window-system (progn
					(setq initial-frame-alist 
						  '((width . 200)
							(height . 100)
							(top . 0)
							(left . 0)))
					(set-background-color "Black")
					(set-foreground-color "White")
					(set-cursor-color "Gray")
					))

;; 起動時のアレ非表示
(setq inhibit-startup-message t)
;;ビープ音を消す
(setq ring-bell-function 'ignore)

;; カーソルの点滅を止める
(blink-cursor-mode 0)
;; カーソルの位置が何文字目かを表示する
(column-number-mode t)
;; カーソルの位置が何行目かを表示する
(line-number-mode t)

;; スクロールを一行ずつにする
(setq scroll-step 1)
;; スクロールバーを右側に表示する
(set-scroll-bar-mode 'right)

;; ホイールマウス
(mouse-wheel-mode t)
(setq mouse-wheel-follow-mouse t)
;; マウスのホイールスクロールスピードを調節
(global-set-key [wheel-up] '(lambda () "" (interactive) (scroll-down 1)))
(global-set-key [wheel-down] '(lambda () "" (interactive) (scroll-up 1)))
(global-set-key [double-wheel-up] '(lambda () "" (interactive) (scroll-down 2)))
(global-set-key [double-wheel-down] '(lambda () "" (interactive) (scroll-up 2)))
(global-set-key [triple-wheel-up] '(lambda () "" (interactive) (scroll-down 3)))
(global-set-key [triple-wheel-down] '(lambda () "" (interactive) (scroll-up 3)))

;; 対応する括弧を光らせる。
(show-paren-mode 1)
;; ウィンドウ内に収まらないときだけ括弧内も光らせる。
(setq show-paren-style 'mixed)

;; バックアップファイルを作らない
(setq backup-inhibited t)

;; 終了時にオートセーブファイルを消す
(setq delete-auto-save-files t)

;; 補完時に大文字小文字を区別しない
(setq completion-ignore-case t)

;; 強力な補完機能を使う
;; p-bでprint-bufferとか
(partial-completion-mode t)

;; 補完可能なものを随時表示
;; 少しうるさい
(icomplete-mode 1)

;; 行の先頭でC-kを一回押すだけで行全体を消去する
(setq kill-whole-line t)

;; タブキー
(setq tab-width 4)
(setq indent-line-function 'indent-relative-maybe)

;; タイトルバーにファイル名を表示する
;; (setq frame-title-format (format "%%f" (system-name)))
(setq frame-title-format '("[%b] - Emacs "))

;; 終了時バイトコンパイル
(add-hook 'kill-emacs-query-functions
          (lambda ()
            (if (file-newer-than-file-p (concat user-emacs-directory "init.el") (concat user-emacs-directory "init.elc"))
                (byte-compile-file (concat user-emacs-directory "init.el")))
            (byte-recompile-directory (concat user-emacs-directory "local-lisp") 0)
            (byte-recompile-directory (concat user-emacs-directory "private") 0)
            (byte-recompile-directory (concat user-emacs-directory "site-start.d") 0)
            (byte-recompile-directory (concat user-emacs-directory "config") 0)
            (byte-recompile-directory (concat user-emacs-directory "config/packages") 0)
            (byte-recompile-directory (concat user-emacs-directory "packages") 0)
            ))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; 標準パッケージの設定
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(require 'autoinsert)
(setq auto-insert-directory "~/.emacs.d/autoinsert/")
(setq auto-insert-alist
      (nconc '( ("\\.c$" . "template.c")
;                ("\\.cpp$" . "template.cpp")
;                ("\\.js$" . "template.js")
;                ("\\.html$" . "template.html")
;                ("\\.css$" . "template.css")
;                ("\\.rb$" . "template.rb")
;                ("\\.py$" . "template.py")
;                ("\\.pl$" . "template.pl")
                ) auto-insert-alist))
(add-hook 'find-file-not-found-hooks 'auto-insert)

(require 'flymake)
(defun flymake-cc-init ()
  (let* ((temp-file   (flymake-init-create-temp-buffer-copy
                       'flymake-create-temp-inplace))
         (local-file  (file-relative-name
                       temp-file
                       (file-name-directory buffer-file-name))))
    (list "g++" (list "-Wall" "-Wextra" "-fsyntax-only" local-file))))
(push '("\\.cpp$" flymake-cc-init) flymake-allowed-file-name-masks)
(add-hook 'c++-mode-hook
          '(lambda ()
             (flymake-mode t)))



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; 入れたパッケージの設定
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(require 'auto-install)
(setq auto-install-directory "~/.emacs.d/auto-install/")
(auto-install-update-emacswiki-package-name t)
(auto-install-compatibility-setup)             ; 互換性確保
(setq auto-install-use-wget t)				   ; エラー出るときあるらしいからそれの対策的な

(require 'multi-term)
(setq multi-term-program shell-file-name)
(global-set-key (kbd "C-c t") '(lambda ()
								 (interactive)
								 (multi-term)))
(global-set-key (kbd "C-c n") 'multi-term-next) ; Shellバッファの切替 next
(global-set-key (kbd "C-c p") 'multi-term-prev) ; Shellバッファの切替 prev

;; anything.el
(setq warning-suppress-types nil)
(require 'anything-startup)
(require 'anything-config)
(defun my-anything () "Anything command for you.It is automatically generated by `anything-migrate-sources'."
  (interactive)
  (anything-other-buffer
   '(((name . "Buffers")
	  (candidates lambda nil 
				  (remove-if (lambda (name)
							   (or 
								(equal name anything-buffer) (eq 32 (aref name 0))))
							 (mapcar
							  (quote buffer-name) (buffer-list))))
	  (type . buffer))
	 ((name . "File Name History")
	  (candidates . file-name-history)
	  (match (lambda (candidate)
			   (string-match anything-pattern (file-name-nondirectory candidate)))
			 (lambda (candidate)
			   (let ((dir (file-name-directory candidate)))
				 (if dir (string-match anything-pattern dir)))))
	  (type . file))
	 ((name . "Files from Current Directory")
	  (init lambda nil 
			(setq anything-default-directory default-directory))
	  (candidates lambda nil 
				  (directory-files anything-default-directory))
	  (type . file)) 
	 ((name . "Complex Command History")
	  (candidates lambda nil 
				  (mapcar (quote prin1-to-string) command-history))
	  (action ("Repeat Complex Command" lambda (c) 
			   (eval (read c))))
	  (delayed))
	 ) "*my-anything*"))
(global-set-key (kbd "C-;") 'anything)
(define-key anything-map "\C-p" 'anything-previous-line)
(define-key anything-map "\C-n" 'anything-next-line)
(define-key anything-map "\C-v" 'anything-next-page)
(define-key anything-map "\M-v" 'anything-previous-page)

(require 'yasnippet)
(yas/initialize)
(setq yas/root-directory "~/.emacs.d/snippets")
(yas/load-directory yas/root-directory)
(require 'dropdown-list)
(setq yas/prompt-functions '(yas/dropdown-prompt
							 yas/ido-prompt
							 yas/completing-prompt))

(require 'auto-complete)
(global-auto-complete-mode t)

(require 'linum)
(global-linum-mode t)      ; デフォルトで linum-mode を有効にする
(setq linum-format "%5d ") ; 5 桁

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; text-mode
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(setq auto-mode-alist
      (append '(("\\.C$"  . c++-mode)
                ("\\.cc$" . c++-mode)
                ("\\.cpp$". c++-mode)
                ("\\.hh$" . c++-mode)
                ("\\.c$"  . c-mode)
                ("\\.h$"  . c++-mode))
              auto-mode-alist))



(add-hook 'c-mode-common-hook
		  '(lambda ()
			 (require 'vc-hooks)
			 (setq completion-mode t)
			 ;; make のオプションは聞いてこない
			 (setq compilation-read-command nil)
			 ;; make するとき 全バッファを自動的にsaveする
			 (setq compilation-ask-about-save nil)
			 (define-key c-mode-base-map [f1] 'manual-entry)
			 (define-key c-mode-base-map [f4] 'next-error)
			 (define-key c-mode-base-map [(shift f4)] 'previous-error)
			 (define-key c-mode-base-map [f7] 'compile)
			 (define-key c-mode-base-map [(shift f7)] 
			   '(lambda () 
				  (interactive)
				  ;;(require 'compile)
				  ;;(save-some-buffers (not compilation-ask-about-save) nil)
				  (compile-internal "make clean all" "No more errors")))
			 ))

(add-hook 'python-mode-hook
		  '(lambda()
			 (setq indent-tabs-mode t)
			 (setq indent-level 4)
			 (setq python-indent 4)
			 (setq tab-width 4))) 

こんなん。