;;
;;	general definitions
;;
(put 'eval-expression 'disabled nil)
(setq make-backup-files nil)
(setq user-mail-address "nakano@apm.seikei.ac.jp")
;;(setq vc-make-backup-files nil)
(menu-bar-mode nil)
(if (>= (string-to-int emacs-version) 21)
    (tool-bar-mode nil))
(setq running-xemacs nil)
(setq font-lock-mode nil)
;;(global-font-lock-mode nil)

;;(add-hook `find-file-hooks `turn-off-font-lock)

;;
;;	by default, text-mode WITHOUT auto-fill set
;;
(setq default-major-mode 'text-mode)
;;(setq text-mode-hook 'turn-on-auto-fill)

;;
;;	customize key-bindings
;;
(global-set-key "\C-h" 'delete-backward-char)
(global-set-key "\M-h" 'help-for-help)
;;(global-set-key "\^?" 'delete-backward-char)
(global-set-key [delete] 'delete-char)
(global-set-key [deletechar] 'delete-char)
(global-set-key [home] 'beginning-of-buffer)
(global-set-key [end] 'end-of-buffer)
;;
;;	Keys for PuTTY
;;
(defvar cursor-map-P (make-keymap))
(fset 'Cursor-Map-P cursor-map-P)
(define-key esc-map "[" 'Cursor-Map-P)
(define-key cursor-map-P "1~" 'beginning-of-buffer)
(global-set-key [select] 'end-of-buffer)
;;
;;
;;
(add-hook 'text-mode-hook
	'(lambda () (define-key text-mode-map '"\C-i" 'tab-to-tab-stop)))

;;
;;	auto-mode selection list
;;
(setq auto-mode-alist (mapcar 'purecopy
			      '(("\\.c$"    . c-mode)
				("\\.h$"    . c-mode)
				("\\.a$"    . c-mode)
				("\\.f$"    . fortran-mode)
				("\\.F$"    . fortran-mode)
				("\\.tex$"  . yatex-mode)
				("\\.txi$"  . Texinfo-mode)
				("\\.el$"   . emacs-lisp-mode))))

;;
;;	set for euc coding
;;
(set-language-environment "Japanese")
(set-default-coding-systems 'euc-japan)
(set-keyboard-coding-system 'euc-japan)
(set-terminal-coding-system 'euc-japan) 
(setq add-log-time-format 'current-time-string)

;;
;;	for ja-info display
;;
(auto-compression-mode t)

;;
;;	ja grep
;;
(if (file-exists-p "/usr/bin/jgrep")
    (setq grep-command "jgrep -n -e "))


;;
;;	keymap for teraterm
;;
;;(defvar cursor-map-2 (make-keymap))
;;(fset 'Cursor-Map-2 cursor-map-2)
;;(define-key esc-map "[" 'Cursor-Map-2)
;;(define-key esc-map "O" 'Cursor-Map-2)
;;(define-key cursor-map-2 "A" 'previous-line)
;;(define-key cursor-map-2 "B" 'next-line)
;;(define-key cursor-map-2 "C" 'forward-char)
;;(define-key cursor-map-2 "D" 'backward-char)
;;(define-key cursor-map-2 "1~" 'overwrite-mode)
;;(define-key cursor-map-2 "2~" 'beginning-of-buffer)
;;(define-key cursor-map-2 "3~" 'scroll-up)
;;(define-key cursor-map-2 "4~" 'end-of-buffer)
;;(define-key cursor-map-2 "5~" 'end-of-buffer)
;;(define-key cursor-map-2 "6~" 'scroll-down)
;;(define-key cursor-map-2 "[A" 'help-for-help)
;;(define-key cursor-map-2 "[B" 'byte-compile-file)
;;(define-key cursor-map-2 "[C" 'isearch-forward)
;;(define-key cursor-map-2 "[D" 'query-replace-regexp)
;;(define-key cursor-map-2 "[E" 'eval-defun)
;;(define-key cursor-map-2 "[F" 'eval-current-buffer)
;;(define-key cursor-map-2 "[G" 'buffer-menu)
;;(define-key cursor-map-2 "[H" 'global-set-key)
;;(define-key cursor-map-2 "[I" 'save-buffer)
;;(define-key cursor-map-2 "[J" 'save-buffers-kill-emacs)
 
;;
;;	*** APPLICATIONS ***
;;

;; ispell-mode
;;
(autoload 'ispell "ispell" "Check the spelling of word." t)
(autoload 'ispell-word "ispell" "Check the spelling of word in buffer." t)
(global-set-key "\e$" 'ispell-word)
(autoload 'ispell-region "ispell" "Check the spelling of region." t)
(autoload 'ispell-buffer "ispell" "Check the spelling of buffer." t)
(autoload 'ispell-complete-word "ispell"
  "Look up current word in dictionary and try to complete it." t)
(autoload 'ispell-change-dictionary "ispell" "Change ispell dictionary." t)
;; M-x ispell で日本語混じりのバッファでエラーが起きるのを防ぐ設定  (ELF:01328)
;; 
(eval-after-load "ispell"
  '(setq ispell-skip-region-alist (cons '("[^\000-\377]+")
					ispell-skip-region-alist)))

;; YaTeX
;;
(setq YaTeX-use-font-lock nil)
(setq tex-command "platex")
(setq YaTeX-kanji-code 3)

;; mailcrypt
;;
(if (file-exists-p "/usr/share/emacs/site-lisp/mailcrypt/mailcrypt.el")
    (progn
      (load "mailcrypt")
      (mc-setversion "2.6")
      (autoload 'mc-sign-region "mc-toplev" nil t)))

;; migemo
;;
(if (file-exists-p "/usr/share/emacs/site-lisp/migemo/migemo.el")
    (progn
      (load "migemo")
      (migemo-init)))

;; word-count-mode by Komatsu-san
;;
(setq word-count-non-line-regexp "^[\t ]*\n\\|^[\t ]+$\\|^%")

