From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Rustom Mody Newsgroups: gmane.emacs.help Subject: translation tables (was searching elisp on debian/ubuntu) Date: Fri, 25 Oct 2013 11:46:44 -0700 (PDT) Message-ID: <69874486-0d1c-4fe7-a8e6-01c2cb88ee1e@googlegroups.com> References: <0217b185-f626-4d6c-afdb-38239b35f4d5@googlegroups.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1382727017 30703 80.91.229.3 (25 Oct 2013 18:50:17 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 25 Oct 2013 18:50:17 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Oct 25 20:50:21 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VZmSj-0002s1-17 for geh-help-gnu-emacs@m.gmane.org; Fri, 25 Oct 2013 20:50:21 +0200 Original-Received: from localhost ([::1]:60452 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VZmSi-0005OA-O7 for geh-help-gnu-emacs@m.gmane.org; Fri, 25 Oct 2013 14:50:20 -0400 X-Received: by 10.58.136.6 with SMTP id pw6mr3782409veb.32.1382726805682; Fri, 25 Oct 2013 11:46:45 -0700 (PDT) X-Received: by 10.50.23.8 with SMTP id i8mr91204igf.8.1382726805332; Fri, 25 Oct 2013 11:46:45 -0700 (PDT) Original-Path: usenet.stanford.edu!o2no26519080qas.0!news-out.google.com!z6ni91529pbu.0!nntp.google.com!o2no26519063qas.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=59.95.4.107; posting-account=mBpa7woAAAAGLEWUUKpmbxm-Quu5D8ui Original-NNTP-Posting-Host: 59.95.4.107 User-Agent: G2/1.0 Injection-Date: Fri, 25 Oct 2013 18:46:45 +0000 Original-Xref: usenet.stanford.edu gnu.emacs.help:201950 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:94218 Archived-At: On Friday, October 25, 2013 11:08:11 PM UTC+5:30, Stefan Monnier wrote: > > eg Figure out how the function 'make-translation-table' is used in elis= p >=20 > The fact that it's almost never used is a subtle hint that you probably > shouldn't use it. ??? Below is my code as currently written. Scroll-lock should change from normal ascii layout to apl layout. If you dont have scroll-lock (eg laptops) choose come other free key How should I do it better? ---------------------- (defvar apl-keyboard '( ;; number row "`=E2=97=8A 1=C2=A8 2=C2=AF 3< 4=E2=89=A4 5=3D 6=E2=89=A5 7> = 8=E2=89=A0 9=E2=88=A8 0=E2=88=A7 -=C3=97 =3D=C3=B7 \=E2=8D=9D |= =E2=8D=80"=20 ;; number row SHIFTed "~=E2=8D=A8 !=C2=A1 @=E2=82=AC #=C2=A3 $=E2=8D=A7 % ^ & = *=E2=8D=82 (=E2=8D=B1 )=E2=8D=B2 _=E2=89=A1 +=E2=8C=B9" ;; qwert row "q? w=E2=8D=B5 e=E2=88=88 t=E2=88=BC y=E2=86=91 r=E2=8D=B4 u=E2= =86=93 i=E2=8D=B3 o=E2=97=8B p=E2=8B=86" ;; qwert row shifted "Q=C2=BF W=E2=8C=BD E=E2=8B=B8 T=E2=8D=89 Y=C2=A5 I=E2=8D=B8 O= =E2=8D=A5 P=E2=8D=9F [=E2=86=90 ]=E2=86=92" ;; asdf row "a=E2=8D=BA s=E2=8C=88 d=E2=8C=8A f_ g=E2=88=87 h=E2=88=86 j=E2= =88=98 k' l=E2=8E=95 ;=E2=8A=A2 '=E2=8A=A3" ;; asdf row shifted "A=E2=8A=96 S D F=E2=8D=AB G=E2=8D=92 H=E2=8D=8B J=E2=8D=A4 = K=E2=8C=BB L=E2=8D=9E" ;; zxcv row "z=E2=8A=82 x=E2=8A=83 c=E2=88=A9 v=E2=88=AA b=E2=8A=A5 n=E2=8A= =A4 m=E2=88=A3 ,=E2=8C=B7 .=E2=8D=8E /=E2=8D=95" ;; zxcv row shifted "Z X C=E2=8D=9D V B=E2=8D=8E N=E2=8D=95 M=E2=8C=B6 <=E2=8D= =AA >=E2=8D=99 ?=E2=8C=BF" ) "APL keyboard is a list of keyboard rows For structure see \\[kb-block-defrules] " ) (defun kb-block-defrules (kb) "kb is a list of keyboard rows Each row is a space delimited string The elements of the rows apart from spaces are a pair of characters the first is a keyboard and the second is a translation (which could be abs= ent) See apl-keyboard above for example. This function converts that list of strings=20 into a lisp list of (key .translation) pairs " (let ((kbl nil)) (dolist (row kb (reverse kbl)) (let ((key-trans-list (split-string row "[ \t]+" t)) (key) (trans)) (dolist (key-trans key-trans-list) (when (=3D (length key-trans) 2) (setq key (aref key-trans 0)=20 trans (aref key-trans 1) kbl (cons (cons key trans) kbl) ))))))) =20 (defvar apl-input-mode nil) ;; obviously this will not be global when the rest of apl mode ;; are in shape. Just a hack for now (global-set-key (kbd "") 'toggle-apl-input-mode) (defvar mode-name-aplized "=CE=B1=CF=80=CE=BB") (defvar mode-name-ascii "APL") (defvar apl-translation-table (make-translation-table=20 (kb-block-defrules apl-keyboard))) (defun toggle-apl-input-mode () (interactive) (setq apl-input-mode (not apl-input-mode)) (if apl-input-mode (setq keyboard-translate-table apl-translation-table mode-name mode-name-aplized) (setq keyboard-translate-table nil mode-name mode-name-ascii)) (force-mode-line-update))