From: Ted Zlatanov <tzz@lifelogs.com>
To: emacs-devel@gnu.org
Subject: Re: user-controlled load-path extension: load-dir
Date: Thu, 17 Mar 2011 05:55:22 -0500 [thread overview]
Message-ID: <87lj0eyq1x.fsf@lifelogs.com> (raw)
In-Reply-To: AANLkTikGH1rietzBWcyykvX=VPO=h=hfTB79dXLrX6+z@mail.gmail.com
[-- Attachment #1: Type: text/plain, Size: 3720 bytes --]
On Thu, 17 Mar 2011 00:22:10 -0400 Ben Key <bkey76@gmail.com> wrote:
BK> For what it is worth I signed the necessary copyright assignment papers
BK> years ago. I have been a member of the Emacs project since Wednesday,
BK> November 13, 2002. If you go to the Emacs Project Memberlist page you will
BK> see me listed as Ben Key <bkey1>. I simply have not been an active
BK> contributor to Emacs for the past several years.
Sorry Ben, I just checked the ChangeLogs. I put you in the authors list
of user-load-dirs.el, which is attached below. Please suggest any
changes you think are necessary.
BK> I do think it is important to trap errors though. If you do not, and you
BK> call this new load directory function in your .emacs file, Emacs
BK> initialization will abort at the first error leaving your Emacs session half
BK> configured (any code positioned after the call to load directory will not
BK> run). I do not think this is a good idea. I do not feel very strongly
BK> about this though.
I think it's a valid way to do it, but the way I think of it (as a
logical extension to .emacs) errors should not be trapped.
I made it an option.
On Thu, 17 Mar 2011 00:31:34 -0600 Evans Winner <ego111@gmail.com> wrote:
EW> By the way, a version of `load-dir' that I sent Ben Key a
EW> week or so ago mostly/partly includes handling of gzipped
EW> libraries (or whatever is returned by `get-load-suffixes')
EW> which seemed a useful variation, though it occurs to me that
EW> I don't know if that is portable across platforms.
It seems to work OK and automatically filters out "." and ".." so it's a
good idea. I added that to user-load-dirs.el as well.
On Wed, 16 Mar 2011 21:42:17 -0700 PJ Weisberg <pj@irregularexpressions.net> wrote:
PW> I only saw Stefan say to go ahead with a load-directory function,
I know, but a package IMO will provide a better user experience because
of the number of possible options. We already have recursive and
ignore-errors; I imagine the list will only grow. Plus the loaded cache
in `user-load-dirs-loaded' is pretty crucial to avoid double-loading
files; remember Stephen Turnbull's concerns about installing hooks twice
for instance. All of that is a pain to handle without a package.
PW> which I assumed would live in files.el next to load-file and look
PW> something like this:
PW> (defun load-directory (dir recursive)
PW> "Load all Lisp files in DIR. If RECURSIVE is non-nil,
PW> recursively call load-directory for all subdirectories of dir."
PW> (interactive "DLoad Dir: \nP")
PW> (dolist (file (directory-files dir t ".*\\.el$"))
PW> ;; Cut off the .el so load will pick up the .elc version if it's there
PW> (setq file (substring file 0 -3))
PW> (load file))
PW> (when recursive
PW> (dolist (file (directory-files dir t))
PW> (if (and (file-directory-p file)
PW> (not (string-match "/\\.\\.?$" file)))
PW> (load-directory file recursive)))))
PW> If I'm not mistaken that's about 90% of what you want, and makes using
PW> your own load-dir at least as easy as using your own custom-file.
I will use `file-name-sans-extension' instead of the substring to handle
all the possible values from `get-load-suffixes', but yeah I think using
the bare file name is better than explicitly loading it with the
extension. Thanks for that (and I think both Ben and Evans had
something similar).
If `user-load-dirs-load' is autoloaded then it's just as easy to manage
at the user level as the `load-directory' function you suggest.
The library can be made into an ELPA package easily and thus used in
older Emacsen. My goal, though, is to call `user-load-dirs-load' in the
Emacs startup, as I've mentioned.
Ted
[-- Attachment #2: user-load-dirs.el --]
[-- Type: application/emacs-lisp, Size: 3830 bytes --]
next prev parent reply other threads:[~2011-03-17 10:55 UTC|newest]
Thread overview: 129+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-17 4:22 user-controlled load-path extension: load-dir Ben Key
2011-03-17 6:31 ` Evans Winner
2011-03-17 10:55 ` Ted Zlatanov [this message]
2011-03-17 20:11 ` Stefan Monnier
2011-03-17 21:01 ` Ted Zlatanov
2011-03-17 21:05 ` Tom Tromey
2011-03-17 21:23 ` Ted Zlatanov
2011-03-17 22:50 ` Glenn Morris
2011-03-18 2:46 ` Ted Zlatanov
2011-03-18 10:56 ` Dimitri Fontaine
2011-03-18 13:07 ` Ted Zlatanov
2011-03-18 2:21 ` Stefan Monnier
-- strict thread matches above, loose matches on Subject: below --
2011-03-24 0:03 Ben Key
2011-03-24 14:38 ` Stefan Monnier
2011-03-26 11:37 ` Ted Zlatanov
2011-04-02 18:35 ` Chong Yidong
2011-04-04 9:54 ` Ted Zlatanov
2011-03-19 4:10 Ben Key
2011-03-19 13:29 ` Juanma Barranquero
2011-03-19 16:07 ` Ben Key
2011-03-19 14:15 ` Ted Zlatanov
2011-03-20 2:58 ` Stefan Monnier
2011-03-20 12:05 ` Ted Zlatanov
2011-03-23 15:32 ` Ted Zlatanov
2011-03-23 20:33 ` Stefan Monnier
[not found] <AANLkTin1zXJQo2vsju7kpa31Nw568m_eNZS+gJ6g2tQO@mail.gmail.com>
2011-03-08 18:49 ` Ben Key
2011-03-08 20:01 ` Dimitri Fontaine
2011-03-08 20:25 ` Chad Brown
2011-03-08 20:38 ` Dimitri Fontaine
2011-03-08 22:40 ` Chad Brown
2011-03-09 9:36 ` Dimitri Fontaine
2011-03-09 11:52 ` Ted Zlatanov
2011-03-08 22:57 ` Ben Key
2011-03-09 3:28 ` Ben Key
2011-03-09 6:50 ` Ben Key
2011-03-09 7:29 ` Jan D.
2011-03-09 16:00 ` Ben Key
2011-03-09 11:39 ` Ted Zlatanov
2011-03-09 19:51 ` Chong Yidong
2011-03-09 20:08 ` Ben Key
2011-03-09 20:18 ` Ted Zlatanov
2011-03-09 20:32 ` Chong Yidong
2011-03-09 20:44 ` Ted Zlatanov
2011-03-10 11:30 ` Dimitri Fontaine
2011-03-10 14:27 ` Tom Tromey
2011-03-10 17:23 ` Dimitri Fontaine
2011-03-10 18:33 ` Tom Tromey
2011-03-10 18:56 ` Chong Yidong
2011-03-10 19:32 ` Eli Zaretskii
2011-03-10 20:30 ` Dimitri Fontaine
2011-03-10 21:54 ` Chong Yidong
2011-03-11 8:43 ` Dimitri Fontaine
2011-03-10 19:36 ` Jambunathan K
2011-03-11 15:00 ` chad
2011-03-11 17:41 ` Dimitri Fontaine
2011-03-12 5:51 ` chad
2011-03-12 10:09 ` Jan Djärv
2011-03-11 18:51 ` Ted Zlatanov
2011-03-16 14:16 ` Ted Zlatanov
2011-03-16 15:43 ` Stefan Monnier
2011-03-16 20:08 ` Ted Zlatanov
2011-03-17 2:13 ` Stefan Monnier
2011-03-17 3:34 ` Ted Zlatanov
2011-03-17 4:42 ` PJ Weisberg
2011-03-16 20:11 ` Evans Winner
2011-03-16 20:23 ` Ted Zlatanov
2011-03-10 2:21 ` Stefan Monnier
2011-03-08 7:14 Ben Key
2011-03-08 9:58 ` Evans Winner
2011-03-08 18:49 ` PJ Weisberg
2011-03-01 20:32 Ted Zlatanov
2011-03-03 21:07 ` Dimitri Fontaine
2011-03-04 9:55 ` Julien Danjou
2011-03-04 17:18 ` Tom Tromey
2011-03-04 18:04 ` Ted Zlatanov
2011-03-04 18:37 ` Dimitri Fontaine
2011-03-04 19:35 ` Tom Tromey
2011-03-04 19:45 ` Dimitri Fontaine
2011-03-04 19:54 ` Ted Zlatanov
2011-03-04 20:21 ` Dimitri Fontaine
2011-03-04 20:25 ` Chad Brown
2011-03-04 20:46 ` Ted Zlatanov
2011-03-05 19:24 ` Chad Brown
2011-03-04 20:26 ` Chad Brown
2011-03-04 20:08 ` Tom Tromey
2011-03-04 20:24 ` Dimitri Fontaine
2011-03-04 21:17 ` Tom Tromey
2011-03-04 21:33 ` Dimitri Fontaine
2011-03-04 21:37 ` Tom Tromey
2011-03-05 3:18 ` Ted Zlatanov
2011-03-05 19:11 ` Chad Brown
2011-03-06 7:21 ` Mike Mattie
2011-03-07 16:24 ` Ted Zlatanov
2011-03-07 17:18 ` Chad Brown
2011-03-07 17:59 ` Ted Zlatanov
2011-03-08 17:36 ` Dimitri Fontaine
2011-03-08 18:30 ` Chad Brown
2011-03-07 17:52 ` Stefan Monnier
2011-03-07 20:39 ` PJ Weisberg
2011-03-08 2:46 ` Stefan Monnier
2011-03-08 10:26 ` Ted Zlatanov
2011-03-08 17:14 ` Chong Yidong
2011-03-08 18:47 ` Ted Zlatanov
2011-03-08 19:23 ` Julien Danjou
2011-03-09 2:54 ` Stefan Monnier
2011-03-09 19:57 ` Chong Yidong
2011-03-08 20:59 ` Stefan Monnier
2011-03-08 21:38 ` Ted Zlatanov
2011-03-09 7:06 ` Jan D.
2011-03-09 7:17 ` Christoph Scholtes
2011-03-09 10:01 ` Jan Djärv
2011-03-09 17:29 ` Stephen J. Turnbull
2011-03-09 18:18 ` Ted Zlatanov
2011-03-09 19:33 ` Stephen J. Turnbull
2011-03-09 19:57 ` Ted Zlatanov
2011-03-10 3:20 ` Stephen J. Turnbull
2011-03-10 5:01 ` Ted Zlatanov
2011-03-10 7:08 ` Stephen J. Turnbull
2011-03-10 13:15 ` Ted Zlatanov
2011-03-11 2:10 ` Stephen J. Turnbull
2011-03-09 21:57 ` Mike Mattie
2011-03-10 7:08 ` Jan Djärv
2011-03-09 6:03 ` Mike Mattie
2011-03-09 7:20 ` Jan D.
2011-03-09 23:44 ` Mike Mattie
2011-03-08 0:47 ` Mike Mattie
2011-03-08 10:37 ` Ted Zlatanov
2011-03-09 6:26 ` Mike Mattie
2011-03-09 11:26 ` Ted Zlatanov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87lj0eyq1x.fsf@lifelogs.com \
--to=tzz@lifelogs.com \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).