;; .emacs

;;; uncomment this line to disable loading of "default.el" at startup
;; (setq inhibit-default-init t)

;; turn on font-lock mode
(global-font-lock-mode t)

;; enable visual feedback on selections
(setq transient-mark-mode t)
;;; 言語環境の指定
(set-language-environment "Japanese")

(global-set-key [delete] 'delete-char)
(global-set-key [kp-delete] 'delete-char)
(global-set-key "\C-h" 'delete-backward-char)

(create-fontset-from-fontset-spec
 (concat
  "-*-fixed-medium-r-normal-*-14-*-*-*-*-*-fontset-marumoji14,"
  "japanese-jisx0208:-misc-marumoji-medium-r-normal--14-*-*-*-*-*-jisx0208.1983-0,"
  "katakana-jisx0201:-misc-marumoji-medium-r-normal--14-*-*-*-*-*-jisx0201.1976-0,"
  "ascii:-misc-marumoji-medium-r-normal--14-*-*-*-*-*-iso8859-1"
  ;"ascii:-*-marumoji-medium-r-normal-*-14-*-*-*-*-*-jisx0201.1976-0"
  ))
(set-default-font "fontset-marumoji14")
(create-fontset-from-fontset-spec
 (concat
  "-*-fixed-medium-r-normal-*-16-*-*-*-*-*-fontset-paw16,"
  "japanese-jisx0208:-paw-fixed-medium-r-normal--16-*-*-*-*-*-jisx0208.1983-0,"
  "katakana-jisx0201:-paw-fixed-medium-r-normal--16-*-*-*-*-*-jisx0201.1976-0,"
  ;"ascii:-*-marumoji-medium-r-normal-*-14-*-*-*-*-*-iso8859-1"
  "ascii:-paw-fixed-medium-r-normal-*-16-*-*-*-*-*-jisx0201.1976-0"
  ))
;(set-default-font "fontset-paw16")


;(setq default-frame-alist
					;      (append
					;       '(
					;	 (width . 80) (height . 45) (font . "m14"))
;       default-frame-alist))

;; Always end a file with a newline
(setq require-final-newline t)

;; Stop at the end of the file, not just add lines
(setq next-line-add-newlines nil)

(mouse-wheel-mode t)

(recentf-mode)

(show-paren-mode)
;;(setq show-paren-style 'parenthesis) ;; 対応括弧のみをハイライト (デフォルト)
 (setq show-paren-style 'mixed)       ;; 対応括弧が画面外の場合、その間をハイライト
;; (setq show-paren-style 'expression)  ;; 対応括弧が画面内でもその間をハイライト

;; C-, C-. でバッファを次々に表示
;; -> http://www-tsujii.is.s.u-tokyo.ac.jp/~yoshinag/tips/elisp_tips.html
(defvar my-ignore-buffer-list
      '("*Help*" "*Compile-Log*" "*Mew completions*" "*Completions*"
        "*Shell Command Output*" "*Apropos*" "*Buffer List*"))

(defun my-visible-buffer (blst)
  (let ((bufn (buffer-name (car blst))))
    (if (or (= (aref bufn 0) ? ) (member bufn my-ignore-buffer-list))
        (my-visible-buffer (cdr blst)) (car blst))))

(defun my-grub-buffer ()
  (interactive)
  (switch-to-buffer (my-visible-buffer (reverse (buffer-list)))))

(defun my-bury-buffer ()
  (interactive)
  (let ((nbuf (my-visible-buffer (cdr (buffer-list)))))
    (bury-buffer)
    (switch-to-buffer nbuf)))

(global-set-key [?\C-,] 'my-grub-buffer)
(global-set-key [?\C-.] 'my-bury-buffer)

;;
(setq frame-title-format "%b - Emacs")

;; http://www.haun.org/kent/elisp/
(autoload 'face2html "face2html" nil t)


;; http://ha1.seikyou.ne.jp/home/akairingosaita/meadow/hangul.htm
(require 'ps-mule)
(defalias 'ps-mule-header-string-charsets 'ignore)
(setq ps-multibyte-buffer 'non-latinl-printer)

(setq ps-mule-font-info-database-default
      '((latin-iso8859-1
	 (normal nil nil iso-latin-1))
	(katakana-jisx0201
	 (normal builtin "Ryumin-Light.Katakana" ps-mule-encode-7bit 1)
	 (bold builtin "GothicBBB-Medium.Katakana" ps-mule-encode-7bit 1)
	 (bold-italic builtin "GothicBBB-Medium.Katakana" ps-mule-encode-7bit 1))
	(latin-jisx0201
	 (normal builtin "Ryumin-Light.Hankaku" ps-mule-encode-7bit 1)
	 (bold builtin "GothicBBB-Medium.Hankaku" ps-mule-encode-7bit 1))
	(japanese-jisx0208
	 (normal builtin "Ryumin-Light-H" ps-mule-encode-7bit 2)
	 (bold builtin "GothicBBB-Medium-H" ps-mule-encode-7bit 2))
	(latin-iso8859-2
	 (normal bdf ("lt2-24-etl.bdf" "etl24-latin2.bdf") iso-latin-2 1))
	(latin-iso8859-3
	 (normal bdf ("lt3-24-etl.bdf" "etl24-latin3.bdf") iso-latin-3 1))
	(latin-iso8859-4
	 (normal bdf ("lt4-24-etl.bdf" "etl24-latin4.bdf") iso-latin-4 1))
	(thai-tis620
	 (normal bdf ("thai24.bdf" "thai-24.bdf") thai-tis620 1))
	))
;; ;; 日本語だけを印刷する場合
;;(setq ps-multibyte-buffer 'non-latin-printer)

;; 日本語以外も印刷する場合
;;(setq ps-multibyte-buffer 'bdf-font-except-latin)

;;(setq bdf-directory-list
;;      '("/usr/share/fonts/ja/misc/"
;;	"/home/zakki/x-devel/freedesktop/xc/fonts/bdf/misc/"))

;;; font-lockの設定
(if window-system
    (progn
      (setq font-lock-support-mode 'lazy-lock-mode)
      (global-font-lock-mode t)))

(add-to-list 'load-path "~/.emacs.d/site-lisp/")
(setq navi2ch-icon-directory "~/.emacs.d/icon/")
(autoload 'navi2ch "navi2ch" "navi2ch" t)
(setq navi2ch-mona-enable t)

;;skk
(require 'skk-setup)

;;; Wanderust
;(require 'mime-setup)
;(add-to-list 'load-path "~/emacs/wanderlust/elmo")
;(add-to-list 'load-path "g:/programs/Meadow/site-lisp/apel")
;(add-to-list 'load-path "g:/programs/Meadow/site-lisp/flim")
;(add-to-list 'load-path "g:/programs/Meadow/site-lisp/semi")

(autoload 'wl "wl" "Wanderlust" t)
(autoload 'wl-draft "wl-draft" "Write drawft with Wanderlust." t)

(autoload 'wl-user-agent-compose "wl-draft" nil t)
(if (boundp 'mail-user-agent)
    (setq mail-user-agent 'wl-user-agent))
(if (fboundp 'define-mail-user-agent)
    (define-mail-user-agent
      'wl-user-agent
      'wl-user-agent-compose
      'wl-draft-send
      'wl-draft-kill
      'mail-send-hook))

;;Devlock - show tab and space
(load "develock")

;;Global- gtags.el
(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)
	     ))

(put 'upcase-region 'disabled nil)

(put 'narrow-to-region 'disabled nil)