[comp.sys.amiga] Use Emacs at your CLI

page@swan.ulowell.edu (Bob Page) (07/21/88)

Here's a keymap you can use with ConMan to use Emacs keys to do your
line editing, rather than the ConMan defaults.  Instructions included.
You'll have to unshar the whole thing, then uudecode two files.

If you have any comments, please let me know.  Enjoy!

..Bob
--
Bob Page, U of Lowell CS Dept.  page@swan.ulowell.edu  ulowell!page
"What a wonder is USENET; such wholesale production of conjecture from
such a trifling investment in fact."	-- Carl S. Gutekunst


#	This is a shell archive.
#	Remove everything above and including the cut line.
#	Then run the rest of the file through sh.
#----cut here-----cut here-----cut here-----cut here----#
#!/bin/sh
# shar:    Shell Archiver
#	Run the following text with /bin/sh to create:
#	Readme
#	cman-emacs.uu
#	KeyMap.uu
# This archive created: Thu Jul 21 01:58:07 1988
cat << \SHAR_EOF > Readme

	cman-emacs: a keymap for Emacs-like editing for ConMan

	Bob Page .. 21-Jul-88.  Release 1.  Placed in the public domain.

The 'cman-emacs' keymap works with ConMan to allow you to use
emacs-like command line editing sequences at the CLI.  For example,
CTRL/A moves the cursor to the beginning of the line, instead of the
ConMan default of toggling overstrike mode.

Here's a list of emacs-like editing commands supported by ConMan when
used with the cman-emacs keymap.  Note that C-x means (CTRL key and
'x' key pressed together, and A-x means 'ALT' key and 'x' pressed
together.

	C-a	(first)		Move cursor to beginning of line
	C-b	(back)		Move cursor one character to the left
	C-d	(delete)	Delete character under cursor
	C-e	(end)		Move cursor to end of line
	C-f	(forward)	Move cursor one character to the right
	C-k	(kill)		Delete text from cursor to end of line
	C-n	(next)		Recall 'next' line of history buffer
	C-o	(overstrike)	Toggle overstrike/insert mode
	C-p	(previous)	Recall 'previous' line of history buffer
	C-r	(reverse)	Search history buffer backwards for text
	C-s	(search)	Search history buffer forwards for text
	C-u	(undo)		Get back command line (See ConMan docs)
	C-z	(suspend)	Toggle window to back/front
	C-BS	(del-prev-wd)	Delete word left of cursor   (also A-BS)
	C-DEL	(del-next-wd)	Delete word right of cursor  (also A-DEL & A-d)
	A-b	(back-word)	Move cursor to start of word
	A-f	(forward-word)	Move cursor to start of next word


This keymap has no dead keys (don't worry if you don't know what those
are).  It also doesn't support the extra keys on the A500/A2000 (extra
from the A1000).  Hey, I built this for me, ok?  ;-)

I thought C-b was too easy to delete the history buffer, so I moved it
to C-A-h (Control-Alt-h).

Note the A (alt) sequences are really Meta keys, I tend to use ESC for
this in Emacs but this (ESC-x) won't work until I make the ESC key a
dead key.  Maybe Release 2.

The C-a and C-e functions are approximations ... since ConMan doesn't
have these functions, I built them from a 'keymap macro'.
Essentially, when you type C-a, the keymap will generate 25 'word
left' commands, which should get you to the beginning of the line.

ConMan features missing in cman-emacs keymap:
	C-r (flush/recall)
	C-s (hold output via C-s/C-q protocol)
	C-u (delete from cursor to start of line)
	C-z (delete line and flush typeahead)
If you find you need these functions let me know and I'll add them.

Unchanged from ConMan defaults:
	cursor keys (shifted and unshifted)
	function keys
	C-- (control dash) still means undo
	C-\ (EOF)
	C-q (release output) although there's no hold-output
	C-w still clears window and refreshes line
	C-y still deletes to end of line (like emacs C-k)
	DEL, BackSpace and TAB keys


