help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [External] : Re: Locating file via load-path


From: Heime
Subject: RE: [External] : Re: Locating file via load-path
Date: Thu, 08 Aug 2024 21:59:25 +0000

On Friday, August 9th, 2024 at 9:25 AM, Drew Adams <drew.adams@oracle.com> 
wrote:

> > On Friday, August 9th, 2024 at 7:51 AM, Drew Adams wrote:
> > 
> > > > a test is made, so it is added if required
> > > > 
> > > > (if (locate-file "tema.el" load-path)
> > > > (require 'tema)
> > > 
> > > (require 'tema nil t)
> > > loads it if available, and returns nil otherwise.
> > > 
> > > > (progn
> > > > (add-to-list 'load-path tema-path)
> > > > (require 'tema)))
> > > 
> > > You might as well just add it to `load-path'
> > > unconditionally, unless it's already there:
> > > 
> > > (cl-pushnew tema load-path)
> 
> 
> (I meant tema-path, not tema.)
> 
> > That would be a good thing.
> > 
> > (add-to-list 'load-path tema-path) should add tema-path only if it isn't
> > there yet. Why cl-pushnew ?
> 
> 
> Either is OK. The doc of `add-to-list' says: you are usually better off 
> using` push' or `cl-pushnew'. It doesn't say why, and neither does the Elisp 
> manual. Some people get confused over the args to` add-to-list',
> in particular, that it's a function, so it evaluates its
> args, so if you want to provide a variable literally
> then you need to quote it.

Are you referring to quoting LIST-VAR ? add-to-list expects the first 
argument to be the symbol of a list variable, not the list itself.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]