[gnu.emacs] Setting load-path

mgkelley@bbn.com (Matthew G. Kelley) (11/09/88)

Dave Sill writes:
>Why doesn't the following command work:
>(setq load-path '("/local/dev/src/18.52/lisp" "/ef80/dsill/lib"))
>
>It's in ~/.emacsrc, and I invoke Emacs as "emacs -l ~/.emacsrc".  The
>rest of the commands in .emacsrc are executed, and if I manually load
>.emacsrc everything seems to work right.

I don't have an answer, but I have found similar behavior in a number
of other situations.  As one example, if I have the line:

(text-mode)

in my .emacs file, then when I start up Emacs, the initial buffer is in
initial-major-mode, not text-mode.  But, if I do a

M-x load-file .emacs

after I'm already in Emacs, then the buffer is put into text-mode as
expected.

Another point of interest is that the characteristic I want is in effect
_during_ the loading, but then reverts to the previous state after the
loading is finished. (I.e., the code in my .emacs file sees text-mode,
not initial-major-mode).

So, can anyone enlighten me as to the logic of all this (if there is any)?

gildea@ALEXANDER.BBN.COM (Stephen Gildea) (11/22/88)

There are some initializations that are done after the .emacs file is
read.  These include terminal-dependent initializations and creating
the *scratch* buffer.  This is why the form (text-mode) seems to have
no effect in a .emacs file.  See the function command-line in
lisp/startup.el for details.

The original question, from Dave Sill, why setting load-path in a file
loaded with the -load command-line option doesn't work, seems to point
to a bug in Emacs.  During the loading of a file with -load, the
variable load-path is locally bound, thus any attempt to set it from
the loaded file will be undone as soon as the file is finished
loading.

 < Stephen