[comp.emacs] Making a partial version of GNU Emacs

gore@nucsrl.UUCP (Jacob Gore) (06/10/87)

I would like to use emacs (GNU 18.41 is the current version here) as the
editor called from mail and news programs.  I don't wish to wait for emacs to
start up every time, though.

(The following two paragraphs are not gripes, their purpose is simply to
explain why I ask what I ask, and to preempt some replies that I already know.)

I cannot use the mail and news modes because we don't use sendmail and news;
and even if we did, I wouldn't want to use those modes because I don't live in
emacs (not yet, anyway :-).

I am also aware of the server-start/emacsclient setup, but I'm not too crazy
about it either (let's leave it as "personal preference").

So, I'm thinking of making a partial version, which would be smaller at the
expense of all modes and libraries that don't deal with writing electronic
messages.  Has anybody tried something like this?  Any caveats I should be
aware of?

What can I leave out of GNU Emacs but still have it work?  Can emacs-lisp-mode
be omitted?  Can the *scratch* buffer be left out?  Do autoloads in loadup.el
take any space?  Are they worth worrying about?

I better stop before I wear out my '?' key (:-).

Jacob Gore
Northwestern University, Computer Science Research Lab
{gargoyle,ihnp4,chinet}!nucsrl!gore
gore@EECS.NWU.Edu (for now, only from ARPA)

mjp@spice.cs.cmu.edu (Michael Portuesi) (06/11/87)

Keywords:



gore@nucsrl.UUCP (Jacob Gore) writes:

> I would like to use emacs (GNU 18.41 is the current version here) as the
> editor called from mail and news programs.  I don't wish to wait for emacs to
> start up every time, though.
> 
> So, I'm thinking of making a partial version, which would be smaller at the
> expense of all modes and libraries that don't deal with writing electronic
> messages.  Has anybody tried something like this?  Any caveats I should be
> aware of?
> 
> What can I leave out of GNU Emacs but still have it work?

Instead of starting from the top and working down, why not start from
the bottom and work up?  Get a copy of the sources for MicroGnuEmacs
1b.  You can get them from jade.berkeley.edu.  The executable is about
64K on a Vax and 120K on an RT.  It has about 90% of the functions you
use most often in Emacs (at least the ones you would use for typing a
mail message or bboard post) and it starts up almost immediately.

-- 

Mike Portuesi / Carnegie-Mellon University Computer Science Department
ARPA:	mjp@spice.cs.cmu.edu	UUCP: {backbone-site}!spice.cs.cmu.edu!mjp
BITNET:	rainwalker@drycas (a uVax-1 run by CMU Computer Club...tons o' fun)

Amiga hackers do it graphically, with lots of sound effects.
Amiga users do it with their gadgets and proportional sliders.
Aztec will do it, but only if you make it long.
Workbench users would do it, but they need .info first.
CLI users can't do it...they're stuck in their Shell.
Metacomco did it to us with AmigaDOS.

"Mac owners dream in black and white, Atari owners dream in color...
but Amigoids dream using Hold and Modify!"

rlk@.UUCP (06/11/87)

In article <3910010@nucsrl.UUCP> gore@nucsrl.UUCP (Jacob Gore) writes:
]I cannot use the mail and news modes because we don't use sendmail and news;
]and even if we did, I wouldn't want to use those modes because I don't live in
]emacs (not yet, anyway :-).

I think there's a program called fakemail in the etc directory that
simulates sendmail, but I may be wrong.  I would strongly suggest that
you consider one of the emacs interfaces to mail if you're using emacs
heavily, though, since the startup overhead is so great.

]So, I'm thinking of making a partial version, which would be smaller at the
]expense of all modes and libraries that don't deal with writing electronic
]messages.  Has anybody tried something like this?  Any caveats I should be
]aware of?

You can take things out of the distribution, which reduces the size of
the tree, and you can take some of the libraries out (see below), but
you can't do too much to reduce the size of the editor proper.  You
may be able to speed things up somewhat by cleaning up startup.el;
there may be things in there that you don't need or want, such as some
of the more esoteric command line switches.

]What can I leave out of GNU Emacs but still have it work?  Can emacs-lisp-mode
]be omitted?  Can the *scratch* buffer be left out?  Do autoloads in loadup.el
]take any space?  Are they worth worrying about?

The autoloads do indeed take up a fair amount of space, typically
about 120K in the standard system.  If you don't do any programming,
you can delete things like C mode, Lisp mode, etc (you can remove Lisp
mode if you fix up startup.el not to put *scratch* in lisp interaction
mode).  Some of them (like simple, subr, and a fair number of others)
will cause emacs to break if you remove them.  You can also remove
some of the autoloads, but again be careful.  Leave everything in that
refers to commands that you frequently use.

Then you may have to edit config.h to change PURE_LISP_SIZE or
something like that (it starts with PURE) to actually decrease the
size of the dumped emacs.  You'll have to experiment, which means a
number of compile cycles, which may be more work than you care to do,
especially since you won't reduce the size of emacs by all that much
and in any event the initial Lisp code takes a while to run.

Do you have the sticky bit turned on?  If you're the only person who
really uses GNU Emacs on your machine, then depending upon the
particular system you're running, you may get considerably better
startup performance by turning it on.

I'd strongly consider using the server (in another part of your
message you claim not to like it) since it is a small program with
very little startup overhead.  It takes a while to get used to on a
non-window based system, but even with having to suspend your mail or
news program and putting the editor in the foreground (of course, this
assumes you have job control, but since you sound like you're not
running BSD, you may not), it's still a lot faster than waiting for
emacs to start up.  Emacs is really just too big a program to start up
instances of it every time you need to edit something -- the
documentation suggests a style of use in which you start up an emacs
at the beginning of your session and keep it around until you leave.

Finally, check your .emacs file:  how long is it, and can you compile
it?  I came up with a trick to compile all the setq's and top level
conditionals in my .emacs file:  I wrap a defun around them (e. g.
(defun init-rlk () ...)
and compile the file.  I then edit the .elc file and remove the
enclosing defun, putting the (byte-code ...) form at the top level.
This results in noticeable speedup.  Of course, by removing things you
don't need, you can do even better.

Robert^Z