* Proposal: directory-slash in library names
@ 2010-01-06 23:08 Tom Breton (Tehom)
2010-01-07 4:12 ` Eli Zaretskii
2010-01-07 22:50 ` Richard Stallman
0 siblings, 2 replies; 5+ messages in thread
From: Tom Breton (Tehom) @ 2010-01-06 23:08 UTC (permalink / raw)
To: emacs-devel
***** Rationale
Emacs library names are restricted to a flat-level namespace. There
is no explicit support of submodules.
This limitation is usually worked around by using the format
COMMONPREFIX-LIBRARY. This is used by packages such as org, calc, cl,
and sometimes by non-package arrangements such as pcomplete, which
standardizes the prefix "pcmpl-" for its clients. Compare it to
Perl's easy deployment of constructions like
"AI::ExpertSystem::Advanced::KnowledgeDB::Base"
This workaround has disadvantages, including:
* It's effectively limited to 2 components, since names must not
clash on filesystems that limit filenames to 8.3 format.
* Those components have to be fairly short.
* Being short, those components are less readable than they could
be.
* Because they have so few characters to work with, library authors
have to unduly concern themselves with possible nameclashes.
* It lacks a natural way of naming support files (such as tests) in
relation to the libraries they support.
* Module names contain less information about the module's role than
they could.
***** Proposal
This is real easy, almost a no-op. I'm not proposing any new code.
I'm not proposing that any existing libraries be rewritten or renamed.
I'm only proposing:
* to give the official OK to directory-slash in library names, for
example:
: dir1/dir2/feature
* for the directory-slash to be treated as it is in filenames
(specifically, internally canonized filenames). Eg the example
would mean to look for "dir1" anywhere in load-path, for "dir2"
within that, and for "feature.elc" or "feature.el" there, using the
first successful match.
***** It already seems to work
I experimented and it already does the right thing on GNU/Linux. One
can write:
: (require 'dir1/dir2/feature)
and emacs will load-file "feature.el" from "dir1/dir2" beneath any
directory in load-path.
I cannot test it on other systems, but from the C source, it seems as
though it will work on any system that `expand-file-name' works on.
That apparently translates dir separators, eg it calls
CORRECT_DIR_SEPS for WIN_NT.
Tom Breton (Tehom)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Proposal: directory-slash in library names
2010-01-06 23:08 Proposal: directory-slash in library names Tom Breton (Tehom)
@ 2010-01-07 4:12 ` Eli Zaretskii
2010-01-07 22:50 ` Richard Stallman
1 sibling, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2010-01-07 4:12 UTC (permalink / raw)
To: Tom Breton (Tehom); +Cc: emacs-devel
> Date: Wed, 6 Jan 2010 18:08:15 -0500
> From: "Tom Breton (Tehom)" <tehom@panix.com>
>
>
> I experimented and it already does the right thing on GNU/Linux. One
> can write:
>
> : (require 'dir1/dir2/feature)
>
> and emacs will load-file "feature.el" from "dir1/dir2" beneath any
> directory in load-path.
>
> I cannot test it on other systems, but from the C source, it seems as
> though it will work on any system that `expand-file-name' works on.
> That apparently translates dir separators, eg it calls
> CORRECT_DIR_SEPS for WIN_NT.
Not only does it work on all platforms, we already use it with CEDET.
So if you needed an official blessing, you already have it, I think.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Proposal: directory-slash in library names
2010-01-06 23:08 Proposal: directory-slash in library names Tom Breton (Tehom)
2010-01-07 4:12 ` Eli Zaretskii
@ 2010-01-07 22:50 ` Richard Stallman
2010-01-08 0:42 ` Tom Breton (Tehom)
1 sibling, 1 reply; 5+ messages in thread
From: Richard Stallman @ 2010-01-07 22:50 UTC (permalink / raw)
To: Tom Breton (Tehom); +Cc: emacs-devel
* to give the official OK to directory-slash in library names, for
example:
: dir1/dir2/feature
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.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Proposal: directory-slash in library names
2010-01-07 22:50 ` Richard Stallman
@ 2010-01-08 0:42 ` Tom Breton (Tehom)
0 siblings, 0 replies; 5+ messages in thread
From: Tom Breton (Tehom) @ 2010-01-08 0:42 UTC (permalink / raw)
To: rms; +Cc: emacs-devel
> * to give the official OK to directory-slash in library names, for
> example:
>
> : dir1/dir2/feature
>
> 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.
Oh, I see. You want a way to ensure that directories that contain
libraries with names like `dir1/foo' are not directly in the load-path.
Good catch. Perhaps a "magic" filename similar to ".nosearch"?
Tom Breton (Tehom)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Proposal: directory-slash in library names
@ 2010-01-10 1:37 MON KEY
0 siblings, 0 replies; 5+ messages in thread
From: MON KEY @ 2010-01-10 1:37 UTC (permalink / raw)
To: emacs-devel; +Cc: rms
> 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))
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-01-10 1:37 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-06 23:08 Proposal: directory-slash in library names Tom Breton (Tehom)
2010-01-07 4:12 ` Eli Zaretskii
2010-01-07 22:50 ` Richard Stallman
2010-01-08 0:42 ` Tom Breton (Tehom)
-- strict thread matches above, loose matches on Subject: below --
2010-01-10 1:37 MON KEY
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).