unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] Improving hangul input module
@ 2008-05-31  8:51 Jihyun Cho
  2008-06-01 11:24 ` Kenichi Handa
  0 siblings, 1 reply; 11+ messages in thread
From: Jihyun Cho @ 2008-05-31  8:51 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 220 bytes --]

Features
 - Support unicode hangul input
 - Improve input method for korean hanja, symbol
 - Implement hangul automata
 - Support some hangul keyboard layouts(Hangul 2-Bulsik, Hangul
3-Bulsik final, Hangul 3-Bulsik 390)

[-- Attachment #2: emacs-korean-hangul-patch.diff.bz2 --]
[-- Type: application/x-bzip2, Size: 172315 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] Improving hangul input module
  2008-05-31  8:51 [PATCH] Improving hangul input module Jihyun Cho
@ 2008-06-01 11:24 ` Kenichi Handa
  2008-06-03  5:07   ` Kenichi Handa
  0 siblings, 1 reply; 11+ messages in thread
From: Kenichi Handa @ 2008-06-01 11:24 UTC (permalink / raw)
  To: Jihyun Cho; +Cc: emacs-devel

In article <9d644d9b0805310151l54e50721g821232e37aff8e2@mail.gmail.com>, "Jihyun Cho" <jihyun.jo@gmail.com> writes:

> Features
>  - Support unicode hangul input
>  - Improve input method for korean hanja, symbol
>  - Implement hangul automata
>  - Support some hangul keyboard layouts(Hangul 2-Bulsik, Hangul
> 3-Bulsik final, Hangul 3-Bulsik 390)

Thank you.  I'm now checking the code.  I'll commit the
change next week.

---
Kenichi Handa
handa@ni.aist.go.jp




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] Improving hangul input module
  2008-06-01 11:24 ` Kenichi Handa
@ 2008-06-03  5:07   ` Kenichi Handa
  2008-06-03  7:18     ` Jihyun Cho
  2008-06-04 16:14     ` Jihyun Cho
  0 siblings, 2 replies; 11+ messages in thread
From: Kenichi Handa @ 2008-06-03  5:07 UTC (permalink / raw)
  To: jihyun.jo; +Cc: emacs-devel

In article <E1K2lfm-0000Or-LJ@etlken.m17n.org>, Kenichi Handa <handa@m17n.org> writes:

> In article <9d644d9b0805310151l54e50721g821232e37aff8e2@mail.gmail.com>, "Jihyun Cho" <jihyun.jo@gmail.com> writes:
> > Features
> >  - Support unicode hangul input
> >  - Improve input method for korean hanja, symbol
> >  - Implement hangul automata
> >  - Support some hangul keyboard layouts(Hangul 2-Bulsik, Hangul
> > 3-Bulsik final, Hangul 3-Bulsik 390)

> Thank you.  I'm now checking the code.  I'll commit the
> change next week.

I've just committed your code.  I put hanja-util.el under
lisp/language, and moved the calls of register-input-method
in hangul.el to leim-ext.el.

I also added these comments in hangul.el and hanja-util.el.

;; NEED COMMENT. ...
;; NEED ADJUTMENT. ...

Jihyun, please check them and add/adjust comments/docstring
appropriately.

---
Kenichi Handa
handa@ni.aist.go.jp




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] Improving hangul input module
  2008-06-03  5:07   ` Kenichi Handa
@ 2008-06-03  7:18     ` Jihyun Cho
  2008-06-04 16:14     ` Jihyun Cho
  1 sibling, 0 replies; 11+ messages in thread
From: Jihyun Cho @ 2008-06-03  7:18 UTC (permalink / raw)
  To: Kenichi Handa; +Cc: emacs-devel

2008/6/3 Kenichi Handa <handa@m17n.org>:
> In article <E1K2lfm-0000Or-LJ@etlken.m17n.org>, Kenichi Handa <handa@m17n.org> writes:
>
>> In article <9d644d9b0805310151l54e50721g821232e37aff8e2@mail.gmail.com>, "Jihyun Cho" <jihyun.jo@gmail.com> writes:
>> > Features
>> >  - Support unicode hangul input
>> >  - Improve input method for korean hanja, symbol
>> >  - Implement hangul automata
>> >  - Support some hangul keyboard layouts(Hangul 2-Bulsik, Hangul
>> > 3-Bulsik final, Hangul 3-Bulsik 390)
>
>> Thank you.  I'm now checking the code.  I'll commit the
>> change next week.
>
> I've just committed your code.  I put hanja-util.el under
> lisp/language, and moved the calls of register-input-method
> in hangul.el to leim-ext.el.
>
> I also added these comments in hangul.el and hanja-util.el.
>
> ;; NEED COMMENT. ...
> ;; NEED ADJUTMENT. ...
>
> Jihyun, please check them and add/adjust comments/docstring
> appropriately.
>
> ---
> Kenichi Handa
> handa@ni.aist.go.jp
>

Thank you. I will adjust it.




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] Improving hangul input module
  2008-06-03  5:07   ` Kenichi Handa
  2008-06-03  7:18     ` Jihyun Cho
@ 2008-06-04 16:14     ` Jihyun Cho
  2008-06-05  7:24       ` Kenichi Handa
  1 sibling, 1 reply; 11+ messages in thread
From: Jihyun Cho @ 2008-06-04 16:14 UTC (permalink / raw)
  To: Kenichi Handa; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1092 bytes --]

