emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: reverting CJK input methods


From: Kenichi Handa
Subject: Re: reverting CJK input methods
Date: Fri, 30 Apr 2004 14:06:13 +0900 (JST)
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)

In article <address@hidden>, Miles Bader <address@hidden> writes:
> Kenichi Handa <address@hidden> writes:
>>  Please evaluate the attached code, activate some input method, input
>>  some character, go to that character, and do M-x quail-find-key RET.

>   let: Wrong type argument: listp, quail-japanese-switch-package

Oops, please try the attached new one.  But, for the input
method "Japanese", we can't show key for Kanji characters
because the Kanji characters are generated from the input
hiragana sequence by the different program than quail.

> Oh, but it seemed to work well with some other input method, like
> `german'.

> I think this would be nice to add to the output for `C-u C-x ='.

> E.g., 

>   character: ö (04366, 2294, 0x8f6, U+00F6)
>     charset: latin-iso8859-1
>            (Right-Hand Part of Latin Alphabet 1 (ISO/IEC 8859-1): ISO-IR-100.)
>      ...
>   keystroke: ö can be input by typing ";"
>              (using the `german' input method)
>      ...

Ah, yes, this is also a good idea.

---
Ken'ichi HANDA
address@hidden

(defun quail-find-key (char map key)
  (when (and (consp map) (listp (cdr 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))))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]