[Top][All Lists]

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

Re: user-controlled load-path extension: load-dir

From: Ben Key
Subject: Re: user-controlled load-path extension: load-dir
Date: Wed, 9 Mar 2011 14:08:20 -0600

To begin with using

(dolist (f (directory-files dir t "\\.el$"))
 (load foo))

does not support error handling so that Emacs will barf if one of the .el files has an error in it.  Also, it does not support loading of files recursively or loading byte-compiled files (it will load from source even if byte compiled files are present).

Also, while this problem could be solved by adding those few lines to ,emacs, users would need to define dir themselves.  This package is intended partially to allow someone who is not familiar with ELisp to just drop a file they downloaded into a directory and have Emacs load it.

The benefit of providing a package to implement this functionality is that the user of the package does not need to figure out how to define dir themselves, it provides error handling so that Emacs initialization will not be interrupted while loading the files in the load dir, it optionally supports loading files recursively, and supports loading of byte compiled files.  To support all of that your two lines quickly grows to be considerably more.  My current implementation has about 100 lines if you strip out the comments.  That is why a package is required, to provide features your quick and dirty two line solution does not.

reply via email to

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