[comp.sys.next] Alternate as a Meta key in emacs??

ed@pnl-geo.UUCP ( Ed Kleckner ) (02/23/90)

I am sure that this has been discussed in the early days of this
group, but having just gotten a NeXT machine and not having read all
the previous discussions I have a simple (I hope) question:

How does one configure emacs to use the Alternate key as a meta-key?

Please reply either to the group or to:

ed%imp@pnlg.pnl.gov is using Internet.

Thanks.

jasmerb@mist.cs.orst.edu (Bryce Jasmer) (02/25/90)

In article <1990Feb25.001112.17746@athena.mit.edu> erikkay@podge.MIT.EDU (Erik Kay) writes:
>>   How does one configure emacs to use the Alternate key as a meta-key?
>I'd appreicate some info on this as well.  Also, is there a way to define
>the arrow keys as:
>
>left: ^b
>right: ^f
>up: ^p
>down: ^n

I'm not sure I understand what you want Erik. The way that Emacs comes on
a NeXT is set so that the arrow keys (ESC O A, ESC O B, ESC O C, and ESC O D)
are bound to go up a line, down a line, right a character, and left a
character by default. I don't think it is possible to make the arrow keys
generate a ^b, ^f, ^p, or ^n.

I have rebound the up and down arrow keys to do something else because I
rarely reach for the arrow keys to move around (arrow keys are for wimps :-)
You can do this by doing a "M-x global-set-key RET ESC O B shrink-window"
or something like that (where M-x means Meta x or ESC x and RET means 
hitting the return key.)

To do this in your .emacs file you should have a line like this:
(define-key global-map "\M-OB" 'shrink-window)

As for using the Alternate key for Meta, I know nothing about it. Sorry.

Bryce Jasmer
jasmerb@cs.orst.edu

erikkay@podge.MIT.EDU (Erik Kay) (02/25/90)

In article <23460001@pnl-geo.UUCP> ed@pnl-geo.UUCP ( Ed Kleckner ) writes:
>   I am sure that this has been discussed in the early days of this
>   group, but having just gotten a NeXT machine and not having read all
>   the previous discussions I have a simple (I hope) question:
>
>   How does one configure emacs to use the Alternate key as a meta-key?



I'd appreicate some info on this as well.  Also, is there a way to define
the arrow keys as:

left: ^b
right: ^f
up: ^p
down: ^n


???


Thanks in advance...


Erik Kay
Massasschusetts Institute of Technology
Class of '92

erikkay@athena.mit.edu

grd@portia.Stanford.EDU (Glendon Diener) (02/25/90)

(setq meta-flag t) in .emacs will make 'command' into 'meta'

lacsap@mit-amt.MEDIA.MIT.EDU (Pascal Chesnais) (02/25/90)

In article <9523@portia.Stanford.EDU> grd@portia.Stanford.EDU (Glen Diener) writes:
>
>(setq meta-flag t) in .emacs will make 'command' into 'meta'


but user beware! command-Q still quits out of terminal, rather than do
M-Q.  Also you can enable the eighth bit over the net by using the -8
flag on rlogin(1).  So you can use your meta (command) key on foreign
machines.

Still on the emacs thread, has anyone forked out the $150 dollars for
the GNU sources, and if so can they make them available via anonymous ftp?
At the very least the next specific stuff needed to build emacs.  I'd like
to get X support running on my emacs.

pasc
-- 
Pascal Chesnais, Research Specialist, Electronic Publishing Group
Media Laboratory, E15-348, 20 Ames Street, Cambridge, Ma, 02139 (617) 253-0311
NeXTmail: lacsap@plethora.media.mit.edu

morrison@cs.ubc.ca (Rick Morrison) (02/26/90)

In article <1702@mit-amt.MEDIA.MIT.EDU> lacsap@media-lab.media.mit.edu (Pascal Chesnais) writes:
> ...
>Still on the emacs thread, has anyone forked out the $150 dollars for
>the GNU sources, and if so can they make them available via anonymous ftp?
>At the very least the next specific stuff needed to build emacs.  I'd like
>to get X support running on my emacs.
>
So would I. For those who can't imagine why some of us emacs users are
willing to go to these lengths rather than use emacs in a Terminal,
here are my pet peeves with NeXTStep (which I judiciously submitted
on the user feedback form way back in Release 0.8):

1) Terminal is a (sort of) VT100. If I wanted to use emacs on
   a VT100 I would have bought one. With (left and right) ALT, COMMAND
   and what-have-you, I should be able to keybind myself into oblivion.
   
