[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Proposal: directory-slash in library names
From: |
MON KEY |
Subject: |
Re: Proposal: directory-slash in library names |
Date: |
Sat, 9 Jan 2010 20:37:32 -0500 |
> If we do this, we might want to set up a systematic way to explicitly
> label those directories that should be in the search path.
> In a case like, this, you wouldn't want (load "foo")
> to searchfor dir1/foo or dir1/dir2/foo.
In lieu of the other recent discussions of a `package' system for Emacs, please
consider the use of `.' with `qualified' domains at the root of any such feature
e.g. "org.gnu.feature" as opposed "dir/foo/feature" strip the domain
accordingly:
(defun get-the-right-feature (good-feature &optional good-source &rest
bag-o-sources)
(let (pkg)
(mapc #'(lambda (bos)
(let ((myb-good (split-string-and-unquote bos "\\."))
is-good)
(when (memq good-feature
(progn
(while myb-good (push (read (pop
myb-good)) is-good))
is-good))
(push (nreverse is-good) pkg))))
bag-o-sources)
(let (the-sauce)
(when good-source
(mapc #'(lambda (sauce)
(let ((is-sauce (memq good-source sauce)))
(when is-sauce (setq the-sauce sauce))))
pkg))
(cond (the-sauce (memq good-source the-sauce))
((= (length pkg) 1) (cdar pkg))
(t pkg)))))
(get-the-right-feature 'feature 'gnu "org.gnu.feature"
"org.emacsmirror.bubba" "com.tromey.feature")
;=> (gnu feature)
(get-the-right-feature 'bubba nil "org.gnu.feature"
"org.emacsmirror.bubba" "com.tromey.feature")
;=> (emacsmirror bubba)
(get-the-right-feature 'feature nil "org.gnu.feature"
"org.emacsmirror.bubba" "com.tromey.feature")
;=> ((com tromey feature) (org gnu feature))
(get-the-right-feature 'feature nil "org.gnu.feature"
"org.emacsmirror.feature" "com.tromey.feature")
;=> ((com tromey feature) (org emacsmirror feature) (org gnu feature))
(get-the-right-feature 'bubba 'gnu "org.gnu.feature"
"org.emacsmirror.feature" "com.tromey.feature")
;=> nil
(get-the-right-feature 'feature nil "org.gnu.feature"
"org.emacsmirror.feature/funky" "com.tromey.feature")
;=> ((com tromey feature) (org gnu feature))