* Re: how to check if xyz-mode is on load path?
2009-03-02 4:48 how to check if xyz-mode is on load path? Xah Lee
@ 2009-03-02 6:08 ` B. T. Raven
2009-03-02 10:03 ` Lennart Borgman
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: B. T. Raven @ 2009-03-02 6:08 UTC (permalink / raw)
To: help-gnu-emacs
Xah Lee wrote:
> how can i check if a package already exists in the load path?
>
> what i want to do is to put a package into autoload, but don't do that
> if that package is already included in user's load path (e.g. either
> the package is included in the emacs version she's got, or she already
> installed it herself).
>
> e.g. pseudo code:
>
> (when
> (not (isPackageInstalledQ "ocaml-mode"))
> (autoload ocaml-mode "~/xahdir/ocaml-mode" )
> )
>
> Thanks
>
> Xah
> ∑ http://xahlee.org/
>
> ☄
C-h v load-path
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: how to check if xyz-mode is on load path?
2009-03-02 4:48 how to check if xyz-mode is on load path? Xah Lee
2009-03-02 6:08 ` B. T. Raven
@ 2009-03-02 10:03 ` Lennart Borgman
2009-03-02 13:12 ` Michael Ekstrand
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Lennart Borgman @ 2009-03-02 10:03 UTC (permalink / raw)
To: Xah Lee; +Cc: help-gnu-emacs
On Mon, Mar 2, 2009 at 5:48 AM, Xah Lee <xahlee@gmail.com> wrote:
> how can i check if a package already exists in the load path?
>
> what i want to do is to put a package into autoload, but don't do that
> if that package is already included in user's load path (e.g. either
> the package is included in the emacs version she's got, or she already
> installed it herself).
>
> e.g. pseudo code:
>
> (when
> (not (isPackageInstalledQ "ocaml-mode"))
> (autoload ocaml-mode "~/xahdir/ocaml-mode" )
> )
locate-library
> Thanks
>
> Xah
> ∑ http://xahlee.org/
>
> ☄
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: how to check if xyz-mode is on load path?
2009-03-02 4:48 how to check if xyz-mode is on load path? Xah Lee
2009-03-02 6:08 ` B. T. Raven
2009-03-02 10:03 ` Lennart Borgman
@ 2009-03-02 13:12 ` Michael Ekstrand
2009-03-02 13:15 ` Alan Mackenzie
2009-03-02 14:25 ` Kevin Rodgers
4 siblings, 0 replies; 6+ messages in thread
From: Michael Ekstrand @ 2009-03-02 13:12 UTC (permalink / raw)
To: help-gnu-emacs
Xah Lee <xahlee@gmail.com> writes:
> how can i check if a package already exists in the load path?
>
> what i want to do is to put a package into autoload, but don't do that
> if that package is already included in user's load path (e.g. either
> the package is included in the emacs version she's got, or she already
> installed it herself).
>
> e.g. pseudo code:
>
> (when
> (not (isPackageInstalledQ "ocaml-mode"))
> (autoload ocaml-mode "~/xahdir/ocaml-mode" )
> )
locate-library will tell you if the library is available on the load
path; it will return a file name or nil. featurep (on the package's
primary provided feature) or fboundp (on some relevant function's
symbol) can be used to test if it has already been loaded.
I would also pair the tests such that locate-library failing results in
the package being added to the load path, and featurep/fboundp results
in loading. The package existing in the load path does not mean it has
been loaded/autoloaded, so just testing with locate-library in your code
above can result in the package not being loaded.
- Michael
--
mouse, n: A device for pointing at the xterm in which you want to type.
Confused by the strange files? I cryptographically sign my messages.
For more information see <http://www.elehack.net/resources/gpg>.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: how to check if xyz-mode is on load path?
2009-03-02 4:48 how to check if xyz-mode is on load path? Xah Lee
` (2 preceding siblings ...)
2009-03-02 13:12 ` Michael Ekstrand
@ 2009-03-02 13:15 ` Alan Mackenzie
2009-03-02 14:25 ` Kevin Rodgers
4 siblings, 0 replies; 6+ messages in thread
From: Alan Mackenzie @ 2009-03-02 13:15 UTC (permalink / raw)
To: help-gnu-emacs
In comp.emacs Xah Lee <xahlee@gmail.com> wrote:
> how can i check if a package already exists in the load path?
M-x locate-library wil do it.
> Thanks
> Xah
--
Alan Mackenzie (Nuremberg, Germany).
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: how to check if xyz-mode is on load path?
2009-03-02 4:48 how to check if xyz-mode is on load path? Xah Lee
` (3 preceding siblings ...)
2009-03-02 13:15 ` Alan Mackenzie
@ 2009-03-02 14:25 ` Kevin Rodgers
4 siblings, 0 replies; 6+ messages in thread
From: Kevin Rodgers @ 2009-03-02 14:25 UTC (permalink / raw)
To: help-gnu-emacs
Xah Lee wrote:
> how can i check if a package already exists in the load path?
>
> what i want to do is to put a package into autoload, but don't do that
> if that package is already included in user's load path (e.g. either
> the package is included in the emacs version she's got, or she already
> installed it herself).
>
> e.g. pseudo code:
>
> (when
> (not (isPackageInstalledQ "ocaml-mode"))
> (autoload ocaml-mode "~/xahdir/ocaml-mode" )
> )
(fboundp 'ocaml-mode)
--
Kevin Rodgers
Denver, Colorado, USA
^ permalink raw reply [flat|nested] 6+ messages in thread