2) The mouse is dead in Terminal. Under X you can put the cursor where
   you point, scroll, cut-and-paste, etc, etc.

3) I hate click-to-type.

4) Under X, applications, including emacs, may be run on faster machines also
   running X. If there were other machines supporting NeXTStep, this wouldn't
   be an issue. And I don't mean IBMs running EI-AI-X.

So, I have a request:

NeXT release a decent Terminal app and extensions which support emacs
as does X.

and an observation:

It would be in NeXT's best interest to develop the "NeXTStep client side" for
other platforms -- Sun, HP/Apollo, SGI, Mips (coincidentally, just the
stable of machines we have here at UBC:-). Then, at least one half of the
standard objection: "Why develop software for a proprietary window system
with a small installed base?" would be removed.

Of course, NeXT could take a really bold step and release the whole thing
to the public domain, as Sun (sort of) did with NFS. Or is it already too
late? Are we really going to be stuck with X windows for the next 10 years?
-----------------------
Rick Morrison		 | {alberta,uw-beaver,uunet}!ubc-cs!morrison
Dept. of Computer Science| morrison@cs.ubc.ca
Univ. of British Columbia| morrison%ubc.csnet@csnet-relay.arpa
Vancouver, B.C. V6T 1W5  | morrison@ubc.csnet (ubc-csgrads=128.189.97.20)
(604) 228-5010

base?"

chari@nueces.cactus.org (Chris Whatley) (02/26/90)

morrison@cs.ubc.ca (Rick Morrison) writes:

>It would be in NeXT's best interest to develop the "NeXTStep client side" for
>other platforms -- Sun, HP/Apollo, SGI, Mips (coincidentally, just the
>stable of machines we have here at UBC:-). Then, at least one half of the
>standard objection: "Why develop software for a proprietary window system
>with a small installed base?" would be removed.

There is support for non-NeXT machines to connect to the window server
via TCP/IP (vs. the standard method by Mach messages). It is the NSWSd
daemon. So, my point is, it wouldn't be that hard to write NeXTStep
code for an SGI or a Sun (especially after the Objective-C mods to GNU
get spread around a bit more).

>Of course, NeXT could take a really bold step and release the whole thing
>to the public domain, as Sun (sort of) did with NFS. Or is it already too
>late? Are we really going to be stuck with X windows for the next 10 years?

Yeah, sure. I can just hear Jobs saying...

	Well, we made IBM pay over $10 million fit but hey, we'll
	give it to everybody else for free!

I think it is too late. But, with the recent (very nice) release of X,
I think that we can look forward to a positive future for X.


-- 
Christopher M. Whatley
Research Systems Administrator - University of Texas Mathematics
Work: chari@math.utexas.edu (preferably not NeXT Mail) (512/471-7711)
Home: chari@nueces.cactus.org (NeXT Mail)	      (512/499-0475)

jgm@fed.expres.cs.cmu.edu (John G. Myers) (02/27/90)

Anonymous-ftp to fed.expres.cs.cmu.edu and grab the file
"next/Emacs0.5.tar".

The program is far from finished, but it is usable.  The mouse support
is still under development.  I haven't even started writing the
cutbuffer support.

There is a bug in that if the window is moved horizontally, the cursor
will not display properly and will leave garbage as it moves around
the screen.  I believe this to be a display server bug and have
reported it to NeXT as such.
--
_.John G. Myers		Internet: jgm@fed.expres.cs.cmu.edu
(412) 268-2984		LoseNet:  ...!seismo!ihnp4!wiscvm.wisc.edu!give!up

mic@ut-emx.UUCP (Mic Kaczmarczik) (02/27/90)

In article <1702@mit-amt.MEDIA.MIT.EDU> lacsap@media-lab.media.mit.edu (Pascal Chesnais) writes:
>In article <9523@portia.Stanford.EDU> grd@portia.Stanford.EDU (Glen Diener) writes:
>>
>>(setq meta-flag t) in .emacs will make 'command' into 'meta'
>
>
>but user beware! command-Q still quits out of terminal, rather than do
>M-Q.

Indeed it does.  Unless you make a copy of Terminal, then compile and
run the following little hack on it. I wrote it after having lost many
a mail message because I tried to reformat a paragraph with M-Q.

Like all patches, there's no guarantee it will work under the next
release of the operating system.  I think a better approach in the
long run is to let users turn off key equivalents if they want.
Anybody at NeXT listening out there? 

