[comp.sources.bugs] Quick fix for entab in me9.e and f-keys for unsupported codes

mj@myrias.UUCP (Michal Jaegermann) (12/07/87)

   Version 3.9e has a bug in entab() function (file "random.c") which
does not like lines containing both tabs and spaces.  This bug is
actually marked by a comment in the code.  A fix is simple.  From 
a code for "detab()" grab a loop which walks through a line and
replaces tabs with blanks.  Insert it before an "entabing" loop.
Do NOT advance to the next line and perform "detabing loop" as given.
From the code below you may comment out lines which deal with tabs
in your line, since at this point there are not there.
This seems to work without any problems.

   The second bit is for people which have keyboards with function keys,
but which do not return codes in a way expected by MicroEMACS.
In particular,  my Sun3(TM) keyboard sends sequences which look
like "ESC-2XYz", where X and Y stand for decimal digits characters
and numbers "XY" start from "08".   In this this case you may do the
following:
   - In an appriopriate place (inside "getcmd" code is a good one)
     put the following lines:
#define SUN3    1

#if SUN3
	static char sunfunc[] = "EFGHIJKALDMCNBOP123456789";
#endif

   - Define symbol VT100 as 1
   - Change a piece of code for a function getcmd() (file "input.c")
     to read as follows

#if	VT100
	/* if ESC must be recognized.... change this to a 1 */
	if (c == metac || c == (CTRL | '[')) {
#else
	if (c == metac) {
#endif
		c = get1key();
		if (islower(c))		/* Force to upper */
			c ^= DIFCASE;
		if (c>=0x00 && c<=0x1F)		/* control key */
			c = CTRL | (c+'@');
#if	VT100
		if (c == '[' || c == 'O') {
			c = get1key();
#if	SUN3	  /* here comes the sun */
			if (c == '2') {
				c = (get1key() - '0') * 10;
				c += (get1key() -'8');
				get1key(); /* eat terminating 'z' */
				c = (int) sunfunc[c];
			}
#endif
			return(SPEC | c);
		}
#endif

   Now you have over 20 functions keys, which you may bind as you please.
Modify if you need to. Check with "describe-key" which key returns what.
   Enjoy!

Michal Jaegermann
Myrias Research Corporation
Edmonton, Alberta, Canada
...ihnp4!alberta!myrias!mj