[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: elisp question:keyboard-translate with hyper fail?
From: |
Deniz Dogan |
Subject: |
Re: elisp question:keyboard-translate with hyper fail? |
Date: |
Sat, 12 Mar 2011 12:59:44 +0100 |
2011/3/12 Xah Lee <xahlee@gmail.com>:
> On Mar 11, 6:54 pm, Stefan Monnier <monn...@iro.umontreal.ca> wrote:
>> > ;; Swap “Ctrl+x” and “Ctrl+t”, so it's easier to type on Dvorak layout
>> > (keyboard-translate ?\C-t ?\C-x)
>> > (keyboard-translate ?\C-x ?\C-t)
>>
>> There are 32 Ctrl+letter combinations which are characters, and the
>> above two are among them. These are exceptional special cases due
>> to history. My general recommendation is to not use keyboard-translate
>> but key-translation-map or function-key-map, which work on arbitrary
>> key sequences rather only on single-char events.
>>
>> Stefan
>
> thanks to all.
>
> perhaps the doc can be improved.
>
> i just read up the elisp doc and it actually gives a C- example.
>
> -- Function: keyboard-translate from to
> This function modifies `keyboard-translate-table' to translate
> character code FROM into character code TO. It creates the
> keyboard translate table if necessary.
>
> Here's an example of using the `keyboard-translate-table' to make
> `C-x', `C-c' and `C-v' perform the cut, copy and paste operations:
>
> (keyboard-translate ?\C-x 'control-x)
> (keyboard-translate ?\C-c 'control-c)
> (keyboard-translate ?\C-v 'control-v)
> (global-set-key [control-x] 'kill-region)
> (global-set-key [control-c] 'kill-ring-save)
> (global-set-key [control-v] 'yank)
>
> also note it uses the syntax 「'control-x」. I don't quite understand
> it...
>
> should it be a bug report?
>
The examples with C-x, C-c and C-v are valid. The keys C-a up to C-z
and probably a few others (Stefan said there are 32 of them) are all
characters. C-3 however is not a character.
I don't think it's a bug in the documentation, but maybe it should
clarify this matter?
--
Deniz Dogan
- Re: elisp question:keyboard-translate with hyper fail?, (continued)
- Re: elisp question:keyboard-translate with hyper fail?, Xah Lee, 2011/03/12
- Re: elisp question:keyboard-translate with hyper fail?, Xah Lee, 2011/03/12
- Re: elisp question:keyboard-translate with hyper fail?, Stefan Monnier, 2011/03/14
- Re: elisp question:keyboard-translate with hyper fail?, Xah Lee, 2011/03/14
- Re: elisp question:keyboard-translate with hyper fail?, Xah Lee, 2011/03/18
- Re: elisp question:keyboard-translate with hyper fail?, rusi, 2011/03/19
- Re: elisp question:keyboard-translate with hyper fail?, Xah Lee, 2011/03/19
- Re: elisp question:keyboard-translate with hyper fail?, rusi, 2011/03/19
- Re: elisp question:keyboard-translate with hyper fail?,
Deniz Dogan <=