Finally, a disclaimer: this patch is not sanctioned, condoned, or
otherwise recognized by NeXT.  Don't run it on your release copy of
Terminal; do it on a private copy. 

Have fun,

Mic Kaczmarczik                                   mic@emx.utexas.edu (Internet)
Unix/VMS/Cyber Services                                     mic@utaivc (BITNET)
UT Austin Computation Center                ...!cs.utexas.edu!ut-emx!mic (UUCP)
``Good tea.  Nice house.'' -- Worf

----------------------------------CUT HERE-------------------------------------
/*
 * Name:
 * 	patchterm 1.0 (for the 1.0 NeXT system software release)
 *
 * Description:
 *	This program removes the key equivalents from the NeXT Terminal
 *	application, so typing M-q while editing in Emacs will not cause
 *	the Terminal app to quit unexpectedly!
 *
 * Usage:
 *	cc -o patchterm patchterm.c
 *	cp /NextApps/Terminal ~/Apps/Terminal
 *	./patchterm ~/Apps/Terminal
 *
 * Perpetrated by:
 *
 *	Mic Kaczmarczik
 *	Unix/VMS/Cyber Services
 *	UT Austin Computation Center
 *	mic@emx.utexas.edu
 *
 * Comments:
 *
 * Don't ask me how I found these offsets; suffice it to say that when adb
 * isn't available, sometimes GNU Emacs does more than edit source code :-)
 * The magic constants used below are actually the 68000-series instructions
 *	lea	@#0x68
 * and
 *	lea	@#0x71
 *
 * which have the effect of pushing the character constants 'h' and 'q' on
 * the stack, respectively, while invoking the methods that set up the
 * Terminal app's menu items. That's a pretty nifty thing for a compiler
 * to do...  Patching the instructions to set the address to 0, e.g.
 *	lea	@#0x00
 *
 * disables the menu button cells' key equivalent, and makes me much happier
 * with the cube I use. :-) :-)
 */

#include <stdio.h>

#define HIDE_OFFSET	5976
#define	HIDE_BEFORE	0x48780068
#define HIDE_AFTER	0x48780000

#define QUIT_OFFSET	6012
#define QUIT_BEFORE	0x48780071
#define QUIT_AFTER	0x48780000

#define PRINT_OFFSET	5952
#define PRINT_BEFORE	0x48780070
#define PRINT_AFTER	0x48780000

char *progname;

main(argc, argv)
int argc;
char *argv[];
{

	FILE	*f;

	progname = argv[0];

	if (argc != 2) {
		fprintf(stderr,"usage: %s 1.0-Terminal-binary\n", progname);
		exit(1);
	}

	if ((f = fopen(argv[1], "r+")) == NULL) {
		fprintf(stderr,"%s: can't open %s for writing\n",
			progname, argv[1]);
		exit(1);
	}

	patch(f, PRINT_OFFSET, PRINT_BEFORE, PRINT_AFTER);
	patch(f, HIDE_OFFSET, HIDE_BEFORE, HIDE_AFTER);
	patch(f, QUIT_OFFSET, QUIT_BEFORE, QUIT_AFTER);

	fclose(f);
	printf("%s patched successfully.\n", argv[1]);
	exit(0);
}

patch(f, offset, before, after)
FILE *f;
long offset, before, after;
{
	long inst;

	if (fseek(f, offset, 0)) {
		fprintf(stderr,"%s: can't seek to position %x, aborting\n",
			progname, offset);
		exit(1);
	}
	fread(&inst, sizeof(inst), 1, f);

	if (inst == after) { /* patched already ? */
		fprintf(stderr,"%s: position 0x%lx is patched already.\n",
			progname, offset);
		return;
	}

	if (inst != before) { /* better not do anything in this case */
		fprintf(stderr,"%s: position 0x%lx should be %x, is %x.\n\
Make sure this is really a copy of the 1.0 release Terminal app.\n",
			progname, offset, inst, before);
		exit(1);
	}

	fseek(f, offset, 0);
	fwrite(&after, sizeof(after), 1, f);
}

-- 
Mic Kaczmarczik                                   mic@emx.utexas.edu (Internet)
Unix/VMS/Cyber Services                                     mic@utaivc (BITNET)
UT Austin Computation Center                ...!cs.utexas.edu!ut-emx!mic (UUCP)
``Good tea.  Nice house.'' -- Worf

Please direct consulting questions to gripe@{emx,ix2,ccwf,iv1} as appropriate.