;; 2008/9/16
;; ;; http://d.hatena.ne.jp/yuko1658/20071213/1197517201
(setq load-path
(append (list (expand-file-name "~/elisp/") ) load-path)) ;; 2007/11/1 ;; .emacsへの雑多な設定より ;;; 色を付ける (global-font-lock-mode t) ;;(setq font-lock-support-mode 'fast-lock-mode) ;;(setq font-lock-maximum-decoration t) ;;(setq fast-lock-cache-directories '("~/.emacs-flc" "."))
;;; 対応する括弧を光らせる。 (show-paren-mode 1)
;;; バックアップファイルを作らない (setq backup-inhibited t)
;;; 終了時にオートセーブファイルを消す (setq delete-auto-save-files t)
;;; 補完時に大文字小文字を区別しない (setq completion-ignore-case t)
;;; 強力な補完機能を使う ;;; p-bでprint-bufferとか ;;(load "complete") (partial-completion-mode 1)
;;; 補完可能なものを随時表示 ;;; 少しうるさい (icomplete-mode 1)
;;; カーソルの点滅を止める (blink-cursor-mode 0)
;;; カーソルの位置が何文字目かを表示する (column-number-mode t)
;;; カーソルの位置が何行目かを表示する (line-number-mode t)
;;; スクロールを一行ずつにする (setq scroll-step 1)
;;; スクロールバーを右側に表示する (set-scroll-bar-mode 'right)
;;; 行の先頭でC-kを一回押すだけで行全体を消去する (setq kill-whole-line t)
;;; バッファの最後でnewlineで新規行を追加するのを禁止する (setq next-line-add-newlines nil)
;;; 最終行に必ず一行挿入する (setq require-final-newline t)
;;; 一行が 80 字以上になった時には自動改行する (setq fill-column 80) (setq-default auto-fill-mode t)
;;; emacs -nw で起動した時にメニューバーを消す (if window-system (menu-bar-mode 1) (menu-bar-mode -1))
;;; 圧縮されたファイルも編集できるようにする (auto-compression-mode t)
;;; タイトルバーにファイル名を表示する (setq frame-title-format (format "emacs@%s : %%f" (system-name)))
;;; モードラインに時間を表示する (display-time)
;;; 現在の関数名をモードラインに表示 (which-function-mode 1)
;;; 略語定義ファイルの読み込み ;;; ~/elisp/.abbrev_defsが存在していなかったら読み込まない
;; change directory from site-lisp to elisp
(let ((file "~/elisp/.abbrev_defs")) (setq abbrev-file-name file) (if (file-exists-p file)
;; (quietly-read-abbrev-file file)))
(read-abbrev-file file)))
;;; 略語定義が変更されていたら黙って保存 (setq save-abbrevs 'silently)
;;; デフォルトでAbbrevモードにする (setq default-abbrev-mode t)
;;; 最終更新日の自動挿入 ;;; ファイルの先頭から 8 行以内に Time-stamp: <> または ;;; Time-stamp: " " と書いてあれば、セーブ時に自動的に日付が挿入される
(require 'time-stamp)
;; 日本語で日付を入れたくないのでlocaleをCにする (defun time-stamp-with-locale-c () (let ((system-time-locale "C")) (time-stamp) nil))
(if (not (memq 'time-stamp-with-locale-c write-file-hooks)) (add-hook 'write-file-hooks 'time-stamp-with-locale-c))
(setq time-stamp-format "%3a %3b %02d %02H:%02M:%02S %Z %:y")
;;; 画像ファイルを表示する (auto-image-file-mode t)
;;; 自動でファイルを挿入する ;; 2007/11/18 コメントアウト ;;(auto-insert-mode t)
;;; セッションを保存する ;;; 初めは手動でM-x desktop-saveしなければいけない (desktop-load-default) (desktop-read)
;;; 次のGCまでに使用可能なバイト数 (setq gc-cons-threshold 4096000)
;;; 最近使ったファイルを保存(M-x recentf-open-filesで開く) (recentf-mode)
;;2007/11/5 ;;Emacs で C 言語プログラミングを始める人へのイントロダクション ;;flyspell-prog-mode(自動ispell機能) ;;(add-hook 'c-mode-common-hook ;; '(lambda () ;; ;; flyspell-prog-mode をオンにする ;; (flyspell-prog-mode) ;;))
;; 2007/11/18 ;; cvs用キーバインド (global-set-key "\M-s" 'cvs-status)
;; 2007/12/23 ;; カラーテーマ用 ;; http://blog.mizoshiri.com/archives/50 ;; http://www.emacswiki.org/cgi-bin/wiki/ColorTheme (require 'color-theme) (color-theme-initialize) (color-theme-clarity)
(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. '(blink-cursor-mode nil) '(column-number-mode t) '(display-time-mode t) '(inhibit-startup-screen t) '(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. )
;; 2008/3/22
;; フォントの設定
(create-fontset-from-fontset-spec "-shinonome-gothic-medium-r-normal--14-*-*-*-*-*-fontset-shinonome12")
(create-fontset-from-fontset-spec "-shinonome-mincho-medium-r-normal--14-*-*-*-*-*-jisx0208*")
;; デフォルトフォントの変更
(add-to-list 'default-frame-alist
'(font . "-shinonome-gothic-medium-r-normal--14-*-*-*-*-*-jisx0208*"))
;; 2008/6/7
;; http://tmcosmos.org/linux/fedora/7/users.html
;===================================
; Anthy
;===================================
;;(set-input-method "japanese-anthy")
;;
;;
;; 2008/10/25
;; for ruby
;; http://www.goodpic.com/mt/archives2/2005/09/mac_osxemacsrub.html
(autoload 'ruby-mode "ruby-mode"
"Mode for editing ruby source files" t)
(setq auto-mode-alist
(append '(("\\.rb$" . ruby-mode)) auto-mode-alist))
(setq interpreter-mode-alist (append '*1
interpreter-mode-alist))
(autoload 'run-ruby "inf-ruby"
"Run an inferior Ruby process")
(autoload 'inf-ruby-keys "inf-ruby"
"Set local key defs for inf-ruby in ruby-mode")
(add-hook 'ruby-mode-hook
'(lambda () (inf-ruby-keys)))
(global-font-lock-mode 1)
(setq default-frame-alist
(append '((foreground-color . "gray") ; (background-color . "black") ; (cursor-color . "blue") ; ) default-frame-alist))
;; 2008/10/25
;; http://d.hatena.ne.jp/yuko1658/20071213/1197517201
;; ruby-electric
(require 'ruby-electric)
(add-hook 'ruby-mode-hook '(lambda () (ruby-electric-mode t)))
;; 2008/11/10
;; http://dev.ariel-networks.com/Members/matsuyama/auto-complete
(require 'auto-complete)
(global-auto-complete-mode t)
;; 2008/12/20
;; http://dev.ariel-networks.com/Members/matsuyama/auto-complete-0-1-0/view
(setq ac-sources '(ac-source-abbrev ac-source-words-in-buffer))
;; 2008/12/2
;;http://d.hatena.ne.jp/kazu-yamamoto/20081117/1226909425
;;(define-key completion-list-mode-map "\C-n" 'next-completion)
;;(define-key completion-list-mode-map "\C-f" 'next-completion)
;;(define-key completion-list-mode-map "\C-p" 'previous-completion)
;;(define-key completion-list-mode-map "\C-b" 'previous-completion)
;;(define-key completion-list-mode-map "\C-m" 'my-choose-completion)
;;
;;(defun my-choose-completion ()
;; "Choose the completion that point is in or next to."
;; (interactive)
;; (let (beg end completion (buffer completion-reference-buffer)
;; (base-size completion-base-size))
;; (if (and (not (eobp)) (get-text-property (point) 'mouse-face))
;; (setq end (point) beg (1+ (point))))
;; (if (and (not (bobp)) (get-text-property (1- (point)) 'mouse-face))
;; (setq end (1- (point)) beg (point)))
;; (if (null beg)
;; (error "No completion here"))
;; (setq beg (previous-single-property-change beg 'mouse-face))
;; (setq end (or (next-single-property-change end 'mouse-face) (point-max)))
;; (setq completion (buffer-substring-no-properties beg end))
;; (delete-completion-window)
;; (choose-completion-string completion buffer base-size)))
;; 2008/12/20
;; http://d.hatena.ne.jp/mzp/20081207/autoerase
(add-hook 'before-save-hook 'delete-trailing-whitespace)
;; 2008/12/21
;; http://www.cozmixng.org/~kou/emacs/dot_emacs
;;; キーバインド
;;(define-key global-map "\C-h" 'delete-backward-char) ; 削除
(define-key global-map "\M-?" 'help-for-help) ; ヘルプ
(define-key global-map "\C-z" 'undo) ; undo
;; http://d.hatena.ne.jp/fedora9/20081205/1228491364
;====================================
;;; Ctrl + v で貼り付け
;====================================
(defun win-sel ()
(if (or (null (mark t)) (not mark-active)) (setq win-sel-v nil)) win-sel-v)
(defun win-paste () (interactive)
(if (win-sel) (delete-region (region-beginning) (region-end))) (yank))
(global-set-key "\C-v" 'win-paste)
;====================================
;;shift+矢印キーでの範囲選択
;====================================
(pc-selection-mode)
;; http://gimite.net/behind/dot.emacs.txt
;; copy with Ctrl + c
(defun win-unselect ()
(transient-mark-mode -1) (setq win-sel-v nil))
(defun win-copy (BEG END)
(interactive (list (region-beginning) (region-end))) (copy-region-as-kill BEG END) (win-unselect))
(global-set-key "\C-c" 'win-copy)
;; http://at-aka.blogspot.com/2006/04/emacs-ispell.html
;; 辞書補完機能
;; C-h prefix
(define-key help-map "/" 'ispell-complete-word)
;; http://d.hatena.ne.jp/higepon/20060107/1136628498
;; GLOBAL用
(autoload 'gtags-mode "gtags" "" t)
(setq gtags-mode-hook
'(lambda () (local-set-key "\M-t" 'gtags-find-tag) (local-set-key "\M-r" 'gtags-find-rtag) (local-set-key "\M-s" 'gtags-find-symbol) (local-set-key "\C-t" 'gtags-pop-stack) ))
(add-hook 'c-mode-common-hook
'(lambda() (gtags-mode 1)
;; (gtags-make-complete-list)
;; deprecated.
))