;;; hangul.el --- 한글 관련 함수와 한글 코드 변환기

;; Copyright (C) 1995, 1996 하니맥 개발팀.

;;;========================================================
;; 한글 관련 함수

;;; set input mode
(cond 
 ((and 
     (boundp 'emacs-major-version)
     (= emacs-major-version 19)
     (= emacs-minor-version 30))
;  (require 'iso-insert)
;  (require 'iso-syntax)
;  (standard-display-8bit 160 255)
  (standard-display-european t)
  (set-input-mode (car (current-input-mode)) (nth 1 (current-input-mode)) 0)
))

(defun han-change-coding-system ()
  (interactive)
  (if (= han-johab-mode 0)
      (setq han-johab-mode 1)
    (setq han-johab-mode 0))
  (recenter)
)

(defun han-change-kbd-kind ()
  (interactive)
  (if (= han-kbd-kind 2)
      (setq han-kbd-kind 3)
    (setq han-kbd-kind 2))
  (recenter)
)

(defun han-search-exact-jongsung ()
  (interactive)
  (if (= han-search-exact 0)
      (setq han-search-exact 1)
    (setq han-search-exact 0))
)

;;;========================================================
;; 한글 코드 변환기

(defun han-convert-code (command)
  (interactive "sCommand like \"hcode -kt, iso2ks, ks2sdn...\": ")
  (shell-command-on-region (point-min) (point-max) command t)
)

(defun han-convert-code-on-region (command)
  (interactive "sCommand like \"hcode -kt, iso2ks, ks2sdn...\": ")
  (shell-command-on-region (region-beginning) (region-end) command t)
)

;(defun han-convert-ksc5601-to-trigem ()
;  (interactive)
;  (han-convert-code "hcode -kt ")
;)

;(defun han-convert-trigem-to-ksc5601 ()
;  (interactive)
;  (han-convert-code "hcode -tk ")
;)

;(defun han-convert-iso2022kr-to-ksc5601 ()
;  (interactive)
;  (han-convert-code "hcode -ik ")
;)

;(defun han-convert-sdn-to-ksc5601 ()
;  (interactive)
;  (han-convert-code "hcode -dk ")
;)

;(global-set-key "\C-ctk" 'han-convert-ksc5601-to-trigem)
;(global-set-key "\C-ckt" 'han-convert-trigem-to-ksc5601)
;(global-set-key "\C-cki" 'han-convert-iso2022kr-to-ksc5601)
;(global-set-key "\C-cks" 'han-convert-sdn-to-ksc5601)
