OK.

You want emacs ? You get emacs.

This version of emacs needs MiNT in order to work. I have used it
successfully on MiNT versions ranging from 0.95 -> 1.09.

To minimize the distribution, I only include the sources + some
docs. DO get the original lisp files from the standard emacs-18.59
distribution, as they are a vital part of the complete editor. They
can be found on lots of ftp-sites, including prep.ai.mit.edu
(GNU-site), and ugle.unit.no (NORWAY).
Once more: Get the ORIGINAL lisp-files, not some
"hacked-up-for-the-st" set of lisp-files, and get the ones from the
18.59 distribution.

Now onto installing Emacs.

Hopefully, you just cd to the MiNTemacs directory, hit make, drink some
coffee, come back, and you have a working emacs.

This will probably not happen. *So* much can go wrong on the way. Like, the
disk gets full, you run out of memory (you probably need atleast 8 megs to
do an optimized compile by running the initial makefile - which in turn
runs up to two other make-processes), etc. etc.

If you *do* get a working xemacs by just typing "make"; Let me hear about
it !!!!

Look in src/s-atari.h to select which libraries to link, what optimization
to use, and other compile options. Touch config.h, and hit make. This will
generate a new xmakefile. Do keep a backup of the supplied xmakefile
though, as you might not have all the utilities needed to generate a new
one.  (/bin/sh, sed, a gcc-cpp that does not grab all available memory)

Look in paths.h to define the hard-coded paths. (to lisp, doc etc. dirs)

temacs is the emacs without the lisp files loaded.
xemacs is the dumped executable. 
Read about dumping later on.

Put xemacs into some bin-directory mentioned in your PATH environment
variable. If you do not know what PATH and environment are, this
software probably is not for you anyway... :-/

If you are not using TOSWIN or MINIWIN to run TOS-applications, you will
also have to set an environment variable to define your terminal
capabilities. For a standard ST, this means defining the following
variables:

	TERM=vt52
	TERMCAP=/etc/termcap (or wherever you keep your termcap file)

Note the Un*x style of path-description !
If you keep your termcap file in "f:\foo\bull\cheese\termcap", you can
either put:

	sln f:\foo\bull\cheese u:\etc
	setenv TERM vt52
	setenv TERMCAP /etc/termcap

in your mint.cnf file, or you can say just:

	setenv TERM vt52
	setenv TERMCAP /f/foo/bull/cheese/termcap

If you want to have a default startup-file, emacs looks for the file
".emacs" in your home-directory.

The lisp files are hardcoded to be in /usr/local/emacs/lisp The
executable files and doc-files that emacs uses (wakeup, yow, ..., DOC,
DOC-18.59.x) are hardcoded to be in /usr/local/emacs/etc.

If you have trouble with placing the files in this location on your
hard-disk, you can define the environmentvariables:

	EMACSLOADPATH	The lisp files.
	EMACS_EXECPATH	The executable/documentation files.
	
I recommend using a minix filesystem, to allow for long filenames. I
would also recommend a unix-style directory structure, but this is
of course not necessary.

To sum things up;
Lets say you have your binaries in c:\mint\bin, and e:\gnu\bin
		       lisp-files in f:\emacs\lisp
		       emacs documentation in f:\emacs\docs
		       emacs init file in c:\home\Charles
		       termcap file in g:\funny\stuff\div

add this to your mint.cnf file:

	sln c:\mint u:\mint
	sln c:\home u:\home
	sln c:\gnu u:\gnu
	sln g:\funny\stuff\div u:\etc
	sln f:\emacs u:\emacs

	setenv UNIXMODE b
	setenv PATH :/mint/bin:/gnu/bin
	setenv HOME /home/Charles
	setenv TERM vt52
	setenv TERMCAP /etc/termcap
	setenv EMACSLOADPATH /emacs/lisp
	setenv EMACS_EXECPATH /emacs/docs

	cd u:\

Use the U: filesystem ! It makes things _so_ much easier.

----------------------------------------

Hints/Tips/Problem-fixes:

Problem:
	Emacs does not find its' files.
Fix:
	You have set your environment wrong. Fix it.
	You do not start emacs from the U: drive. Try it, and see if
	it helps.

Problem:
	You see lots of ^M's after every line that is output in the
	*shell* buffer or in *compile* buffers.
Fix:
	Use UNIXMODE=b, as this makes all programs open all files as
	binary files, this will prevent output of excessive Carriage
	Returns.

Problem:
	Emacs won't start, because it complains about:
	"This terminal is not powerful enough to support Emacs,
	 it lacks the ability to position the cursor"