INSTALLATION:
	This keymap is only being distributed in binary form, sorry.
	It should be 1544 bytes long.

	0. You should have ConMan V1.1 running.  With ConMan V1.1 comes
	   a program called 'KeyMap'; you'll need that.  Also take note
	   of the current keymap you're using (it's usa unless you've
	   changed it in your startup-sequence ... most A500 and A2000
	   startups in the US use usa1).

	1. Put the cman-emacs keymap file in the devs:keymaps directory:
		copy cman-emacs devs:keymaps

	2. Tell the system about the new keymap:
		SetMap cman-emacs

	3. Re-install the original keymap:
		SetMap usa1
	(or whatever keymap you used to have loaded)

	4. Change this ONE keymap to cman-emacs:
		KeyMap cman-emacs

You need to use SetMap (supplied on the WorkBench disk) to load the
new keymap from disk.  Unfortunately, SetMap changes ALL the keymaps
(for all the consoles you have running) and we don't want that (it
would mess up Emacs for one!), but we have to load cman-emacs somehow,
so we have SetMap do it.  Then we change ALL keymaps back to our
original keymap.  Now we can change individual keymaps with the
'KeyMap' program that comes with ConMan.

It is unfortunate we can't have SetMap load a keymap from disk and set
just one console's keymap.  Likewise, it's unfortunate we can't use
KeyMap to load a keymap from disk ... the keymap has to already be
loaded into memory before KeyMap can use it.  I hope to have the
problem solved soon.

IMPORTANT NOTE: You will only have this cman-emacs keymap for the one
console you changed with KeyMap.  If you spawn a new CLI, or start
another process, the keymap that gets inherited is the system default
keymap (use SetMap to change that).

You don't want cman-emacs to be the default keymap, since that would
mess up your editors and such.  If you want to see what I mean, SetMap
cman-emacs and go into Emacs.  Now try C-k to kill to the end of the
line.  Essentially I had to change the keymap so when you typed C-k,
the system generates a C-y, because that's what ConMan wants to see
for 'kill to end of line'.  Hopefully Mr. Hawes will find it in his
heart to give us a version of ConMan that allows you to reconfigure
it, rather than have you reconfigure your keyboard to satisfy ConMan,
then this silly keymap wouldn't be needed.

If you have any comments, I can be reached at:

	Internet: page@ulowell.edu
	UUCP:	  ulowell!page
	BIX:	  page

..Bob


