From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Xah Lee Newsgroups: gmane.emacs.help Subject: Re: elisp question:keyboard-translate with hyper fail? Date: Fri, 11 Mar 2011 23:07:06 -0800 (PST) Organization: http://groups.google.com Message-ID: References: <86aa8db7-62db-478d-940d-82609c8dde34@18g2000prd.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1299915658 30956 80.91.229.12 (12 Mar 2011 07:40:58 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 12 Mar 2011 07:40:58 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Mar 12 08:40:50 2011 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PyJRR-0001Zr-Tm for geh-help-gnu-emacs@m.gmane.org; Sat, 12 Mar 2011 08:40:50 +0100 Original-Received: from localhost ([127.0.0.1]:48070 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PyJRR-0007FQ-Ec for geh-help-gnu-emacs@m.gmane.org; Sat, 12 Mar 2011 02:40:49 -0500 Original-Path: usenet.stanford.edu!postnews.google.com!l14g2000pre.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 43 Original-NNTP-Posting-Host: 76.126.112.84 Original-X-Trace: posting.google.com 1299913626 13906 127.0.0.1 (12 Mar 2011 07:07:06 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Sat, 12 Mar 2011 07:07:06 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: l14g2000pre.googlegroups.com; posting-host=76.126.112.84; posting-account=bRPKjQoAAACxZsR8_VPXCX27T2YcsyMA User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.127 Safari/534.16, gzip(gfe) Original-Xref: usenet.stanford.edu gnu.emacs.help:185869 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:80017 Archived-At: On Mar 11, 6:54=C2=A0pm, Stefan Monnier wrote: > > ;; Swap =E2=80=9CCtrl+x=E2=80=9D and =E2=80=9CCtrl+t=E2=80=9D, 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. =C2=A0These are exceptional special cases due > to history. =C2=A0My general recommendation is to not use keyboard-transl= ate > but key-translation-map or function-key-map, which work on arbitrary > key sequences rather only on single-char events. > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 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 =E3=80=8C'control-x=E3=80=8D. I don't quite un= derstand it... should it be a bug report? Xah