2008/6/3 Kenichi Handa <handa@m17n.org>:
> In article <E1K2lfm-0000Or-LJ@etlken.m17n.org>, Kenichi Handa <handa@m17n.org> writes:
>
>> In article <9d644d9b0805310151l54e50721g821232e37aff8e2@mail.gmail.com>, "Jihyun Cho" <jihyun.jo@gmail.com> writes:
>> > Features
>> >  - Support unicode hangul input
>> >  - Improve input method for korean hanja, symbol
>> >  - Implement hangul automata
>> >  - Support some hangul keyboard layouts(Hangul 2-Bulsik, Hangul
>> > 3-Bulsik final, Hangul 3-Bulsik 390)
>
>> Thank you.  I'm now checking the code.  I'll commit the
>> change next week.
>
> I've just committed your code.  I put hanja-util.el under
> lisp/language, and moved the calls of register-input-method
> in hangul.el to leim-ext.el.
>
> I also added these comments in hangul.el and hanja-util.el.
>
> ;; NEED COMMENT. ...
> ;; NEED ADJUTMENT. ...
>
> Jihyun, please check them and add/adjust comments/docstring
> appropriately.
>
> ---
> Kenichi Handa
> handa@ni.aist.go.jp
>

I have adjusted comments and docstring.
My English is not good.
If you can not be understood, let me know it.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: emacs-hangul-docstring.diff --]
[-- Type: text/x-patch; name=emacs-hangul-docstring.diff, Size: 21399 bytes --]