Release 1, July 21, 1988.
SHAR_EOF
cat << \SHAR_EOF > cman-emacs.uu
begin 777 cman-emacs
M```#\P`````````!``````````````%,```#Z0```4P````````````````%"
M)````$P```#$````+@```#T```",```!Q````#8```!%``#_`_\!_@``````K
M````_[__[__O__=']/\#````!P<'!P<'!P<'!P<'!P>`!P<'1T<'!T<'1T<'#
M!X`'!P='1T='!T<'1P<'!X"`!P<'@$<'!P='1P<'!P>`!P<'!P)&00`$`D:`U
M@(`"@$%!04%!04%!04%!04%!@("`@(!`@("`@("`@("`@("`@("`@("`@("`0
M@("`_N!^8*&Q(3'`LD`RH[,C,Z2T)#2EM24UWK9>-J:W)C>JN"HXJ+DH.:FP5
M*3#?K5\MJ[TK/?S<?%P`````L+`P,-'Q47'7]U=W```"I````P#4]%1TV?E9U
M>0```Q?)Z4EI```#+````T'[VWM;_=U]70````"QL3$QLK(R,K.S,S,```-7\
M```#LP```\H```/AQ^='9P```_G*ZDIJ```$#\SL3&RZNSH[HJ<B)P``````F
M````M+0T-+6U-36VMC8V````````!"38^%AXP^-#8];V5G8```0[```$4\WMX
M36V\K#PLOJX^+K^O/R\`````KJXN+K>W-S>XN#@XN;DY.0``H"````1I```$'
M>`````T```H-``";&P``!'\``````````````````/\M````````!(X```26M
M```$G@``!*<```2P```$NP``!,8```31```$W```!.<```3R```$_0``!0@`N
M``43``````````````````````````````4>````````````````````````[
M`````````````````````````````````````````````````````````````
M`````````````````````````````````````````````1`!$0$2`1-(%`!<"
M`%P`7&5%Y<6;($";($";($";($";($";($";($";($";($";($";($";($";K
M($";($";($";($";($";($";($";($";($";($";($";($`!$`$1`1(!$P,4*
M`!<`%P`7<E+RTILU?@$0`1$!$@$3`10`%0`5`!5U5?75'P$0`1$!$@$3`10`+
M%0`5`!5O3^_/`0$0`1$!$@$3`A0`%@`6`!9P4/#0FT$!$`$1`1(!$T@4`%P`\
M7`!<84'AP9L@09L@09L@09L@09L@09L@09L@09L@09L@09L@09L@09L@09L@'
M09L@09L@09L@09L@09L@09L@09L@09L@09L@09L@09L@00$0`1$!$@$3`Q0`V
M%P`7`!=S4_/3FS1^`1`!$0,2`14!%@`7`!<`%V1$FS=^Q'\!$`$1`Q(!%0(6I
M`!@`&``89D:;($#&FT,!$`$1`1(!$P$4`!4!%0`6:$CHR`@"`1`!$0$2`1,!H
M%``5`!4`%6M+Z\L9`1`!$0$2`1,#%``7`!<`%WI:^MJ;.7X!$`$1`Q(!%0(6>
M`!@`&``88D*;($'"FT0!$`$1`1(!$P(4`!8`%@`6;D[NSIM"`0@#"0,,``\([
MFS9^FS9^`00"!0F;6@$(`PD##``/?YLW?ILW?@($`@:;09M4`@0"!IM"FU,"N
M!`,&FT.;($`"!`,&FT2;($$#!`0'FS!^FS$P?@,$!`>;,7Z;,3%^`P0$!YLR;
M?ILQ,GX#!`0'FS-^FS$S?@,$!`>;-'Z;,31^`P0$!YLU?ILQ-7X#!`0'FS9^R
MFS$V?@,$!`>;-WZ;,3=^`P0$!YLX?ILQ.'X#!`0'FSE^FS$Y?@,"FS]^`&-M<
M86XM96UA8W,``````^P````I`````````D````(H```")````B````(<```"Q
M&````A0```(0```"#````@@```($```"`````?P```'X```!]````=P```',U
M```!R````9P```&8```!B````6````%8```!4````4P```%(```!1````2@`7
M``$D```!'````1````$,````*@```"8````B````'@```!H````6````$@``R
.``X````*`````````_(,9
``
end
SHAR_EOF
cat << \SHAR_EOF > KeyMap.uu
begin 777 KeyMap
M```#\P`````````!``````````````!Y```#Z0```'DL>0````0H;@$43^__F
M`'P`?ES>C"1(T<!30`P@`"!2R/_Z4D`D`$(R*`!.KO]\0_H!2'`A3J[]V"H`*
M0_H!2$ZN_@Y*@&<``-`F0"`"9P``C%.`9@@,$@`_9P``HD'K``XB2DZN_NPHE
M`&<``*1P#MB`(`]A``#6)$@E?````!D`'$?J`$0B"^2))4$`*"`L`)SEB"!`;
M2J@`!&=J("@`"&=DL*P`I&9>($`B2F$``+H@:P`@(DIP#"+84<C__"5'``XU=
M?``*`!PE1``H)7P````@`"0B2DZN_CA@/"0K``XD0B029S(@:@`*(D\2V&;\U
M$WP`"O__0A$@3V$N8.)!^@"6829@$D'Z`*M\%&$<8`A!^@"U?`IA$B)%3J[^9
M8DZN_W8@!D_O`0!.=4CG,`(L12(L`*!G$"0(2AAF_%.()@B6@DZN_]!,WT`,%
M3G56@`(``/P@0$/H`!0A20`*(H@A1P`.(4<`&$YU3J[^DB!'3J[^@"!'3J[^;
MC$YU9&]S+FQI8G)A<GD`:V5Y;6%P+G)E<V]U<F-E`%5304=%.B!K97EM87`@+
M6VME>6UA<"UN86UE70H`3F\@8V]N<V]L92!H86YD;&5R"@!3<&5C:69I960@;
9:V5Y;6%P(&YO="!L;V%D960*```````#\B!H(
``
end
SHAR_EOF
#	End of shell archive
exit 0