(require 'filecache)
(file-cache-add-directory-list
(list "~" ))
(define-key minibuffer-local-completion-map
"\C-c\C-i" 'file-cache-minibuffer-complete)
(set-message-beep 'silent)
;;Mail
(global-set-key "\C-xm" 'gnus )
;; 保存先を指定する
(setq abbrev-file-name "~/.abbrev_defs")
;; 略称展開のキーバインドを指定する
(define-key esc-map " " 'expand-abbrev) ;; M-SPC
;; 起動時に保存した略称を読み込む
(quietly-read-abbrev-file)
;; 略称を保存する
(setq save-abbrevs t)
;;俺俺path
(setq load-path
(append
(list
(expand-file-name "~/elisp/")
)
load-path))
;;環境別の変数?
(defvar run-unix
(or (equal system-type 'gnu/linux)
(equal system-type 'usg-unix-v)))
(defvar run-w32
(and (null run-unix)
(or (equal system-type 'windows-nt)
(equal system-type 'ms-dos))))
(defvar run-emacs20
(and (equal emacs-major-version 20)
(null (featurep 'xemacs))))
(defvar run-emacs21
(and (equal emacs-major-version 21)
(null (featurep 'xemacs))))
(defvar run-meadow (featurep 'meadow))
(defvar run-meadow1 (and run-meadow run-emacs20))
(defvar run-meadow2 (and run-meadow run-emacs21))
(defvar run-xemacs (featurep 'xemacs))
(defvar run-xemacs-no-mule
(and run-xemacs (not (featurep 'mule))))
;;俺俺キーバインド
;;;やっぱりバックスペース我慢成らん
;;; C-h を backspace として使う
(keyboard-translate ?\C-h ?\C-?)
(global-set-key "\C-h" nil)
(global-unset-key "\M-o")
;;文字コード関係とか。うぜぇ
;(require 'un-define)
;(require 'jisx0213)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-buffer-file-coding-system 'utf-8-unix)
(setq default-buffer-file-coding-system 'utf-8)
(set-default-coding-systems 'utf-8-unix)
(when run-meadow
;; Meadow 用の設定をここに書く
(require 'menu-tree)
(w32-add-font
"KonatuPlus Mono Light 16"
'((spec
((:char-spec ascii :height any)
strict
(w32-logfont "KonatuPlus Mono Light" 0 -16 400 0 nil nil nil 0 1 3 0))
((:char-spec ascii :height any :weight bold)
strict
(w32-logfont "KonatuPlus Mono Light" 0 -16 700 0 nil nil nil 0 1 3 0)
((spacing . -1)))
((:char-spec ascii :height any :slant italic)
strict
(w32-logfont "KonatuPlus Mono Light" 0 -16 400 0 t nil nil 0 1 3 0))
((:char-spec ascii :height any :weight bold :slant italic)
strict
(w32-logfont "KonatuPlus Mono Light" 0 -16 700 0 t nil nil 0 1 3 0)
((spacing . -1)))
((:char-spec japanese-jisx0208 :height any)
strict
(w32-logfont "KonatuPlus Mono Light" 0 -16 400 0 nil nil nil 128 1 3 0))
((:char-spec japanese-jisx0208 :height any :weight bold)
strict
(w32-logfont "KonatuPlus Mono Light" 0 -16 700 0 nil nil nil 128 1 3 0)
((spacing . -1)))
((:char-spec japanese-jisx0208 :height any :slant italic)
strict
(w32-logfont "KonatuPlus Mono Light" 0 -16 400 0 t nil nil 128 1 3 0))
((:char-spec japanese-jisx0208 :height any :weight bold :slant italic)
strict
(w32-logfont "KonatuPlus Mono Light" 0 -16 700 0 t nil nil 128 1 3 0)
((spacing . -1))))))
; 起動時およびnew-frame時のフレーム(ウィンドウ)の設定。
(add-to-list 'default-frame-alist '(font . "KonatuPlus Mono Light 16"))
; 現在のフレームの設定(.emacs中では省略可)
(set-frame-font "KonatuPlus Mono Light 16")
; IMEのフォントを設定。こういう書式でないとだめらしい。
(let ((logfont '(w32-logfont "KonatuPlus Mono Light" 0 0 400 0 nil nil nil 128 1 3 0)))
(modify-frame-parameters (selected-frame) (list (cons 'ime-font logfont)))
(add-to-list 'default-frame-alist (cons 'ime-font logfont))
)
;; 文字コード/地域の設定
(set-language-environment "Japanese")
(prefer-coding-system 'cp932-dos)
(set-keyboard-coding-system 'cp932-dos)
(set-clipboard-coding-system 'cp932-dos)
;; U+0080 - U+2E7F の文字を CJKにデコード http://web.archive.org/web/20060620002245/nijino.homelinux.net/emacs/utf-cjk.html
(utf-translate-cjk-set-unicode-range
'((#x00a2 . #x00a3) ; ?, ?
(#x00a7 . #x00a8) ; §, ¨
(#x00ac . #x00ac) ; ?
(#x00b0 . #x00b1) ; °, ±
(#x00b4 . #x00b4) ; ´
(#x00b6 . #x00b6) ; ¶
(#x00d7 . #x00d7) ; ×
(#X00f7 . #x00f7) ; ÷
(#x0370 . #x03ff) ; Greek and Coptic
(#x0400 . #x04FF) ; Cyrillic
(#x2000 . #x206F) ; General Punctuation
(#x2100 . #x214F) ; Letterlike Symbols
(#x2190 . #x21FF) ; Arrows
(#x2200 . #x22FF) ; Mathematical Operators
(#x2300 . #x23FF) ; Miscellaneous Technical
(#x2500 . #x257F) ; Box Drawing
(#x25A0 . #x25FF) ; Geometric Shapes
(#x2600 . #x26FF) ; Miscellaneous Symbols
(#x2e80 . #xd7a3)
(#xff00 . #xffef)
))
;; IMEの設定
(mw32-ime-initialize)
(setq default-input-method "MW32-IME")
(setq-default mw32-ime-mode-line-state-indicator "[--]")
(setq mw32-ime-mode-line-state-indicator-list '("[--]" "[あ]" "[--]"))
;; IMEのモードごとにカーソル色を変える
(add-hook 'mw32-ime-on-hook
(function
(lambda () (set-cursor-height 2) (set-cursor-color "green"))
))
(add-hook 'mw32-ime-off-hook
(function
(lambda () (set-cursor-height 4) (set-cursor-color "yellow"))
))
(setq test t)
)
;;SHELL_Bash
(setq explicit-shell-file-name "bash.exe")
(setq shell-file-name "sh.exe")
(setq shell-command-switch "-c")
(modify-coding-system-alist 'process ".*sh\\.exe" 'utf-8-unix)
;; argument-editing の設定
(require 'mw32script)
(mw32script-init)
(setq exec-suffix-list '(".exe" ".sh" ".pl"))
(setq shell-file-name-chars "~/A-Za-z0-9_^$!#%&{}@`'.:()-")
:;静かにして!/UIも
(setq inhibit-startup-message t)
(require
'mcomplete) (turn-on-mcomplete-mode)
;(iswitchb-default-keybindings)
(setq completion-ignore-case t)
(setq auto-save-list-file-prefix (expand-file-name "~/bak"))
(when (require 'session nil t)
(setq session-initialize '(de-saveplace session keys menus)
session-globals-include '((kill-ring 50)
(session-file-alist 100 t)
(file-name-history 100)))
(add-hook 'after-init-hook 'session-initialize))
(iswitchb-mode 1)
(require 'minibuf-isearch nil t)
;; フォントロックモード (強調表示等) を有効にする
(global-font-lock-mode t)
;; C-o に動的略語展開機能を割り当てる
(define-key global-map "\C-o" 'dabbrev-expand)
(setq dabbrev-case-fold-search nil) ; 大文字小文字を区別
;;タブ幅を 2 に設定
(setq-default tab-width 2)
;;タブではなくスペースを使う
(setq-default indent-tabs-mode nil)
(setq indent-line-function 'indent-relative-maybe)
(setq transient-mark-mode t)
;;キルリン
(require 'browse-kill-ring)
(global-set-key "\M-y" 'browse-kill-ring)
;; kill-ring を一行で表示
(setq browse-kill-ring-display-style 'one-line)
;; browse-kill-ring 終了時にバッファを kill する
(setq browse-kill-ring-quit-action 'kill-and-delete-window)
;; 必要に応じて browse-kill-ring のウィンドウの大きさを変更する
(setq browse-kill-ring-resize-window t)
;; kill-ring の内容を表示する際の区切りを指定する
(setq browse-kill-ring-separator "-------")
;; 現在選択中の kill-ring のハイライトする
(setq browse-kill-ring-highlight-current-entry t)
;; 区切り文字のフェイスを指定する
(setq browse-kill-ring-separator-face 'region)
;; 一覧で表示する文字数を指定する. nil ならすべて表示される.
(setq browse-kill-ring-maximum-display-length 100)
;;印田!
(global-set-key "\C-m" 'newline-and-indent)
(global-set-key "\C-j" 'newline)
(setq indent-tabs-mode t)
;;行番とかスクロとか!
(line-number-mode t) ; 行番号をモードラインに表示する(TRUE)
(column-number-mode t) ; 列番号をモードラインに表示する(TRUE)
(autoload 'setnu-mode "setnu" nil t)
(global-set-key [f12] 'setnu-mode)
;;色
(load "color-theme")
(color-theme-gnome)
;;動くのかTab
(require 'elscreen "ELSCREEN" t)
;;動くのかAnything
;; anything
(require 'anything-config)
(setq anything-sources
(list anything-c-source-buffers
;anything-c-source-bookmarks
anything-c-source-file-name-history
anything-c-source-man-pages
anything-c-source-info-pages
anything-c-source-calculation-result
anything-c-source-locate))
(define-key anything-map (kbd "C-p") 'anything-previous-line)
(define-key anything-map (kbd "C-n") 'anything-next-line)
(define-key anything-map (kbd "C-v") 'anything-next-source)
(define-key anything-map (kbd "M-v") 'anything-previous-source)
(global-set-key (kbd "C-]") 'anything)
;;Perl関係
(autoload 'cperl-mode "cperl-mode" "alternate mode for editing Perl programs" t)
(setq auto-mode-alist (append (list (cons "\\.\\(pl\\|pm\\)$" 'cperl-mode)) auto-mode-alist))
(setq interpreter-mode-alist (append interpreter-mode-alist '(("miniperl" . cperl-mode))))
(add-hook 'cperl-mode-hook
(lambda ()
(set-face-bold-p 'cperl-array-face nil)
(set-face-background 'cperl-array-face "black")
(set-face-bold-p 'cperl-hash-face nil)
(set-face-italic-p 'cperl-hash-face nil)
(set-face-background 'cperl-hash-face "black")
(require 'perlplus)
(local-set-key "\M-o" 'perlplus-complete-symbol)
(perlplus-setup)
(set-file-coding-system 'utf-8-unix)
))
;;Ruby_Rail関係
;; ruby-mode
(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 '(("ruby" . ruby-mode))
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 ()
(setq tab-width 2)
(setq indent-tabs-mode 't)
(setq ruby-indent-level tab-width)
(require 'anything)
(inf-ruby-keys)))
(setq ruby-deep-indent-paren-style nil)
;; ruby-electric
(require 'ruby-electric)
(add-hook 'ruby-mode-hook '(lambda () (ruby-electric-mode t)))
;; rubydb
(autoload 'rubydb "rubydb3x"
"run rubydb on program file in buffer *gud-file*.
the directory containing file becomes the initial working directory
and source-file directory for your debugger." t)
(when run-xemacs
;;Xemacs用の設定でいいのか???
;; rails
(defun try-complete-abbrev (old)
(if (expand-abbrev) t nil))
(setq hippie-expand-try-functions-list
'(try-complete-abbrev
try-complete-file-name
try-expand-dabbrev))
(setq rails-use-mongrel t)
(require 'cl)
(require 'rails)
(setq test t)
)
;; ruby-block
(require 'ruby-block)
(ruby-block-mode t)
;; ミニバッファに表示し, かつ, オーバレイする.
(setq ruby-block-highlight-toggle t)
;; ECB
(setq load-path (cons (expand-file-name "~/elisp/ecb-2.32") load-path))
(load-file "~/elisp/cedet-1.0pre3/common/cedet.el")
(setq semantic-load-turn-useful-things-on t)
(require 'ecb)
(setq ecb-tip-of-the-day nil)
(setq ecb-windows-width 0.25)
(defun ecb-toggle ()
(interactive)
(if ecb-minor-mode
(ecb-deactivate)
(ecb-activate)))
(global-set-key [f2] 'ecb-toggle)
;;ネットから持ってきた行末強調
(defun recenter-and-fontify-buffer ()
"comment..."
(interactive)
(recenter)
(font-lock-fontify-buffer))
(define-key esc-map "\C-l" 'recenter-and-fontify-buffer)
;; カーソル位置のfaceを調べる関数
(defun describe-face-at-point()
"Return facce used at point."
(interactive)
(message "%s" (get-char-property (point) 'face)))
;; develock
;; http://www.jpl.org/elips/
(require 'develock nil t)
(if (featurep 'develock)
(progn
(setq develock-max-column-plist
(list 'java-mode 90
'jde-mode 90
'emacs-lisp-mode 90
'lisp-interaction-mode 90
'html-mode nil
'html-helper-mode nil
'cperl-mode 90
'perl-mode 90))
(let ((elem (copy-sequence (assq 'message-mode develock-keywords-alist))))
(setcar elem 'html-helper-mode)
(setq develock-keywords-alist
(cons elem (delq (assq 'html-helper-mode develock-keywords-alist)
develock-keywords-alist))))
))
;; izonmoji-mode from navi2ch
(require 'izonmoji-mode nil t)
(if (featurep 'izonmoji-mode)
(progn
(defface my-izonmoji-win-face
'((((class color) (type tty)) (:foreground "cyan"))
(((class color) (background light)) (:foreground "cyan4" :strike-through "cyan4"))
(((class color) (background dark)) (:foreground "Aquamarine3"))
(t (:underline t)))
"Windowsの機種依存文字のフェイス。")
(defface my-izonmoji-mac-face
'((((class color) (type tty)) (:foreground "magenta"))
(((class color) (background light)) (:box (:line-width 1 :color "SteelBlue3") :strike-through "SteelBlue3"))
(((class color) (background dark)) (:foreground "pink3"))
(t (:underline t)))
"Macの機種依存文字のフェイス。")
(setq izonmoji-win-face 'my-izonmoji-win-face)
(setq izonmoji-mac-face 'my-izonmoji-mac-face)
))
;;; タブ、全角スペース、行末のスペースに色を付ける
;;; http://www.bookshelf.jp/soft/meadow_26.html#SEC313
;;; http://homepage1.nifty.com/blankspace/emacs/color.html
;;(defface my-face-r-1 '((t (:background "gray15"))) nil)
(defface my-face-b-1 '((t (:background "gray26"))) nil)
(defface my-face-b-2 '((t (:background "gray70"))) 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 ())
(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)
(defun toggle-colorful-space()
"toggle while space font-lock"
(interactive)
(if my-face-b-1
(progn
(setq my-face-b-1 nil)
(setq my-face-b-2 nil)
(setq my-face-u-1 nil)
(if (featurep 'develock)
(develock-mode 0)))
(progn
(setq my-face-b-1 'my-face-b-1)
(setq my-face-b-2 'my-face-b-2)
(setq my-face-u-1 'my-face-u-1))))
;;半透明少女関係化winでは動かないよ!
(setq default-frame-alist
(append (list '(active-alpha . 0.90)
'(inactive-alpha . 0.80)
) default-frame-alist))
;;MISC
(show-paren-mode 1) ;; 対応する括弧を光らせる(グラフィック環境のみ作用)
(fset 'yes-or-no-p 'y-or-n-p) ;;"yes or no"を"y or n"にする
;;------------------------------------------------------
;; マウス設定
;;------------------------------------------------------
(if window-system (progn
;; 右ボタンの割り当て(押しながらの操作)をはずす。
(global-unset-key [down-mouse-3])
;; マウスの右クリックメニューを出す(押して、離したときにだけメニューが出る)
(defun bingalls-edit-menu (event)
(interactive "e")
(popup-menu menu-bar-edit-menu))
(global-set-key [mouse-3] 'bingalls-edit-menu)
))
;;凝固ぴ
(defun duplicate-line-backward ()
"Duplicate the current line backward."
(interactive "*")
(save-excursion
(let ((contents
(buffer-substring
(line-beginning-position)
(line-end-position))))
(beginning-of-line)
(insert contents ?\n)))
(previous-line 1))
(defun duplicate-region-backward ()
"If mark is active duplicates the region backward."
(interactive "*")
(if mark-active
(let* (
(deactivate-mark nil)
(start (region-beginning))
(end (region-end))
(contents (buffer-substring
start
end)))
(save-excursion
(goto-char start)
(insert contents))
(goto-char end)
(push-mark (+ end (- end start))))
(error
"Mark is not active. Region not duplicated.")))
(defun duplicate-line-forward ()
"Duplicate the current line forward."
(interactive "*")
(save-excursion
(let ((contents (buffer-substring
(line-beginning-position)
(line-end-position))))
(end-of-line)
(insert ?\n contents)))
(next-line 1))
(defun duplicate-region-forward ()
"If mark is active duplicates the region forward."
(interactive "*")
(if mark-active
(let* (
(deactivate-mark nil)
(start (region-beginning))
(end (region-end))
(contents (buffer-substring
start
end)))
(save-excursion
(goto-char end)
(insert contents))
(goto-char start)
(push-mark end)
(exchange-point-and-mark))
(error "Mark is not active. Region not duplicated.")))
(global-set-key [M-up] 'duplicate-line-backward)
(global-set-key [M-down] 'duplicate-line-forward)
(global-set-key [M-right] 'duplicate-region-forward)
(global-set-key [M-left] 'duplicate-region-backward)
;;Meadowさん保存分
(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)
'(color-theme-is-global t)
'(color-theme-legal-frame-parameters "\\(color\\|mode\\|font\\|height\\|width\\)$")
'(column-number-mode t)
'(display-battery-mode t)
'(display-time-mode t)
'(save-place t nil (saveplace))
'(show-paren-mode t)
'(size-indication-mode t)
'(standard-indent 2)
'(text-mode-hook (quote (turn-on-auto-fill text-mode-hook-identify)))
'(tool-bar-mode nil)
'(transient-mark-mode t)
'(uniquify-buffer-name-style (quote forward) nil (uniquify)))
(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.
)