[comp.emacs] load-path

meissner@osf.org (07/06/90)

| I have been recently compiling up GNU emacs 18.55 and have run into a bit of a
| problem with the load-path variable.  The default load-path on our system is
| "/usr/local/emacs/lisp".  I would like to ADD to the list "/usr/local/lisp".
| 
| I tried setting it in "site-init.el" when compiling.  I used:
| 
| (setq load-path (append (list "/usr/local/lisp") load-path))
| 
| This had NO EFFECT.  When I fired up the new emacs and checked to see what my
| load-path was is only showed "/usr/local/emacs/lisp".  Putting the 'setq'
| statement into the default.el helps, but if someone needs that path for things
| in their ~/.emacs file, it causes an init file error (and rightfully so).  

I believe this is due to the way emacs dumps itself.

| Is there an easy way to insure that everyone has a particular load-path when
| starting up.  If they change it in their ".emacs", then that's their problem,
| but I would like to guarantee that they have the 2 mentioned paths in their
| load-path on startup.  

What I've done in the past is modify the PATH_LOADSEARCH define in
src/paths.h to have all of the directories you wish to seach,
separated by colons, ie:

	#define PATH_LOADSEARCH "/usr/local/emacs/lisp:/usr/local/lisp"

This works because src/lread.c has the following code:

	init_read ()
	{
	  char *normal = PATH_LOADSEARCH;
	  Lisp_Object normal_path;

	  /* Warn if dirs in the *standard* path don't exist.  */
	  normal_path = decode_env_path ("", normal);

decode_env_path breaks a PATH-type environment variable into a CONS
list....

--
Michael Meissner	email: meissner@osf.org		phone: 617-621-8861
Open Software Foundation, 11 Cambridge Center, Cambridge, MA

Do apple growers tell their kids money doesn't grow on bushes?

kim@spock (Kim Letkeman) (07/07/90)

I didn't see the original article, and the reply in which I saw this
question did not post an attribution, so I'm hoping the original
poster is still looking for the answer.

| I have been recently compiling up GNU emacs 18.55 and have run into a bit of a
| problem with the load-path variable.  The default load-path on our system is
| "/usr/local/emacs/lisp".  I would like to ADD to the list "/usr/local/lisp".
| 
| I tried setting it in "site-init.el" when compiling.  I used:
| 
| (setq load-path (append (list "/usr/local/lisp") load-path))
| 
| This had NO EFFECT.  When I fired up the new emacs and checked to see what my
| load-path was is only showed "/usr/local/emacs/lisp".  Putting the 'setq'
| statement into the default.el helps, but if someone needs that path for things
| in their ~/.emacs file, it causes an init file error (and rightfully so).  

I am certain that there is some standard way to have a local lisp
directory on the emacs path without resorting to the emacs load path
environment variable. But the following change to your original setq
on load-path works for me to add my local directory to the emacs path.
Note the addition of the append in front of load-path.

(setq load-path (append (list (expand-file-name "~kim/elisp")) 
			(append load-path)))

Kim


-- 
Kim Letkeman    mitel!spock!kim@uunet.uu.net

tale@cs.rpi.edu (David C Lawrence) (07/10/90)

In article <3829@kim> kim@spock (Kim Letkeman) writes:
> Note the addition of the append in front of load-path.

> (setq load-path (append (list (expand-file-name "~kim/elisp")) 
>                         (append load-path)))

A little wasteful as lisp.  Try:

(setq load-path (cons (expand-file-name "~kim/elisp") load-path))

One cons is much more efficient than two appends and a list, but it is
probably insignificant to you as a whole.  Just picking nits for what
most lispers I know would call better code.
-- 
   (setq mail '("tale@cs.rpi.edu" "tale@ai.mit.edu" "tale@rpitsmts.bitnet"))