all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Deniz Dogan <deniz.a.m.dogan@gmail.com>
To: Xah Lee <xahlee@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: elisp question:keyboard-translate with hyper fail?
Date: Sat, 12 Mar 2011 12:59:44 +0100	[thread overview]
Message-ID: <AANLkTimnsXJLymB6QaJMzyB8KwESishALeZ2m-2xjuo7@mail.gmail.com> (raw)
In-Reply-To: <f86da059-9da5-4bb5-99d5-962f4fbabe54@l14g2000pre.googlegroups.com>

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



      parent reply	other threads:[~2011-03-12 11:59 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-11 11:00 elisp question:keyboard-translate with hyper fail? Xah Lee
2011-03-11 12:01 ` Deniz Dogan
     [not found] ` <mailman.6.1299844900.14178.help-gnu-emacs@gnu.org>
2011-03-11 22:11   ` Xah Lee
2011-03-12  0:26     ` Tim X
2011-03-12  2:54     ` Stefan Monnier
2011-03-12  4:51       ` Le Wang
2011-03-12 21:16         ` Stefan Monnier
2011-03-13  4:31           ` Le Wang
2011-03-12  7:07       ` Xah Lee
2011-03-12  7:22         ` Xah Lee
2011-03-14 14:17           ` Stefan Monnier
2011-03-14 20:32             ` Xah Lee
2011-03-18 13:56               ` Xah Lee
2011-03-19 16:09                 ` rusi
2011-03-20  0:31                   ` Xah Lee
2011-03-20  2:51                     ` rusi
2011-03-12 11:59         ` Deniz Dogan [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AANLkTimnsXJLymB6QaJMzyB8KwESishALeZ2m-2xjuo7@mail.gmail.com \
    --to=deniz.a.m.dogan@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=xahlee@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.