どっとemacs

;; 起動時の画面を出さない
(setq inhibit-startup-message t)

;; 拡張子追加
(setq auto-mode-alist
      (append
       '(
	  ("\\.tt$"    . html-mode)
	  ("\\.tt2$"    . html-mode)
;;	  ("\\.h$"    . c++-mode)
;;	   ("\\.hpp$"  . c++-mode)
;;	    ("\\.txt$"  . text-mode)
;;	     ("\\.message$" . text-mode)
;;	      ("\\.htm" . html-helper-mode)
;;	       ("\\.shtml$" . html-helper-mode)
;;	        ("\\.php" . html-helper-mode)
		 ) auto-mode-alist))

;; バッファリスト
(global-set-key "\C-x\C-b" 'buffer-menu)

;; backspace
(global-set-key "\C-h" 'delete-backward-char)

;; no backup
(setq make-backup-files nil)

;; replace
(global-set-key "\M-%" 'query-replace)

;; undo
(global-set-key "\C-u" 'undo)
;; redo
;;C-f C-u

;; color
(global-font-lock-mode t)
(add-hook 'font-lock-mode-hook
         '(lambda ()
            (make-face 'comment-face)
             (set-face-foreground 'comment-face "bisque1")
             (setq font-lock-comment-face 'comment-face)
))

;;; 対応する括弧を光らせる。
(show-paren-mode 1)

;;; モードラインに時間を表示する
(display-time)

;;; 現在の関数名をモードラインに表示
(which-function-mode 1)

;;; カーソルの位置が何文字目かを表示する
(column-number-mode t)

;;; カーソルの位置が何行目かを表示する
(line-number-mode t)

;;; 最近使ったファイルを保存(M-x recentf-open-filesで開く)
(recentf-mode)

;;; 時刻の書式に日付を追加する
(setq display-time-day-and-date t)

;;タブ幅を 4 に設定
(setq-default tab-width 4)
;;タブ幅の倍数を設定
(setq tab-stop-list
  '(4 8 12 16 20 24 28 32 36 40 44 48 52 56 60))
;;タブではなくスペースを使う
(setq-default indent-tabs-mode nil)
(setq indent-line-function 'indent-relative-maybe)


;; スペース表示
;;(defface my-face-r-1 '*1
  (font-lock-add-keywords
   major-mode
   '(("\t" 0 my-face-b-2 append)
     (" " 0 my-face-b-1 append)
     ("[ \t]+$" 0 my-face-u-1 append)
     ;;("[\r]*\n" 0 my-face-r-1 append)
     )))
(ad-enable-advice 'font-lock-mode 'before 'my-font-lock-mode)
(ad-activate 'font-lock-mode)

;; -- ref ----------
;; 補完
;; M-/

;; 英単語の spell check 
;; M-$

;; M-x grep [Enter]
;; 検索語 と 対象ファイル を入力
;;   例: Run grep (like this): grep -n -e 検索語 *.txt [Enter]
;; C-x o (grep の ウインドウに移って)
;; 見たいファイルの行で [Enter] を押すと、そのファイルにジャンプ

;; dired モードの起動
;; C-x d

;; バッファリスト
;; C-x C-b 
;; C-o


;; 単にタブ文字を挿入する
;; C-q TAB

;; 文字コード変換
;; C-x [RET] f
;; M-x set-buffer-file-coding-system[RET]

*1:t (:background "gray15"))) nil) (defface my-face-b-1 '((t (:background "gray"))) nil) (defface my-face-b-2 '((t (:background "gray26"))) nil) (defface my-face-u-1 '((t (:foreground "SteelBlue" :underline t))) nil) ;;(defvar my-face-r-1 'my-face-r-1) (defvar my-face-b-1 'my-face-b-1) (defvar my-face-b-2 'my-face-b-2) (defvar my-face-u-1 'my-face-u-1) (defadvice font-lock-mode (before my-font-lock-mode (