Comment Re:Comment your code (Score 2, Interesting) 590
Put enough comments in your code so that five years from now you (and others) can remember what you indented the code to do.
/* This is hairy. We need to compute where the XEmacs binary was invoked
from because temacs initialization requires it to find the lisp
directories. The code that recomputes the path is guarded by the
restarted flag. There are three possible paths I've found so far
through this:temacs -- When running temacs for basic build stuff, the first main_1
will be the only one invoked. It must compute the path else there
will be a very ugly bomb in startup.el (can't find obvious location
for doc-directory data-directory, etc.).temacs w/ run-temacs on the command line -- This is run to bytecompile
all the out of date dumped lisp. It will execute both of the main_1
calls and the second one must not touch the first computation because
argc/argv are hosed the second time through.xemacs -- Only the second main_1 is executed. The invocation path must
computed but this only matters when running in place or when running
as a login shell.As a bonus for straightening this out, XEmacs can now be run in place
as a login shell. This never used to work.As another bonus, we can now guarantee that
(concat invocation-directory invocation-name) contains the filename
of the XEmacs binary we are running. This can now be used in a
definite test for out of date dumped files. -slb */
OK. So now everyone knows how Lisp programs written with a core in C initialize themselves, right?
And as much as people may joke about it, XEmacs was tested to ensure that it worked as a login shell prior to release.