;;; hangul.el --- Korean Hangul input method
-;; Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2012 Free Software Foundation, Inc.
;; Author: Jihyun Cho <jihyun.jo@gmail.com>
;; Keywords: multilingual, input method, Korean, Hangul
;;; Code:
(require 'quail)
-(require 'cl)
(require 'hanja-util)
;; Hangul double Jamo table.
(defun hangul-character (cho jung jong)
"Convert CHO, JUNG, JONG to the precomposed `Hangul Syllables' character.
-CHO, JUNG, JONG are relative indices in `Hangul Compatibility Jamo' of unicode.
+CHO, JUNG, JONG are relative indices in `Hangul Compatibility Jamo' of Unicode.
Return a zero-length string if the conversion fails."
(or
(decode-char
(delete-backward-char 1)))
(defun hangul-to-hanja-conversion ()
- "Convert the previous hangul character to the corresponding hanja character."
+ "Convert the previous hangul character to the corresponding hanja character.
+When a Korean input method is off, convert the following hangul character."
(interactive)
(let ((echo-keystrokes 0)
delete-func
hanja-character)
- (setq hanja-character (hangul-to-hanja-char (preceding-char)))
+ (if (and (overlayp quail-overlay) (overlay-start quail-overlay))
+ (progn
+ (setq hanja-character (hangul-to-hanja-char (preceding-char)))
+ (setq delete-func (lambda () (delete-backward-char 1))))
+ (setq hanja-character (hangul-to-hanja-char (following-char)))
+ (setq delete-func (lambda () (delete-char 1))))
(when hanja-character
- (delete-backward-char 1)
+ (funcall delete-func)
(insert hanja-character)
(setq hangul-queue (make-vector 6 0))
- (move-overlay quail-overlay (point) (point)))))
+ (if (and (overlayp quail-overlay) (overlay-start quail-overlay))
+ (move-overlay quail-overlay (point) (point))))))
;; Support function for `hangul2-input-method'. Actually, this
;; function handles the Hangul 2-Bulsik. KEY is an entered key code
"Activate Hangul input method INPUT-METHOD.
FUNC is a function to handle input key.
HELP-TEXT is a text set in `hangul-input-method-help-text'."
- (setq inactivate-current-input-method-function 'hangul-input-method-inactivate
+ (setq deactivate-current-input-method-function 'hangul-input-method-deactivate
describe-current-input-method-function 'hangul-input-method-help
hangul-input-method-help-text help-text)
(quail-delete-overlays)
(add-hook 'minibuffer-exit-hook 'quail-exit-from-minibuffer))
(set (make-local-variable 'input-method-function) func))
-(defun hangul-input-method-inactivate ()
- "Inactivate the current Hangul input method."
+(defun hangul-input-method-deactivate ()
+ "Deactivate the current Hangul input method."
(interactive)
(unwind-protect
(progn
(setq describe-current-input-method-function nil))
(kill-local-variable 'input-method-function)))
+(define-obsolete-function-alias
+ 'hangul-input-method-inactivate
+ 'hangul-input-method-deactivate "24.3")
+
(defun hangul-input-method-help ()
"Describe the current Hangul input method."
(interactive)
(provide 'hangul)
-;; arch-tag: 26bc93fc-64ee-4fb1-b26d-22220d132dbe
;;; hangul.el ends here