? emacs-hangul-docstring.diff
Index: emacs/leim/quail/hangul.el
===================================================================
RCS file: /sources/emacs/emacs/leim/quail/hangul.el,v
retrieving revision 1.21
diff -u -8 -p -r1.21 hangul.el
--- emacs/leim/quail/hangul.el	3 Jun 2008 10:47:28 -0000	1.21
+++ emacs/leim/quail/hangul.el	4 Jun 2008 15:53:59 -0000
@@ -27,84 +27,84 @@
 
 ;;; Code:
 
 (require 'quail)
 (require 'cl)
 (require 'hanja-util)
 
 ;; Hangul double jamo table.
-;; NEED COMMENT.  What is the car and cdr part?
+;; Car part is the index of hangul jamo,
+;; and cdr part is a list of indexes that can be combined with car part.
+;; Each jamos require this table.
 (defconst hangul-djamo-table
-  '((cho . ((1 . [1])
+  '((cho . ((1 . [1])                   ; Choseong
             (7 . [7])
             (18 . [18])
             (21 . [21])
             (24 . [24])))
-    (jung . ((39 . [31 32 51])
+    (jung . ((39 . [31 32 51])          ; Jungseong
              (44 . [35 36 51])
              (49 . [51])))
-    (jong . ((1 . [1 21])
+    (jong . ((1 . [1 21])               ; Jongseong
              (4 . [24 30])
              (9 . [1 17 18 21 28 29 30])
              (18 . [18 21])
              (21 . [21])))))
 
 ;; Hangul 2-Bulsik keymap.
-;; This table has Hangul Jamo index.
-;; NEED COMMENT.  What is "Hangul Jamo index"?
+;; This table is converting from ASCII code to hangul jamo index.
+;; It is a relative index in `Hangul Compatibility Jamo' of unicode.
 (defconst hangul2-keymap
   [17 48 26 23 7 9 30 39 33 35 31 51 49 44 32 36 18 1 4 21 37 29 24 28 43 27])
 
 ;; Hangul 3-Bulsik final keymap.  3-Bulsik use full keyboard layout.
 ;; Therefore, We must assign all ASCII codes except control codes
 ;; to Hangul 3-Bulsik codes.
-;; NEED COMMENT.  What are these numbers?
+;; Other parts are the same as the `hangul2-keymap'.
 (defconst hangul3-keymap
   [2 183 24 15 14 8220 120 39 126 8221 43 44 41 46 74 119 30 22 18 78 83
      68 73 85 79 52 110 44 62 46 33 10 7 63 27 12 5 11 69 48 55 49 50 51
      34 45 56 57 29 16 6 13 54 3 28 20 53 26 40 58 60 61 59 42 23 79 71
      86 72 66 84 96 109 115 93 116 122 113 118 121 21 67 4 70 99 74 9 1
      101 17 37 92 47 8251])
 
 ;; Hangul 3-Bulsik 390 keymap.
-;; NEED COMMENT.  What are these numbers?
+;; It is the same role as the `hangul3-keymap'.
 (defconst hangul390-keymap
   [24 34 35 36 37 38 120 40 41 42 43 44 45 46 73 119 30 22 18 77 82 67 72
       84 78 58 110 50 61 51 63 64 7 33 11 10 27 2 47 39 56 52 53 54 49 48
       57 62 29 68 6 59 55 16 28 20 60 26 91 92 93 94 95 96 23 78 70 85 71
       65 83 90 109 115 87 116 122 113 118 121 21 66 4 69 99 73 9 1 101 17
       123 124 125 126])
 
 (defvar hangul-im-keymap
   (let ((map (make-sparse-keymap)))
     (define-key map "\d" 'hangul-delete-backward-char)
     (define-key map [f9] 'hangul-to-hanja-conversion)
     map)
-  "Keymap for Hangul method. It is using all Hangul input method.")
+  "Keymap for Hangul method.  It is used by all Hangul input method.")
 
 ;; Current input character buffer. Store separated hangul character.
 ;; First and second index of vector stored "Choseong".
 ;; Third and forth index of vector stored "Jungseong".
 ;; Fifth and sixth index of vector stored "Jongseong".
 (defvar hangul-queue
   (make-vector 6 0))
 
 (defsubst notzerop (number)
   (not (zerop number)))
 
 (defsubst alphabetp (char)
   (or (and (>= char ?A) (<= char ?Z))
       (and (>= char ?a) (<= char ?z))))
 
 (defun hangul-character (cho jung jong)
-  "Choseong, Jungseong, and Jongseong which are contained Hangul Compatibility Jamo area
-are transformed hangul character in Hangul Syllables area."
-  ;; NEED ADJUSTMENT.  Please read the section "Documentation Basics"
-  ;; of elisp info.
+  "Return the transformed `Hangul Syllables' character from CHO, JUNG, JONG.
+CHO, JUNG, JONG are a relative index in `Hangul Compatibility Jamo' of unicode."
   (or
    (decode-char
     'ucs
     (if (and (/= cho 0) (/= jung 0))
         (+ #xac00
            (* 588
               (- cho
                  (cond ((< cho 3) 1)
@@ -120,17 +120,17 @@ are transformed hangul character in Hang
                     (t 3))))
             (+ #x3130
                (cond ((/= cho 0) cho)
                      ((/= jung 0) jung)
                      ((/= jong 0) jong)))))
    ""))
 
 (defun hangul-insert-character (&rest queues)
-  "Insert each QUEUES. Then setup overlay last inserted character."
+  "Insert each QUEUES.  Then setup overlay last inserted character."
   (if (and mark-active transient-mark-mode)
       (progn
         (delete-region (region-beginning) (region-end))
         (deactivate-mark)))
   (quail-delete-region)
   (let ((first (car queues)))
     (insert
      (hangul-character
@@ -142,39 +142,37 @@ are transformed hangul character in Hang
     (insert
      (hangul-character
       (+ (aref queue 0) (hangul-djamo 'cho (aref queue 0) (aref queue 1)))
       (+ (aref queue 2) (hangul-djamo 'jung (aref queue 2) (aref queue 3)))
       (+ (aref queue 4) (hangul-djamo 'jong (aref queue 4) (aref queue 5)))))
     (move-overlay quail-overlay (1+ (overlay-start quail-overlay)) (point))))
 
 (defun hangul-djamo (jamo char1 char2)
-  "If CHAR1 and CHAR2 are able to combine,
-this function returns double jamo index."
-  ;; NEED ADJUSTMENT.  Please read the section "Documentation Basics"
-  ;; of elisp info.
+  "Return dobule jamo index.
+JAMO is a type of Hangul jamo, and CHAR1 and CAHR2 are Hangul jamo.
+If CHAR1 and CHAR2 can not combined, this function returns nil."
   (let* ((jamo (cdr (assoc jamo hangul-djamo-table)))
          (char1 (cdr (assoc char1 jamo))))
     (if char1
         (let ((i (length char1)))
           (or (catch 'found
                 (while (> i 0)
                   (if (= char2 (aref char1 (1- i)))
                       (throw 'found i))
                   (setf i (1- i))))
               0))
         0)))
 
-;; NEED ADJUSTMENT.  The following 5 have exactly the same docstring.
-;; How are they different?
-
 (defsubst hangul2-input-method-jaum (char)
-  "CHAR is putted in hangul-queue.
+  "CHAR is putted in `hangul-queue'.  Maybe, it is a Hangul 2-Bulsik jaum.
+This function process a Hangul 2-Bulsik jaum.
 Unless the function insert CHAR to current input queue,
-commit current character and then start next character."
+commit current character and then start next character.
+The Hangul 2-Bulsik is composed of `jaum' and `moum'."
   (if (cond ((zerop (aref hangul-queue 0))
              (aset hangul-queue 0 char))
             ((and (zerop (aref hangul-queue 1))
                   (zerop (aref hangul-queue 2))
                   (notzerop (hangul-djamo 'cho (aref hangul-queue 0) char)))
              (aset hangul-queue 1 char))
             ((and (zerop (aref hangul-queue 4))
                   (notzerop (aref hangul-queue 2))
@@ -215,19 +213,19 @@ commit current character and then start 
                         (aref hangul-queue 4)
                         char)))))
              (aset hangul-queue 5 char)))
       (hangul-insert-character hangul-queue)
       (hangul-insert-character hangul-queue
                                (setq hangul-queue (vector char 0 0 0 0 0)))))
 
 (defsubst hangul2-input-method-moum (char)
-  "CHAR is putted in hangul-queue.
-Unless the function insert CHAR to current input queue,
-commit current character and then start next character."
+  "CHAR is putted in `hangul-queue'.  Maybe, it is a Hangul 2-Bulsik moum.
+This function process a Hangul 2-Bulsik moum.
+Other parts are the same as a `hangul2-input-method-jaum'."
   (if (cond ((zerop (aref hangul-queue 2))
              (aset hangul-queue 2 char))
             ((and (zerop (aref hangul-queue 3))
                   (zerop (aref hangul-queue 4))
                   (notzerop (hangul-djamo 'jung (aref hangul-queue 2) char)))
              (aset hangul-queue 3 char)))
       (hangul-insert-character hangul-queue)
       (let ((next-char (vector 0 0 char 0 0 0)))
@@ -236,48 +234,49 @@ commit current character and then start 
                (aset hangul-queue 5 0))
               ((notzerop (aref hangul-queue 4))
                (aset next-char 0 (aref hangul-queue 4))
                (aset hangul-queue 4 0)))
         (hangul-insert-character hangul-queue
                                  (setq hangul-queue next-char)))))
 
 (defsubst hangul3-input-method-cho (char)
-  "CHAR is putted in hangul-queue.
-Unless the function insert CHAR to current input queue,
-commit current character and then start next character."
+  "CHAR is putted in `hangul-queue'.  Maybe, it is a Hangul 3-Bulsik choseong.
+This function process a Hangul 3-Bulsik choseong.
+The Hangul 3-Bulsik is composed of `choseong', `jungseong' and `jongseong'.
+Other parts are the same as a `hangul2-input-method-jaum'."
   (if (cond ((and (zerop (aref hangul-queue 0))
                   (zerop (aref hangul-queue 4)))
              (aset hangul-queue 0 char))
             ((and (zerop (aref hangul-queue 1))
                   (zerop (aref hangul-queue 2))
                   (notzerop (hangul-djamo 'cho (aref hangul-queue 0) char)))
              (aset hangul-queue 1 char)))
       (hangul-insert-character hangul-queue)
       (hangul-insert-character hangul-queue
                                (setq hangul-queue (vector char 0 0 0 0 0)))))
 
 (defsubst hangul3-input-method-jung (char)
-  "CHAR is putted in hangul-queue.
-Unless the function insert CHAR to current input queue,
-commit current character and then start next character."
+  "CHAR is putted in `hangul-queue'.  Maybe, it is a Hangul 3-Bulsik jungseong.
+This function process a Hangul 3-Bulsik jungseong.
+Other parts are the same as a `hangul3-input-method-cho'."
   (if (cond ((and (zerop (aref hangul-queue 2))
                   (zerop (aref hangul-queue 4)))
              (aset hangul-queue 2 char))
             ((and (zerop (aref hangul-queue 3))
                   (notzerop (hangul-djamo 'jung (aref hangul-queue 2) char)))
              (aset hangul-queue 3 char)))
       (hangul-insert-character hangul-queue)
       (hangul-insert-character hangul-queue
                                (setq hangul-queue (vector 0 0 char 0 0 0)))))
 
 (defsubst hangul3-input-method-jong (char)
-  "CHAR is putted in hangul-queue.
-Unless the function insert CHAR to current input queue,
-commit current character and then start next character."
+  "CHAR is putted in `hangul-queue'.  Maybe, it is a Hangul 3-Bulsik jongseong.
+This function process a Hangul 3-Bulsik jongseong.
+Other parts are the same as a `hangul3-input-method-cho'."
   (if (cond ((and (zerop (aref hangul-queue 4))
                   (notzerop (aref hangul-queue 0))
                   (notzerop (aref hangul-queue 2))
                   (numberp
                    (hangul-character
                     (+ (aref hangul-queue 0)
                        (hangul-djamo
                         'cho
@@ -312,52 +311,54 @@ commit current character and then start 
              (aset hangul-queue 6 char)))
       (hangul-insert-character hangul-queue)
       (if (zerop (apply '+ (append hangul-queue nil)))
           (hangul-insert-character (setq hangul-queue (vector 0 0 0 0 char 0)))
           (hangul-insert-character hangul-queue
                                    (setq hangul-queue (vector 0 0 0 0 char 0))))))
 
 (defun hangul-delete-backward-char ()
-  "Backward delete command for hangul. It deletes a hangul character by jaso units."
+  "Backward delete command for hangul.  It deletes a hangul character by jaso units."
   (interactive)
   (let ((i 5))
     (while (and (> i 0) (zerop (aref hangul-queue i)))
       (setq i (1- i)))
     (aset hangul-queue i 0))
   (if (notzerop (apply '+ (append hangul-queue nil)))
       (hangul-insert-character hangul-queue)
       (delete-backward-char 1)))
 
 (defun hangul-to-hanja-conversion ()
-  "This function converts a hangul character to a hanja character."
+  "Convert a hangul character into a hanja character."
   (interactive)
   (let ((echo-keystrokes 0)
         delete-func
         hanja-character)
     (setq hanja-character (hangul-to-hanja-char (preceding-char)))
     (when hanja-character
       (delete-backward-char 1)
       (insert hanja-character)
       (setq hangul-queue (make-vector 6 0))
       (move-overlay quail-overlay (point) (point)))))
 
-;; NEED COMMENT.  What is KEY?
 (defun hangul2-input-method-internal (key)
+  "Used by `hangul2-input-method'.
+Actually, this function is processing the Hangul 2-Bulsik.
+KEY is an entered key code.  It is used as an index of `hangul2-keymap'."
   (let ((char (+ (aref hangul2-keymap (1- (% key 32)))
                  (cond ((or (= key ?O) (= key ?P)) 2)
                        ((or (= key ?E) (= key ?Q) (= key ?R)
                             (= key ?T) (= key ?W)) 1)
                        (t 0)))))
     (if (< char 31)
         (hangul2-input-method-jaum char)
         (hangul2-input-method-moum char))))
 
 (defun hangul2-input-method (key)
-  "2-Bulsik input method"
+  "2-Bulsik input method."
   (if (or buffer-read-only (not (alphabetp key)))
       (list key)
       (quail-setup-overlays nil)
       (let ((input-method-function nil)
             (echo-keystrokes 0)
             (help-char nil))
         (setq hangul-queue (make-vector 6 0))
         (hangul2-input-method-internal key)
@@ -374,32 +375,34 @@ commit current character and then start 
                           (hangul2-input-method-internal key))
                          ((commandp cmd)
                           (call-interactively cmd))
                          (t
                           (setq unread-command-events (listify-key-sequence seq))
                           (throw 'exit-input-loop nil))))))
           (quail-delete-overlays)))))
 
-;; NEED COMMENT.  What is KEY?
 (defun hangul3-input-method-internal (key)
+  "Used by `hangul3-input-method'.
+Actually, this function is processing the Hangul 3-Bulsik final.
+KEY is an entered key code.  It is used as an index of `hangul3-keymap'."
   (let ((char (aref hangul3-keymap (- key 33))))
     (cond ((and (> char 92) (< char 123))
            (hangul3-input-method-cho (- char 92)))
           ((and (> char 65) (< char 87))
            (hangul3-input-method-jung (- char 35)))
           ((< char 31)
            (hangul3-input-method-jong char))
           (t
            (setq hangul-queue (make-vector 6 0))
            (insert (decode-char 'ucs char))
            (move-overlay quail-overlay (point) (point))))))
 
 (defun hangul3-input-method (key)
-  "3-Bulsik final input method"
+  "3-Bulsik final input method."
   (if (or buffer-read-only (< key 33) (>= key 127))
       (list key)
       (quail-setup-overlays nil)
       (let ((input-method-function nil)
             (echo-keystrokes 0)
             (help-char nil))
         (setq hangul-queue (make-vector 6 0))
         (hangul3-input-method-internal key)
@@ -416,33 +419,35 @@ commit current character and then start 
                           (hangul3-input-method-internal key))
                          ((commandp cmd)
                           (call-interactively cmd))
                          (t
                           (setq unread-command-events (listify-key-sequence seq))
                           (throw 'exit-input-loop nil))))))
           (quail-delete-overlays)))))
 
-;; NEED COMMENT.  What is KEY?
 (defun hangul390-input-method-internal (key)
+  "Used by `hangul390-input-method'.
+Actually, this function is processing the Hangul 3-Bulsik 390.
+KEY is an entered key code.  It is used as an index of `hangul390-keymap'."
   (let ((char (aref hangul390-keymap (- key 33))))
     (cond ((or (and (> char 86) (< char 91))
                (and (> char 96) (< char 123)))
            (hangul3-input-method-cho (- char (if (< char 97) 86 92))))
           ((and (> char 64) (< char 86))
            (hangul3-input-method-jung (- char 34)))
           ((< char 31)
            (hangul3-input-method-jong char))
           (t
            (setq hangul-queue (make-vector 6 0))
            (insert (decode-char 'ucs char))
            (move-overlay quail-overlay (point) (point))))))
 
 (defun hangul390-input-method (key)
-  "3-Bulsik 390 input method"
+  "3-Bulsik 390 input method."
   (if (or buffer-read-only (< key 33) (>= key 127))
       (list key)
       (quail-setup-overlays nil)
       (let ((input-method-function nil)
             (echo-keystrokes 0)
             (help-char nil))
         (setq hangul-queue (make-vector 6 0))
         (hangul390-input-method-internal key)
@@ -469,31 +474,31 @@ commit current character and then start 
 (defvar hangul-input-method-help-text nil)
 (make-variable-buffer-local 'hangul-input-method-help-text)
 
 (defun hangul-input-method-activate (input-method func help-text &rest args)
   "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
-	describe-current-input-method-function 'hangul-input-method-help
-	hangul-input-method-help-text help-text)
+    describe-current-input-method-function 'hangul-input-method-help
+    hangul-input-method-help-text help-text)
   (quail-delete-overlays)
   (if (eq (selected-window) (minibuffer-window))
       (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."
   (interactive)
   (unwind-protect
       (progn
-	(quail-hide-guidance)
-	(quail-delete-overlays)
-	(setq describe-current-input-method-function nil))
+    (quail-hide-guidance)
+    (quail-delete-overlays)
+    (setq describe-current-input-method-function nil))
     (kill-local-variable 'input-method-function)))
 
 (defun hangul-input-method-help ()
   "Describe the current Hangul input method."
   (interactive)
   (with-output-to-temp-buffer "*Help*"
     (princ hangul-input-method-help-text)))
 
Index: emacs/lisp/language/hanja-util.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/language/hanja-util.el,v
retrieving revision 1.2
diff -u -8 -p -r1.2 hanja-util.el
--- emacs/lisp/language/hanja-util.el	3 Jun 2008 10:47:29 -0000	1.2
+++ emacs/lisp/language/hanja-util.el	4 Jun 2008 15:54:00 -0000
@@ -19,25 +19,28 @@
 ;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 
 ;; This file defines korean hanja table and symbol table.
 
 ;;; Code:
 
-;; NEED COMMENT.
+;; How many could see the characters at once.
 (defconst hanja-list-width 10)
 
-;; NEED COMMENT.  What is the key and what is the value?
+;; It will be set when called `hanja-init-load'.
+;; The key of hash table is a hangul character,
+;; and the vaules are hanja characters that correspond with a hangul character.
+;; Some values contains not only character code, but also meaning.
 (defvar hanja-table
   nil)
 
 (defun hanja-init-load ()
-  "Initialize hanja table. The table consists of character code and meaning."
+  "Initialize hanja table.  The table consists of character code and meaning."
   (message "Hanja table loading..")
   (when (not hanja-table)
     (setq hanja-table (make-hash-table))
     (puthash 12593
              '((12288) (65281) (65287) (65292) (65294) (65295) (65306) (65307)
                (65311) (65342) (65343) (65344) (65372) (65507) (12289) (12290)
                (183) (8229) (8230) (168) (12291) (173) (8213) (8741) (65340)
                (8764) (180) (65374) (711) (728) (733) (730) (729) (184) (731)
@@ -7569,17 +7572,17 @@
          hanja-table)
     (puthash 55184
          '((35440 . "물을 힐, 힐문할 힐") (40672 . "약을 힐")
            (32953) (38945 . "곧은목 힐") (32392 . "홀치기염색 힐")
            (25847) (32952) (25783) (32556) (35800) (39049) (29365 . "오랑캐이름 힐")
            (35181 . "옷자락 꽂을 힐") (24644) (27439) (32723) (14954))
          hanja-table)))
 
-;; NEED COMMENT.
+;; List of current conversion status.
 (defvar hanja-conversions
   nil)
 
 (defvar hanja-keymap
   (let ((map (make-sparse-keymap)))
     (define-key map "\r" 'hanja-list-terminate)
     (define-key map [return] 'hanja-list-terminate)
     (define-key map [up] 'hanja-list-prev-group)
@@ -7598,18 +7601,19 @@
     (define-key map "5" (lambda () (aset hanja-conversions 1 5) (hanja-list-terminate)))
     (define-key map "6" (lambda () (aset hanja-conversions 1 6) (hanja-list-terminate)))
     (define-key map "7" (lambda () (aset hanja-conversions 1 7) (hanja-list-terminate)))
     (define-key map "8" (lambda () (aset hanja-conversions 1 8) (hanja-list-terminate)))
     (define-key map "9" (lambda () (aset hanja-conversions 1 9) (hanja-list-terminate)))
     map)
   "Keymap for Hanja (Korean Hanja Converter).")
 
-;; NEED COMMENT.  What is CONDP and LST?
 (defun hanja-filter (condp lst)
+  "Return list.
+It contains true elements to evaluate CONDP with each element from LST."
   (delq
    nil
    (mapcar (lambda (x) (and (funcall condp x) x)) lst)))
 
 (defun hanja-list-prev-group ()
   "Select the prev group of conversions."
   (let ((base (aref hanja-conversions 0)))
     (if (> base 0)

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] Improving hangul input module
  2008-06-04 16:14     ` Jihyun Cho
@ 2008-06-05  7:24       ` Kenichi Handa
  2008-06-05 19:57         ` Jihyun Cho
  0 siblings, 1 reply; 11+ messages in thread
From: Kenichi Handa @ 2008-06-05  7:24 UTC (permalink / raw)
  To: Jihyun Cho; +Cc: emacs-devel

In article <9d644d9b0806040914v46839e87v48afdff983c3980e@mail.gmail.com>, "Jihyun Cho" <jihyun.jo@gmail.com> writes:

> I have adjusted comments and docstring.
> My English is not good.
> If you can not be understood, let me know it.

Thank you I've just committed your change with some
improvement.  Please check if my understanding is correct
with the latest code.

But there are a few places I still don't understand.

In hangul.el...

(1)

;; Current input character buffer. Store separated hangul character.
;; First and second index of vector stored "Choseong".
;; Third and forth index of vector stored "Jungseong".
;; Fifth and sixth index of vector stored "Jongseong".
(defvar hangul-queue
  (make-vector 6 0))

I don't understand 2nd to 4th lines.

(2)

(defsubst hangul2-input-method-jaum (char)
  "Store hangul jamo indice CHAR in `hangul-queue'.
Maybe, it is a Hangul 2-Bulsik jaum.
This function processes a Hangul 2-Bulsik jaum.
Unless the function inserts CHAR to current input queue,
commit current character and then start next character.
The Hangul 2-Bulsik is composed of `jaum' and `moum'."

"Maybe" is strange.  If CHAR is not a "Hangul 2-Bulsik
jaum", what it will be.

In what condition, it doesn't insert CHAR to the queue.

What does "start next character" mean?  Where is the "next
character"?

The same for hangul2-input-method-moum,
hangul3-input-method-cho, hangul3-input-method-jung,
hangul3-input-method-jong.

In hanja-util.el...

(1)

;; List of current conversion status.
(defvar hanja-conversions
  nil)

What format does it have?

(2)

(defun hanja-filter (condp lst)
  "Return list.
It contains true elements to evaluate CONDP with each element from LST."

I don't understand it.

By the way, why do you use a hash-table for hanja-table?
Isn't a char-table more efficient?  And, the value is now
"(CHAR) or (CHAR . STRING)", but most of elements are
(CHAR).  I think it's a waste of cons cells.  How about
changing the format to "CHAR or (CHAR . STRING)"?  It seems
easy to handle the changed format in hangul-to-hanja-char.

---
Kenichi Handa
handa@ni.aist.go.jp




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] Improving hangul input module
  2008-06-05  7:24       ` Kenichi Handa
@ 2008-06-05 19:57         ` Jihyun Cho
  2008-06-08  6:24           ` Jihyun Cho
  2008-06-09  1:28           ` Kenichi Handa
  0 siblings, 2 replies; 11+ messages in thread
From: Jihyun Cho @ 2008-06-05 19:57 UTC (permalink / raw)
  To: Kenichi Handa; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 2657 bytes --]

2008/6/5 Kenichi Handa <handa@m17n.org>:
> In article <9d644d9b0806040914v46839e87v48afdff983c3980e@mail.gmail.com>, "Jihyun Cho" <jihyun.jo@gmail.com> writes:
>
>> I have adjusted comments and docstring.
>> My English is not good.
>> If you can not be understood, let me know it.
>
> Thank you I've just committed your change with some
> improvement.  Please check if my understanding is correct
> with the latest code.
>
> But there are a few places I still don't understand.
>
> In hangul.el...
>
> (1)
>
> ;; Current input character buffer. Store separated hangul character.
> ;; First and second index of vector stored "Choseong".
> ;; Third and forth index of vector stored "Jungseong".
> ;; Fifth and sixth index of vector stored "Jongseong".
> (defvar hangul-queue
>  (make-vector 6 0))
>
> I don't understand 2nd to 4th lines.
>
> (2)
>
> (defsubst hangul2-input-method-jaum (char)
>  "Store hangul jamo indice CHAR in `hangul-queue'.
> Maybe, it is a Hangul 2-Bulsik jaum.
> This function processes a Hangul 2-Bulsik jaum.
> Unless the function inserts CHAR to current input queue,
> commit current character and then start next character.
> The Hangul 2-Bulsik is composed of `jaum' and `moum'."
>
> "Maybe" is strange.  If CHAR is not a "Hangul 2-Bulsik
> jaum", what it will be.
>
> In what condition, it doesn't insert CHAR to the queue.
>
> What does "start next character" mean?  Where is the "next
> character"?
>
> The same for hangul2-input-method-moum,
> hangul3-input-method-cho, hangul3-input-method-jung,
> hangul3-input-method-jong.
>
> In hanja-util.el...
>
> (1)
>
> ;; List of current conversion status.
> (defvar hanja-conversions
>  nil)
>
> What format does it have?
>
> (2)
>
> (defun hanja-filter (condp lst)
>  "Return list.
> It contains true elements to evaluate CONDP with each element from LST."
>
> I don't understand it.
>
> By the way, why do you use a hash-table for hanja-table?
> Isn't a char-table more efficient?  And, the value is now
> "(CHAR) or (CHAR . STRING)", but most of elements are
> (CHAR).  I think it's a waste of cons cells.  How about
> changing the format to "CHAR or (CHAR . STRING)"?  It seems
> easy to handle the changed format in hangul-to-hanja-char.
>
> ---
> Kenichi Handa
> handa@ni.aist.go.jp
>

Oh. I don't know that a char-table.
I modified a structure of hanja-table and adjusted comments.

"Maybe" in hangul2-input-method-jaum, hangul2-input-method-moum,
hangul3-input-method-cho, hangul3-input-method-jung,
hangul3-input-method-jong are deleted. It is checked by a calling
function. Therefore, always satisfies the conditions.

The diff file is too large. So I attached .el files.

[-- Attachment #2: hanja-util.el.bz2 --]
[-- Type: application/x-bzip2, Size: 139647 bytes --]

[-- Attachment #3: hangul.el.bz2 --]
[-- Type: application/x-bzip2, Size: 4519 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] Improving hangul input module
  2008-06-05 19:57         ` Jihyun Cho
@ 2008-06-08  6:24           ` Jihyun Cho
  2008-06-09  1:28           ` Kenichi Handa
  1 sibling, 0 replies; 11+ messages in thread
From: Jihyun Cho @ 2008-06-08  6:24 UTC (permalink / raw)
  To: Kenichi Handa; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 2960 bytes --]

2008/6/6 Jihyun Cho <jihyun.jo@gmail.com>:
> 2008/6/5 Kenichi Handa <handa@m17n.org>:
>> In article <9d644d9b0806040914v46839e87v48afdff983c3980e@mail.gmail.com>, "Jihyun Cho" <jihyun.jo@gmail.com> writes:
>>
>>> I have adjusted comments and docstring.
>>> My English is not good.
>>> If you can not be understood, let me know it.
>>
>> Thank you I've just committed your change with some
>> improvement.  Please check if my understanding is correct
>> with the latest code.
>>
>> But there are a few places I still don't understand.
>>
>> In hangul.el...
>>
>> (1)
>>
>> ;; Current input character buffer. Store separated hangul character.
>> ;; First and second index of vector stored "Choseong".
>> ;; Third and forth index of vector stored "Jungseong".
>> ;; Fifth and sixth index of vector stored "Jongseong".
>> (defvar hangul-queue
>>  (make-vector 6 0))
>>
>> I don't understand 2nd to 4th lines.
>>
>> (2)
>>
>> (defsubst hangul2-input-method-jaum (char)
>>  "Store hangul jamo indice CHAR in `hangul-queue'.
>> Maybe, it is a Hangul 2-Bulsik jaum.
>> This function processes a Hangul 2-Bulsik jaum.
>> Unless the function inserts CHAR to current input queue,
>> commit current character and then start next character.
>> The Hangul 2-Bulsik is composed of `jaum' and `moum'."
>>
>> "Maybe" is strange.  If CHAR is not a "Hangul 2-Bulsik
>> jaum", what it will be.
>>
>> In what condition, it doesn't insert CHAR to the queue.
>>
>> What does "start next character" mean?  Where is the "next
>> character"?
>>
>> The same for hangul2-input-method-moum,
>> hangul3-input-method-cho, hangul3-input-method-jung,
>> hangul3-input-method-jong.
>>
>> In hanja-util.el...
>>
>> (1)
>>
>> ;; List of current conversion status.
>> (defvar hanja-conversions
>>  nil)
>>
>> What format does it have?
>>
>> (2)
>>
>> (defun hanja-filter (condp lst)
>>  "Return list.
>> It contains true elements to evaluate CONDP with each element from LST."
>>
>> I don't understand it.
>>
>> By the way, why do you use a hash-table for hanja-table?
>> Isn't a char-table more efficient?  And, the value is now
>> "(CHAR) or (CHAR . STRING)", but most of elements are
>> (CHAR).  I think it's a waste of cons cells.  How about
>> changing the format to "CHAR or (CHAR . STRING)"?  It seems
>> easy to handle the changed format in hangul-to-hanja-char.
>>
>> ---
>> Kenichi Handa
>> handa@ni.aist.go.jp
>>
>
> Oh. I don't know that a char-table.
> I modified a structure of hanja-table and adjusted comments.
>
> "Maybe" in hangul2-input-method-jaum, hangul2-input-method-moum,
> hangul3-input-method-cho, hangul3-input-method-jung,
> hangul3-input-method-jong are deleted. It is checked by a calling
> function. Therefore, always satisfies the conditions.
>
> The diff file is too large. So I attached .el files.
>

I found a bug.
That bug was occurred when the program could not find a character in
hanja-table.
It was occurring after hanja-table was modified, and I fixed it.

[-- Attachment #2: hanja-util.el.bz2 --]
[-- Type: application/x-bzip2, Size: 139305 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] Improving hangul input module
  2008-06-05 19:57         ` Jihyun Cho
  2008-06-08  6:24           ` Jihyun Cho
@ 2008-06-09  1:28           ` Kenichi Handa
  2008-06-09 16:40             ` Jihyun Cho
  1 sibling, 1 reply; 11+ messages in thread
From: Kenichi Handa @ 2008-06-09  1:28 UTC (permalink / raw)
  To: Jihyun Cho; +Cc: emacs-devel

In article <9d644d9b0806051257n25d43302p3c2e187fb48e387@mail.gmail.com>, "Jihyun Cho" <jihyun.jo@gmail.com> writes:

> Oh. I don't know that a char-table.
> I modified a structure of hanja-table and adjusted comments.

> "Maybe" in hangul2-input-method-jaum, hangul2-input-method-moum,
> hangul3-input-method-cho, hangul3-input-method-jung,
> hangul3-input-method-jong are deleted. It is checked by a calling
> function. Therefore, always satisfies the conditions.

> The diff file is too large. So I attached .el files.

I installed them with slight modifications (fix arguments to
make-char-table, use mapc instead of mapcar, improve several
docstrings).

> I found a bug.
> That bug was occurred when the program could not find a character in
> hanja-table.
> It was occurring after hanja-table was modified, and I fixed it.

?? You change is only to hanja-init-load (when to show
message), and doesn't seem to solve the problem you wrote
above.

Anyway, please make a diff always with the latest CVS code.

---
Kenichi Handa
handa@ni.aist.go.jp




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] Improving hangul input module
  2008-06-09  1:28           ` Kenichi Handa
@ 2008-06-09 16:40             ` Jihyun Cho
  2008-06-10 11:58               ` Kenichi Handa
  0 siblings, 1 reply; 11+ messages in thread
From: Jihyun Cho @ 2008-06-09 16:40 UTC (permalink / raw)
  To: Kenichi Handa; +Cc: emacs-devel

2008/6/9 Kenichi Handa <handa@m17n.org>:
> In article <9d644d9b0806051257n25d43302p3c2e187fb48e387@mail.gmail.com>, "Jihyun Cho" <jihyun.jo@gmail.com> writes:
>
>> Oh. I don't know that a char-table.
>> I modified a structure of hanja-table and adjusted comments.
>
>> "Maybe" in hangul2-input-method-jaum, hangul2-input-method-moum,
>> hangul3-input-method-cho, hangul3-input-method-jung,
>> hangul3-input-method-jong are deleted. It is checked by a calling
>> function. Therefore, always satisfies the conditions.
>
>> The diff file is too large. So I attached .el files.
>
> I installed them with slight modifications (fix arguments to
> make-char-table, use mapc instead of mapcar, improve several
> docstrings).
>
>> I found a bug.
>> That bug was occurred when the program could not find a character in
>> hanja-table.
>> It was occurring after hanja-table was modified, and I fixed it.
>
> ?? You change is only to hanja-init-load (when to show
> message), and doesn't seem to solve the problem you wrote
> above.
>
> Anyway, please make a diff always with the latest CVS code.

OK. I'm sorry.
The error message is "hanja-filter: Wrong type argument: sequencep,
0", when "(make-char-table 'char-table-extra-slots 0)".
So, I modified "(make-char-table nil)", because hanja-filter's second
argument is list type.




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] Improving hangul input module
  2008-06-09 16:40             ` Jihyun Cho
@ 2008-06-10 11:58               ` Kenichi Handa
  0 siblings, 0 replies; 11+ messages in thread
From: Kenichi Handa @ 2008-06-10 11:58 UTC (permalink / raw)
  To: Jihyun Cho; +Cc: emacs-devel

In article <9d644d9b0806090940k290a2bbcte90cd271e581ddf0@mail.gmail.com>, "Jihyun Cho" <jihyun.jo@gmail.com> writes:

>>> It was occurring after hanja-table was modified, and I fixed it.
> >
> > ?? You change is only to hanja-init-load (when to show
> > message), and doesn't seem to solve the problem you wrote
> > above.
> >
> > Anyway, please make a diff always with the latest CVS code.

> OK. I'm sorry.
> The error message is "hanja-filter: Wrong type argument: sequencep,
> 0", when "(make-char-table 'char-table-extra-slots 0)".
> So, I modified "(make-char-table nil)", because hanja-filter's second
> argument is list type.

Ah, I see.  I fixed that when I committed your previous
version.

---
Kenichi Handa
handa@ni.aist.go.jp




^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2008-06-10 11:58 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-31  8:51 [PATCH] Improving hangul input module Jihyun Cho
2008-06-01 11:24 ` Kenichi Handa
2008-06-03  5:07   ` Kenichi Handa
2008-06-03  7:18     ` Jihyun Cho
2008-06-04 16:14     ` Jihyun Cho
2008-06-05  7:24       ` Kenichi Handa
2008-06-05 19:57         ` Jihyun Cho
2008-06-08  6:24           ` Jihyun Cho
2008-06-09  1:28           ` Kenichi Handa
2008-06-09 16:40             ` Jihyun Cho
2008-06-10 11:58               ` Kenichi Handa

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).