[comp.emacs] a question on load-path

admin@cs.exeter.ac.uk (System Administrator) (03/07/89)

Is it possible to have more than 1 directory in the emacs load-path? 

I know that I can use the environment variable EMACSLOADPATH and also
put a lisp code in my .emacs file.  I would like to know if I can make
the default load-path to have more than 1 directory.  

I have tried putting

	(setq load-path (cons "/u2/misc/admin/elib" load-path))

in the site-init.el, but this does not get passed on when temacs is
dumped into xemacs.

I am using gnu emacs 18.51

Please email replies.

rk@lexicon.com (Bob Kukura) (03/09/89)

In article <14115.8903061754@expya.cs.exeter.ac.uk> admin@cs.exeter.ac.uk (System Administrator) writes:

> Is it possible to have more than 1 directory in the emacs load-path? 
> 

Yes.

> I know that I can use the environment variable EMACSLOADPATH and also
> put a lisp code in my .emacs file.  I would like to know if I can make
> the default load-path to have more than 1 directory.  
> 
> I have tried putting
> 
> 	(setq load-path (cons "/u2/misc/admin/elib" load-path))
> 
> in the site-init.el, but this does not get passed on when temacs is
> dumped into xemacs.

Edit your src/paths.h file in your emacs distribution like this:

#define PATH_LOADSEARCH "/usr/local/src/gnu/dist-18.53/lisp:/usr/local/src/gnu/emacs-lisp"

This, and EMACSLOADPATH, are interpreted just like PATH environment
variable strings, with each path separated by a colon.  They are read
as emacs starts up and are converted into the load-path lisp object,
which is a list.

> I am using gnu emacs 18.51

I've only tried this on 18.53

> Please email replies.

I had a helluva time trying to find out how to do this too, so I
thought others might be interested.  I finally found a function called
decode_env_path in src/emacs.c.
-- 
-Bob Kukura		smart: rk@lexicon.com
			dumb: {husc6,linus,harvard,bbn}!spdcc!lexicon!rk
			phone: (617) 891-6790

admin@cs.exeter.ac.uk (System Administrator) (03/09/89)

> Is it possible to have more than 1 directory in the emacs load-path? 
> I know that I can use the environment variable EMACSLOADPATH and also
> put a lisp code in my .emacs file.  I would like to know if I can make
> the default load-path to have more than 1 directory.  

Thanks to all the people who answered to this query.  Just incase
others may be interested here is a summary

I can append to the load-path in default.el file (residing in the emacs
lisp directory).  This is not entrily satisfactory since default.el
gets loaded after the .emacs file and it can also be inhibited by
starting emacs with -q option.

The best solution was to add the 2nd directory path to PATH_LOADSEARCH
in the paths.h file and rebuild emacs.  Where each directory is
seperated by a `:' e.g.

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

sets the default load-path  for all emacs users to be 

	/usr/local/lib/emacs/local

and

	/usr/local/lib/emacs/lisp

--
Khalid Sattar			JANET: admin@uk.ac.exeter.cs 
Computer Science Dept.		UUCP:  ukc!expya!admin
University of Exeter