[comp.emacs] appending to load-path

avi@bu-pub.bu.edu (Avram Weiss) (02/17/91)

I want to add a directory onto the existing load-path. so I have the
following entry in my .emacs file:

(append load-path (list "/usr2/guest/avi/elisp"))

I then "eval" the variable "load-path" and the load-path has not changed.

I then switch to buffer *scratch* and enter the same command and presto,
the load-path is now changed.

Does anybody know why the "append" is not working in the .emacs file?

responses can be e-mailed to avi@bass.bu.edu

-avi avi@bass.bu.edu

crew@CS.Stanford.EDU (Roger Crew) (02/17/91)

In article <74918@bu.edu.bu.edu> avi@bu-pub.bu.edu (Avram Weiss) writes:
> 
> I want to add a directory onto the existing load-path. so I have the
> following entry in my .emacs file:
> 
> (append load-path (list "/usr2/guest/avi/elisp"))
> 
should be 

    (setq load-path (append load-path (list "/usr2/guest/avi/elisp")))

though perhaps you want your files to take precedence over the
standard distribution ones, in which case it should be

    (setq load-path (cons "/usr2/guest/avi/elisp" load-path))

--
Roger Crew                                        ``I kill Optimax...''
Usenet:    {arpa gateways, decwrl, uunet, rutgers}!cs.stanford.edu!crew
Internet:  crew@CS.Stanford.EDU

allen@NERD.SSC.GOV (Mike Allen) (02/26/91)

>> (append load-path (list "/usr2/guest/avi/elisp"))
This returns the result of append'ing (list ...) to load-path, but
does not change the value of load-path, do:
(setq load-path (append load-path (list "/usr2/guest/avi/elisp")))

-Mike

eric@AI.MIT.EDU (Eric Hanchrow) (02/27/91)

   (append load-path (list "/usr2/guest/avi/elisp"))

   I then "eval" the variable "load-path" and the load-path has not changed.
That's because `append' does not modify its argument.  In fact, only a
few ELisp functions modify their arguments -- the only one I can think
of that does is `setq'.

Here's what I do:
	(setq load-path
	      (cons (expand-file-name "~eric/elisp")
	       (cons (expand-file-name "~eric/elisp/gnus") load-path))) 
       ------------------------------------------------------------------------
       |Eric Hanchrow		sun.com!nosun!yamada-sun!eric		      |
       |Phase III Logic, Inc.	cse.ogi.edu!yamada-sun!eric		      |
       |1600 N.W. 167th Place		Beaverton, OR 97006-4800 USA	      |
       |Voice: (503)-645-0313		Fax: (503)-645-0207     as of 4-Oct-89|
       --------------Crackling-noises-OK--do-not-correct!----------------------

david@WUBIOS.WUSTL.EDU (David J. Camp) (02/27/91)

In Reply to this Note From: <Avram Weiss>
>
>I want to add a directory onto the existing load-path. so I have the
>following entry in my .emacs file:
>
>(append load-path (list "/usr2/guest/avi/elisp"))

Here is what I use.  -David-

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

# david@wubios.wustl.edu             ^     Mr. David J. Camp            #
# david%wubios@wugate.wustl.edu    < * >   +1 314 382 0584              #
# ...!uunet!wugate!wubios!david      v     "God loves material things." #
# abs (investment#1 - investment#2) << abs (anyinvestment - anydebt)    #