Fix:
	Your termcap file is corrupted, probably because you have
	edited it with an editor that inserts carriage returns after
	every line. Use a program like "tos2unix" or "nukecr" or "crlf"
	whatever to remove the carriage returns from the termcap file.

Problem:
	The cursor keys won't work.
Fix:
	Use the xkey program from the mintutils to redefine the cursors.
Or:
	Use Toswin with a emacs.mnu file that redefines the cursor
	keys.

Problem:
	Emacs can't find its' init file, even if your HOME environment
	variable is correctly set.
Fix:
	Try to setup a passwd file in u:\etc (if you don't already
	have one) with the correct path to your home directory.
	Eg. if you don't use the init-package, make a passwd file with
	one line that looks like this:

Charles::0:0:Charles Prince:/home/Charles:/bin/sh
^				^
login name                   	|--This is the
     Password (empty)  	        |--important part... 
	 user id		|                    
	   group Id		|                    
	     Your Name     	|
			  Your home directory
					  Your login shell		


----------Dumping a new xemacs----------

To do this you 
	- HAVE to have installed the lisp files.
	- HAVE to use a shell with support for job-control
	  (Eg. tcsh, bash-1.12, ash)

From your shell:

	temacs -batch -l loadup.el dump

If you should run out of memory during this process, try setting the
stacksize on temacs to something less than 1024k (which it is by
default). Use the "fixstk" program from the utils directory.
To set temacs to a stack-size of 512k:

	fixstk -512k temacs.

If it went ok this time, you should have produced an xemacs file.
rename this to xemacs.1

Then start a new shell (Yes, you need two shells running at once)
From this shell:

	temacs -batch -l loadup.el dump

This produces (surprise) another xemacs file.
rename this to xemacs.2
exit the second shell
Then use the "dumpfix" command from the utils directory with the
command:

	dumpfix -n xemacs.1 xemacs.2 xemacs

This produces the final (almost usable) xemacs.
You can now remove xemacs.1 and xemacs.2

Then you have to decide for a reasonable stack-size for xemacs.
I use a stack size of 1500k, which allows for editing approx. this
much of data. If you do not have lotsa memory, use 512k. Less than
this is not recommended, as emacs does *not* like to run out of
memory.

To set the stacksize, use the "fixstk" program from the utils
directory.
To set the stack to 512k, issue the command:
	fixstk -512k xemacs

You should now have a runnable emacs.

----------------------------------------

For those with a curious mind, the reason for the dumping procedure is
explained briefly here.

Emacs is partly written in C, and partly written in Lisp. The part of
Emacs that is pure c, is the temacs executable. This by itself is not
very usable, but it includes the lisp-interpreter. To load in the lisp
parts of emacs, you give the argument "-l loadup.el" to temacs. Thus,
you can in fact start a fully working emacs with the command

	temacs -l loadup.el

Try it.

Now this took quite some time, right ?

To avoid having to interpret all these lisp files every time you start
emacs, how about just loading in the lisp files once, then copy the
memory contents of the running program to disk. Now if you could just
load in that image, you would not have to interpret all those lisp
files every time. This is what the dumping is all about, the
command "dump", tells temacs to dump its memory contents to disk after
it has interpreted the startup files.

Right.

But why o' why do we have to do this twice ???

Well, on real Un*x boxes you don't, this is a MiNT/TOS peculiarity.
It stems from the fact that TOS rarely loads a program into the same
memory-location, thus it has to know which data is fixed related to
the start address. In order to find this out, two images are dumped
with different start-addresses (which is why you must run two shells).
Then these two images are compared, and a table of addresses which must
be relocated in the final emacs is produced. (the dumpfix program does this).

Clear as mud.

----------------------------------------

Thanx go to all those that have contributed to this ST version of emacs.
(well, they probably don't even know it themselves, I have ripped out
some code from older TOS versions of emacs)

Especially:
	sjk : for the unexec code.
	      Sorry, I have lost all the original readme files, and
	      "sjk" is all that is said in the "unexec.c" file.
	J.R.Dunning from his port of Emacs 18.55
	Frank Ridderbusch for the dumpfix program
	Bammi for his GCC efforts
	Eric Smith for MiNT and the C-libraries
	Everybody else that has contributed to the great library of
	free programs for the Atari !

----------------------------------------

Problems ?
Feel free to contact me at:
	erlingh@pvv.unit.no (email)
or
	Erling Henanger
	Vestaglott 4
	1719 Greaaker
	Norway		(snail-mail)


