In Lisp, Avoid "Cannot open load file" when using require

Posted by Jesse on Stack Overflow See other posts from Stack Overflow or by Jesse
Published on 2010-05-12T03:52:58Z Indexed on 2010/05/12 4:24 UTC
Read the original article Hit count: 309

Filed under:
|
|

I am working on a custom .emacs file that I will be able to use on several different computers. I would like to be able to load a mode if it exists on the system. If it does not exist I would like Emacs to stop showing the error: File error: Cannot open load file, X.

For example:

(require 'darkroom-mode)

Results in:

File error: Cannot open load file, darkroom-mode

I am using file-exists-p to test if certain other files exist but for this test I would assume I need to search my load-path. I am new to Lisp so this is stumping me.

© Stack Overflow or respective owner

Related posts about lisp

Related posts about emacs