emacs-pretest-bug
[Top][All Lists]
Advanced

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

Re: Rebinding international characters


From: Kenichi Handa
Subject: Re: Rebinding international characters
Date: Fri, 30 Jul 2004 15:42:53 +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>, Kenichi Handa <address@hidden> writes:

> By the way, I'm puzzled with the handling of
> key-translation-map.

> (define-key key-translation-map "\e$B" [?a])

> With above, I think key sequence ESC $ B should be mapped to
> ?a and thus inserts ?a.  But, when I type ESC $, ispell-word
> is invoked.

It seems that (define-key key-translation-map "XYZ" ...)
doesn't work if the key sequence "XY" is bound to a non
prefix key in global or local map.  In the case of "\e$B",
"\e$" is bound to ispell-word (not a prefix key), so it
doesn't work.

Actually, in read_key_sequence, we have this code:

  /* If the best binding for the current key sequence is a keymap, or
     we may be looking at a function key's escape sequence, keep on
     reading.  */
  while (first_binding < nmaps
         /* Keep reading as long as there's a prefix binding.  */
         ? !NILP (submaps[first_binding])
         /* Don't return in the middle of a possible function key sequence,
            if the only bindings we found were via case conversion.
            Thus, if ESC O a has a function-key-map translation
            and ESC o has a binding, don't return after ESC O,
            so that we can translate ESC O plus the next character.  */
         : (fkey.start < t || keytran.start < t))

When I exectute the following code:

(defvar dummy_esc_dollar_map (make-sparse-keymap))
(fset 'dummy_esc_dollar_prefix dummy_esc_dollar_map)
(global-set-key "\e$" 'dummy_esc_dollar_prefix)
(define-key key-translation-map "\e$B" [?a])

typing ESC $ B inserts `a' as expected.

Is this a bug or a feature?  If it is a bug, purhaps it can
be fixed by chaning the abobe `while' condition as below:

  while (first_binding < nmaps
         /* Keep reading as long as there's a prefix binding.  */
         ? !NILP (submaps[first_binding]) || keytran.start < t
                                         ^^^^^^^^^^^^^^^^^^^^^
         /* Don't return in the middle of a possible function key sequence,
            if the only bindings we found were via case conversion.
            Thus, if ESC O a has a function-key-map translation
            and ESC o has a binding, don't return after ESC O,
            so that we can translate ESC O plus the next character.  */
         : (fkey.start < t || keytran.start < t))

If it is a feature, I'll setup a dummy prefix in
encoded-kb.el.

---
Ken'ichi HANDA
address@hidden




reply via email to

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