unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] adjusting korean key bindings
@ 2009-06-11 14:27 Jihyun Cho
  2009-06-12  1:09 ` Kenichi Handa
  0 siblings, 1 reply; 14+ messages in thread
From: Jihyun Cho @ 2009-06-11 14:27 UTC (permalink / raw)
  To: emacs-devel

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

I adjusted a keymap.
Many korean people are using a `Hanja' key to convert Hangul to Hanja
and a `Hangul' key to toggle input method.
As a keymap was adjusted, I modified a `hangul-to-hanja-conversion' function.

[-- Attachment #2: emacs-hanja.patch --]
[-- Type: application/octet-stream, Size: 4025 bytes --]

? lisp/mail/subdirs.el
? lisp/nxml/char-name/subdirs.el
Index: leim/quail/hangul.el
===================================================================
RCS file: /sources/emacs/emacs/leim/quail/hangul.el,v
retrieving revision 1.27
diff -u -8 -p -r1.27 hangul.el
--- leim/quail/hangul.el	8 Jan 2009 04:00:28 -0000	1.27
+++ leim/quail/hangul.el	10 Jun 2009 01:19:26 -0000
@@ -86,16 +86,17 @@
       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)
+    (define-key map [Hangul_Hanja] 'hangul-to-hanja-conversion)
     map)
   "Keymap for Hangul method.  It is used by all Hangul input methods.")
 
 ;; Current input character buffer. Store separated hangul character.
 ;; The first and second are Choseong position.
 ;; The third and forth are Jungseong position.
 ;; The fifth and sixth are Jongseong position.
 ;; The second, forth and sixth are double Jamo position.
@@ -354,22 +355,28 @@ Other parts are the same as a `hangul3-i
     (delete-backward-char 1)))
 
 (defun hangul-to-hanja-conversion ()
   "Convert the previous hangul character to the corresponding hanja 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
 ;; used for looking up `hangul2-keymap'."
 (defun hangul2-input-method-internal (key)
   (let ((char (+ (aref hangul2-keymap (1- (% key 32)))
                  (cond ((or (= key ?O) (= key ?P)) 2)
                        ((or (= key ?E) (= key ?Q) (= key ?R)
Index: lisp/language/korea-util.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/language/korea-util.el,v
retrieving revision 1.19
diff -u -8 -p -r1.19 korea-util.el
--- lisp/language/korea-util.el	5 Jan 2009 03:22:27 -0000	1.19
+++ lisp/language/korea-util.el	10 Jun 2009 01:19:27 -0000
@@ -92,19 +92,22 @@
   (setq isearch-input-method-function input-method-function
 	isearch-input-method-local-p t)
   (setq input-method-function nil)
   (isearch-update))
 
 ;; Information for setting and exiting Korean environment.
 (defvar korean-key-bindings
   `((global [?\S- ] toggle-korean-input-method nil)
+    (global [Hangul] toggle-korean-input-method nil)
     (global [C-f9] quail-hangul-switch-symbol-ksc nil)
-    (global [f9]  quail-hangul-switch-hanja nil)
+    (global [f9] hangul-to-hanja-conversion nil)
+    (global [Hangul_Hanja] hangul-to-hanja-conversion nil)
     (,isearch-mode-map [?\S- ] isearch-toggle-korean-input-method nil)
+    (,isearch-mode-map [Hangul] isearch-toggle-korean-input-method nil)
     (,isearch-mode-map [C-f9] isearch-hangul-switch-symbol-ksc nil)
     (,isearch-mode-map [f9] isearch-hangul-switch-hanja nil)))
 
 ;;;###autoload
 (defun setup-korean-environment-internal ()
   (let ((key-bindings korean-key-bindings))
     (while key-bindings
       (let* ((this (car key-bindings))

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

end of thread, other threads:[~2009-06-23  3:46 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-11 14:27 [PATCH] adjusting korean key bindings Jihyun Cho
2009-06-12  1:09 ` Kenichi Handa
2009-06-12  2:05   ` Jason Rumney
2009-06-12  2:54   ` Jihyun Cho
2009-06-15  2:16     ` Kenichi Handa
2009-06-15 12:21       ` Jihyun Cho
2009-06-16  6:43         ` Kenichi Handa
2009-06-17  8:06           ` Jihyun Cho
2009-06-17 11:44             ` Kenichi Handa
2009-06-17 15:34               ` Chong Yidong
2009-06-18  1:32                 ` Kenichi Handa
2009-06-18  1:42                   ` Kenichi Handa
2009-06-23  3:46                   ` Kenichi Handa
2009-06-12 21:22   ` Stefan Monnier

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).