Article View: comp.sys.next.misc
Article #1659Re: NeXT Emacs key(pad) bindings?
From: Pia Kraft
Date: Wed, 15 Apr 1992 16:19
Date: Wed, 15 Apr 1992 16:19
195 lines
6776 bytes
6776 bytes
here is a patch for EtermView.m V2.1.
use: patch -R EtermView.m <keypad.patch
--------------------------------- cut here ----------------------------
#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
# keypad.patch
# This archive created: Wed Apr 15 16:20:03 1992
export PATH; PATH=/bin:$PATH
if test -f 'keypad.patch'
then
echo shar: will not over-write existing file "'keypad.patch'"
else
cat << \SHAR_EOF > 'keypad.patch'
*** EtermView.m Sun Jan 5 14:15:10 1992
--- EtermView.m.ORG Tue Oct 22 23:22:02 1991
***************
*** 78,124 ****
}
}
- #define CTRLKEY(x) (x & 31)
- #define METAKEY(x) (x | 0x80)
-
- static int mapNumericKey (int code)
- {
- static struct
- {
- int keyCode;
- int character;
- } numericMap[] = {
- {'1','q'},
- {'2','r'},
- {'3','s'},
- {'4','t'},
- {'5','u'},
- {'6','v'},
- {'7','w'},
- {'8','x'},
- {'9','y'},
- {'0','p'},
- {'.','n'},
- {0x03,'M'},
- {'+','l'},
- {'-','m'},
- {'*','S'},
- {'/','R'},
- {'=','Q'},
- {'`','P'},
- {0x00,0}
- };
- int i = 0;
-
- while (numericMap[i].keyCode)
- {
- if (code == numericMap[i].keyCode)
- return numericMap[i].character;
- ++i;
- }
- return -1;
- }
-
@implementation EtermView
+ initialize
--- 78,83 ----
***************
*** 331,349 ****
int code;
int start=0, n;
! if ((theEvent->flags & NX_NUMERICPADMASK) &&
theEvent->data.key.charCode >= 0xac &&
theEvent->data.key.charCode <= 0xaf) {
/* Arrow keys (left, up, right, down) */
buf[i++] = "\002\020\006\016"[theEvent->data.key.charCode - 0xac];
}
! /* map to vt100 key */
! else if ((theEvent->flags & NX_NUMERICPADMASK) &&
! (code = mapNumericKey(theEvent->data.key.charCode)) != -1) {
! buf[i++] = 0x1b;
! buf[i++] = 'O';
! buf[i++] = code;
! }
else if (theEvent->flags & NX_ALTERNATEMASK) {
/* Handle ALT key as a META key */
code = kc_keyforcode(theEvent->data.key.keyCode, theEvent->flags);
--- 290,306 ----
int code;
int start=0, n;
! if (theEvent->flags & NX_NUMERICPADMASK &&
theEvent->data.key.charCode >= 0xac &&
theEvent->data.key.charCode <= 0xaf) {
/* Arrow keys (left, up, right, down) */
buf[i++] = "\002\020\006\016"[theEvent->data.key.charCode - 0xac];
}
! else if (theEvent->flags & NX_NUMERICPADMASK &&
! theEvent->data.key.charCode == 0x03) {
! /* Enter key */
! buf[i++] = '\r';
! }
else if (theEvent->flags & NX_ALTERNATEMASK) {
/* Handle ALT key as a META key */
code = kc_keyforcode(theEvent->data.key.keyCode, theEvent->flags);
***************
*** 366,376 ****
/* Arrow keys (left, up, right, down) */
buf[i++] = "\002\020\006\016"[theEvent->data.key.charCode - 0xac];
}
! else if (theEvent->flags & NX_NUMERICPADMASK &&
! (code = mapNumericKey(theEvent->data.key.charCode)) != -1) {
! buf[i++] = 0x1b;
! buf[i++] = 'O';
! buf[i++] = code;
}
else if (theEvent->flags & NX_ALTERNATEMASK) {
/* Handle ALT key as a META key */
--- 323,332 ----
/* Arrow keys (left, up, right, down) */
buf[i++] = "\002\020\006\016"[theEvent->data.key.charCode - 0xac];
}
! else if (theEvent->flags & NX_NUMERICPADMASK &&
! theEvent->data.key.charCode == 0x03) {
! /* Enter key */
! buf[i++] = '\r';
}
else if (theEvent->flags & NX_ALTERNATEMASK) {
/* Handle ALT key as a META key */
SHAR_EOF
fi # end of overwriting check
# End of shell archive
exit 0
---------------------------- End of Shell-Archive --------------------
Your .emacs looks probably like this:
(setq term-setup-hook
(function
(lambda ()
(global-set-key "\M-Oy" 'scroll-down) ;; 9
(global-set-key "\M-Os" 'scroll-up) ;; 3
(global-set-key "\M-Ow" 'beginning-of-line) ;; 7
(global-set-key "\M-Oq" 'end-of-line) ;; 1
(global-set-key "\M-Ov" 'forward-char) ;; 6
(global-set-key "\M-Ot" 'backward-char) ;; 4
(global-set-key "\M-Ox" 'previous-line) ;; 8
(global-set-key "\M-Or" 'next-line) ;; 2
(global-set-key "\M-OM" "
(global-set-key "\M-Op" 'switch-to-buffer) ;; 0
(global-set-key "\M-OS" 'switch-to-buffer-other-window)
(global-set-key "\M-OP" 'other-window) ;; '
(global-set-key "\M-OQ" 'split-window-vertically) ;; =
(global-set-key "\M-OR" 'delete-other-windows) ;; /
(load "mouse-binding")
)))
I've created an /NextLibrary/Keyboards/emacs.keymapping with
/NextDevelopers/Demos/Keyboard:
\ is ctrl-/
| is ctrl-.
~ is ctrl-,
` is ctrl-'
begin 644 emacs.keymapping
M2UE-4````WP```4!`E)7`@%1`P)35@0"5%4%%@L,#1$7%!43&!(A(B,D)2@G
M)@D/%A!1____#@!<`'P`'``<`.,`ZP`<`!P.`%T`?0`=`!T`)P"Z`!T`'0X`
M6P![`!L`&P!@`*H`&P`;#0!I`$D`"0`)`,$`]0`)``D-`&\`3P`/``\`^0#I
M``\`#PT`<`!0`!``$`%P`5``$``0``&L_P``,```+@```_\``:\``:X``#$`
M`#0``#8``#,``"L``:T``#(``#7__P(`?P`("@`]`"L!N0&Q#@`M`%\`'P`?
M`+$`T``?`!\*`#@`*@&P`+0*`#D`*`"L`*L*`#``*0"M`+L``#<``#@``#D`
M`2T``"H*`&``?@!@`;L.`#T`?``]`!P`/0!\```81@X`+P!<`"\`'``O`%P`
M``H`_Q``#0`##@`G`"(`8````*D!K@``'``*`#L`.@&R`:(-`&P`3``,``P`
M^`#H``P`#`X`+``\`'X```#+`:,```<`#@`N`#X`?````+P!LP``Q`0.`"\`
M/P!<```!N`"_`?Y$``T`>@!:`!H`&@#/`5<`&@`:#0!X`%@`&``8`;0!S@`8
M`!@-`&,`0P`#``,!XP'3``,``PT`=@!6`!8`%@'6`>``%@`6#0!B`$(``@`"
M`>4!\@`"``(-`&T`30`-``T!;0'8``T`#0T`;@!.``X`#@#$`:\`#@`.#``@
M````@```#0!A`$$``0`!`,H`QP`!``$-`',`4P`3`!,`^P"G`!,`$PT`9`!$
M``0`!`%$`;8`!``$#0!F`$8`!@`&`*8!K``&``8-`&<`1P`'``<`\0#A``<`
M!PT`:P!+``L`"P#.`*\`"P`+#0!J`$H`"@`*`,8`K@`*``H-`&@`2``(``@`
MXP#K```8``(`"0`9#0!Q`%$`$0`1`/H`Z@`1`!$-`'<`5P`7`!<!R`''`!<`
M%PT`90!%``4`!0#"`,4`!0`%#0!R`%(`$@`2`>(!T@`2`!(-`'4`50`5`!4`
MR`#-`!4`%0T`>0!9`!D`&0"E`=L`&0`9#0!T`%0`%``4`>0!U``4`!0"`!L`
M?@H`,0`A`:T`H0X`,@!```````"R`+,`````"@`S`",`HP&Z"@`T`"0`H@"H
M"@`W`"8`MP&K#@`V`%X`'@`>`+8`PP`>`!X*`#4`)0&E`+T#`0!A`0!A`0!A
`
end
Enjoy
Pia
Technical Details
Message-ID:
<1992Apr15.161909.26685@hotmama.toppoint.de>Path:
arc1-ca.pugleaf.net!sparky!uunet!mcsun!unido!uniol!tpki.toppoint.de!hotmama.toppoint.de!rootReferences:
<ANDERSON.92Apr10160108@sapir.cog.jhu.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!unido!uniol!tpki.toppoint.de!hotmama.toppoint.de!root From: pia@hotmama.toppoint.de (Pia Kraft) Newsgroups: comp.sys.next.misc Subject: Re: NeXT Emacs key(pad) bindings? Message-ID: <1992Apr15.161909.26685@hotmama.toppoint.de> Date: 15 Apr 92 16:19:09 GMT References: <ANDERSON.92Apr10160108@sapir.cog.jhu.edu> Sender: root@hotmama.toppoint.de (Operator) Reply-To: pia@hotmama.toppoint.de (Pia Kraft) Distribution: comp Organization: M+H, Gesellschaft fuer Realtime-Programming mbH Lines: 195