From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Kenichi Handa Newsgroups: gmane.emacs.devel Subject: Re: reverting CJK input methods Date: Fri, 30 Apr 2004 10:42:17 +0900 (JST) Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <200404300142.KAA01027@etlken.m17n.org> References: <20040429.150303.42778779.wl@gnu.org> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 (generated by SEMI 1.14.3 - "Ushinoya") Content-Type: text/plain; charset=US-ASCII X-Trace: sea.gmane.org 1083290049 21572 80.91.224.253 (30 Apr 2004 01:54:09 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 30 Apr 2004 01:54:09 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Fri Apr 30 03:53:58 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BJNDy-0006k4-00 for ; Fri, 30 Apr 2004 03:53:58 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1BJNDy-00014Y-00 for ; Fri, 30 Apr 2004 03:53:58 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1BJN6E-0006kU-TQ for emacs-devel@quimby.gnus.org; Thu, 29 Apr 2004 21:45:58 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30) id 1BJN51-0006HW-NT for emacs-devel@gnu.org; Thu, 29 Apr 2004 21:44:43 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30) id 1BJN2s-0004E0-M7 for emacs-devel@gnu.org; Thu, 29 Apr 2004 21:43:09 -0400 Original-Received: from [192.47.44.130] (helo=tsukuba.m17n.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1BJN2j-0003vn-UI; Thu, 29 Apr 2004 21:42:22 -0400 Original-Received: from fs.m17n.org (fs.m17n.org [192.47.44.2]) by tsukuba.m17n.org (8.11.6p2/8.11.6) with ESMTP id i3U1gI803836; Fri, 30 Apr 2004 10:42:18 +0900 (JST) Original-Received: from etlken.m17n.org (etlken.m17n.org [192.47.44.125]) by fs.m17n.org (8.11.6p2/8.11.6) with ESMTP id i3U1gI911047; Fri, 30 Apr 2004 10:42:18 +0900 (JST) Original-Received: (from handa@localhost) by etlken.m17n.org (8.8.8+Sun/3.7W-2001040620) id KAA01027; Fri, 30 Apr 2004 10:42:17 +0900 (JST) Original-To: wl@gnu.org In-reply-to: <20040429.150303.42778779.wl@gnu.org> (message from Werner LEMBERG on Thu, 29 Apr 2004 15:03:03 +0200 (CEST)) User-Agent: SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/21.3 (sparc-sun-solaris2.6) MULE/5.0 (SAKAKI) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:22395 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:22395 In article <20040429.150303.42778779.wl@gnu.org>, Werner LEMBERG writes: > Computers are much faster today, with much more memory. Ken'ichi-san, > what do you think about activating the decode maps for all CJK quail > input methods, and adding a function like `show-input-method-input' > which yields the current input method's input string for the current > character. It's a good idea. But, as computers are much faster, I think we can find a key for a specific character by looking up the quail map. Please evaluate the attached code, activate some input method, input some character, go to that character, and do M-x quail-find-key RET. If that is too slow, another way is to generate the decode map on demand. --- Ken'ichi HANDA handa@m17n.org (defun quail-find-key (char map key) (when (consp map) (let ((translation (car map))) (cond ((integerp translation) (if (= translation char) (throw 'tag key))) ((stringp translation) (if (string-match (string char) translation) (throw 'tag key))) ((vectorp translation) (dotimes (i (length translation)) (let ((target (aref translation i))) (if (integerp target) (if (= target char) (throw 'tag key)) (if (and (= (length target) 1) (= (aref target 0) char)) (throw 'tag key)))))) ((consp translation) (setq translation (cdr translation)) (dotimes (i (length translation)) (let ((target (aref translation i))) (if (integerp target) (if (= target char) (throw 'tag key)) (if (and (= (length target) 1) (= (aref target 0) char)) (throw 'tag key))))))))) (dolist (elt (cdr map)) (quail-find-key char (cdr elt) (cons (car elt) key)))) (defun quail-show-key () (interactive) (let* ((char (following-char)) (key (catch 'tag (quail-find-key char (quail-map) nil)))) (if key (message "%c can be input by typing \"%s\"" char (apply 'string (nreverse key))) (message "%c can't be input by the current input method" char))))