From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ben Key Newsgroups: gmane.emacs.devel Subject: Re: user-controlled load-path extension: load-dir Date: Wed, 9 Mar 2011 14:08:20 -0600 Message-ID: References: <87oc5kax8l.fsf@stupidchicken.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=0015175cd79480f3e4049e124baa X-Trace: dough.gmane.org 1299701352 1167 80.91.229.12 (9 Mar 2011 20:09:12 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 9 Mar 2011 20:09:12 +0000 (UTC) Cc: tzz@lifelogs.com, ego111@gmail.com, Emacs-devel@gnu.org To: Chong Yidong Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Mar 09 21:09:05 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PxPgv-0007IM-Hw for ged-emacs-devel@m.gmane.org; Wed, 09 Mar 2011 21:09:05 +0100 Original-Received: from localhost ([127.0.0.1]:51713 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PxPgu-0007Px-Rc for ged-emacs-devel@m.gmane.org; Wed, 09 Mar 2011 15:09:04 -0500 Original-Received: from [140.186.70.92] (port=53931 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PxPgn-0006Mh-Ag for Emacs-devel@gnu.org; Wed, 09 Mar 2011 15:08:58 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PxPgX-0004Gl-Ep for Emacs-devel@gnu.org; Wed, 09 Mar 2011 15:08:43 -0500 Original-Received: from mail-bw0-f41.google.com ([209.85.214.41]:40489) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PxPgX-0004GR-8n for Emacs-devel@gnu.org; Wed, 09 Mar 2011 15:08:41 -0500 Original-Received: by bwz17 with SMTP id 17so1174908bwz.0 for ; Wed, 09 Mar 2011 12:08:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=cDV6fjSL5lKMyGG1kKHgO93A6eKtS9kOgpmC2InEqJE=; b=L2WbdqtuTYO9w0Tb7NXghjJ8M46gciLIgLpzzu6ZeB0RM9paFdlTJ7LqX/t31rt+At ilg5HAxOYYDGUyQlNShtYm8xM6ro4QLGBP7dubUZgwZzliffKiyWYj5S8QajUgRQBEo7 SNk0SPCZHoo2ZwbZO8jSuyIfMLyuXFr3nisXM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; b=kCqULStBIWcZ3w8LZ+2EGkwPJUZWuzHgsVQn+J06X1t+QRvgmpPp+zhfeyEJa30NYJ L0yd3m96AmkANoDl3XX4pzOYpblb2ZTdkL0l7mdZJuR4tUCWU1nMzW8odagylZc5jPGr mELXoqdLbl64PNNw74ONRufj778nL7ezNqPBI= Original-Received: by 10.204.10.81 with SMTP id o17mr93462bko.94.1299701320184; Wed, 09 Mar 2011 12:08:40 -0800 (PST) Original-Received: by 10.204.14.147 with HTTP; Wed, 9 Mar 2011 12:08:20 -0800 (PST) In-Reply-To: <87oc5kax8l.fsf@stupidchicken.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.214.41 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:136988 Archived-At: --0015175cd79480f3e4049e124baa Content-Type: text/plain; charset=ISO-8859-1 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. --0015175cd79480f3e4049e124baa Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable To begin with using

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

does not support error han= dling so that Emacs will barf if one of the .el files has an error in it.= =A0 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 pr= esent).

Also, while this problem could be solved by adding those few lines to ,= emacs, users would need to define dir themselves.=A0 This package is intend= ed 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 t= hat the user of the package does not need to figure out how to define dir t= hemselves, it provides error handling so that Emacs initialization will not= be interrupted while loading the files in the load dir, it optionally supp= orts loading files recursively, and supports loading of byte compiled files= .=A0 To support all of that your two lines quickly grows to be considerably= more.=A0 My current implementation has about 100 lines if you strip out th= e comments.=A0 That is why a package is required, to provide features your = quick and dirty two line solution does not.
=A0
--0015175cd79480f3e4049e124baa--