[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: test for presence of library
From: |
Drew Adams |
Subject: |
RE: test for presence of library |
Date: |
Sun, 21 Feb 2010 12:50:51 -0800 |
> (when (locate-library "some-library")
> (require 'some-library)
>
> Why not use the NOERROR argument to require? Because it
> doesn't exist in the XEmacs version of require, and although
> I don't use XEmacs a lot, it's nice to keep my initialization
> file compatible between the two versions.
Remember also that you can use `condition-case' to ignore errors:
(condition-case nil (require 'foo) (error nil))
Like (require 'foo nil t), that returns nil in case of error:
(when (condition-case nil (require 'foo) (error nil))
(code-that-needs-library-foo))