;; .emacs
;=====================================
; Interface
;=====================================
;; default to better frame titles
(setq frame-title-format
(concat "%b - emacs@" (system-name)))
;; vanish tool bar
;(tool-bar-mode 0)
;; display clock
(display-time)
;; display line number
(setq line-number-mode t)
;; dispose scroll bar to right
(set-scroll-bar-mode 'right)
;; vanish startup message
(setq inhibit-startup-message t)
;(setq initial-scratch-message nil)
;; errar bell
(setq ring-bell-function (lambda ()))
;(setq visible-bell t)
;; color parenthesis
(show-paren-mode t)
(setq show-paren-style 'parenthesis)
;; font setting
;(create-fontset-from-fontset-spec
; "-shinonome-gothic-medium-r-normal--14-*-*-*-*-*-fontset-14")
;(set-default-font "fontset-14")
(create-fontset-from-fontset-spec
"-misc-ipagothic-medium-r-normal--14-*-*-*-*-*-fontset-ipa")
(set-default-font "fontset-ipa")
;; font color
(global-font-lock-mode t)
(setq font-lock-support-mode 'jit-lock-mode)
(setq font-lock-maximum-decoration t)
(add-hook 'font-lock-mode-hook
'(lambda ()(set-face-foreground
'font-lock-comment-face "gray")))
;; frame setting
(setq initial-frame-alist
(append (list
'(foreground-color . "white") ;; font
'(background-color . "black") ;; back ground
'(border-color . "black")
'(mouse-color . "white")
'(cursor-color . "white")
'(width . 75) ;; frame width
'(height . 62) ;; frame hight
'(top . 0) ;; Y position
'(left . 5) ;; X position
)
initial-frame-alist))
(setq default-frame-alist initial-frame-alist)
;===================================
; Language
;===================================
;; using ja-JP.UTF-8
;;; uncomment for CJK utf-8 support for non-Asian users
;(require 'un-define)
(set-language-environment "Japanese")
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-buffer-file-coding-system 'utf-8)
(setq default-buffer-file-coding-system 'utf-8)
(prefer-coding-system 'utf-8)
(set-default-coding-systems 'utf-8)
(setq file-name-coding-system 'utf-8)
;; using anthy
(load-library "anthy")
(setq default-input-method "japanese-anthy")
(toggle-input-method nil)
(global-set-key [zenkaku-hankaku] 'toggle-input-method)
;; display collectly Japanese info
(auto-compression-mode t)
;=====================================
;Manipulation Setting
;====================================
;; mouse wheel
(global-set-key [mouse-4] 'scroll-down)
(global-set-key [mouse-5] 'scroll-up)
(progn
(defun scroll-up-half ()
"Scroll up half a page."
(interactive)
(scroll-up (/ (window-height) 2))
)
(defun scroll-down-half ()
"Scroll down half a page."
(interactive)
(scroll-down (/ (window-height) 2))
)
(global-set-key [(mouse-5)] 'scroll-up-half)
(global-set-key [(mouse-4)] 'scroll-down-half)
)
;; edit gz file
(auto-compression-mode t)
;=====================================
;Key Setting
;=====================================
;; change to coment or uncoment
(global-set-key "\C-c;" 'comment-region)
(global-set-key "\C-c:" 'uncomment-region)
;; kill line
(setq kill-whole-line t)
;; undo
(global-set-key "\C-z" 'undo)
;; back space
(global-set-key "\C-h" 'delete-backward-char)
;=======================================
;Progrum Mode
;======================================
;; yatex-mode
(setq auto-mode-alist
(cons (cons "\\.tex$" 'yatex-mode) auto-mode-alist))
(autoload 'yatex-mode "yatex" "Yet Another LaTeX mode" t)
(setq YaTeX-use-AMS-LaTeX t)
(setq YaTeX-use-LaTeX2e t)
;; Ruby Mode
(add-to-list 'load-path "~/.site-lisp/ruby-mode")
(require 'ruby-mode)
(require 'ruby-electric)
(defun ruby-eval-buffer () (interactive)
"Evaluate the buffer with ruby."
(shell-command-on-region (point-min) (point-max) "ruby"))
(defun my-ruby-mode-hook ()
(font-lock-mode t)
(setq standard-indent 2)
(pabbrev-mode t)
(ruby-electric-mode t)
(define-key ruby-mode-map "\C-c\C-a" 'ruby-eval-buffer))
(add-hook 'ruby-mode-hook 'my-ruby-mode-hook)
(setq auto-mode-alist (cons '("\\.rb\\'" . rhtml-mode) auto-mode-alist))
;; C Mode
(add-hook 'c-mode-hook
'(lambda ()
(auto-fill-mode 1)
(local-set-key "\M-c\M-c" 'compile)
(local-set-key "\M-c\M-d" 'gdb)
))
;; C++ Mode
(add-hook 'c++-mode-hook
'(lambda ()
(auto-fill-mode 1)
(local-set-key "\M-c\M-c" 'compile)
(local-set-key "\M-c\M-d" 'gdb)
))
;; Haskell Mode
(setq auto-mode-alist
(cons '("\\.hs$" . haskell-mode) auto-mode-alist))