emacs-pms-dev
[Top][All Lists]
Advanced

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

Re: [emacs-pms] Dir-style package symbols


From: Tom Breton (Tehom)
Subject: Re: [emacs-pms] Dir-style package symbols
Date: Sat, 15 Jan 2011 20:54:20 -0500
User-agent: SquirrelMail/1.4.21

[This is something I sent to Jonas accidentally instead of to the list a
while back]

> On Sat, Dec 18, 2010 at 19:26, Tom Breton (Tehom) <address@hidden> wrote:
[...]
>> You may dismiss this as a case of CPAN-envy if you like, but what I do is
>> to give sublibraries names like `emtest/common/testral-types' or
`emtest/common/persist'.  I just tell load-path the root of that tree.
Emacs finds them without a problem, and I cleared this with the
emacs-dev
>> list.
>
> Is this actually documented anywhere? (I do did previously know of this
feature but it does not appear in wide use, so I haven't
> investigated it yet.)

It's not documented AFAICT.  As I mentioned, it's been OKed.

>> I've said more about this in the blog a while back,
>> http://tehom-blog.blogspot.com/2010/07/my-elisp-directory-conventions.html
>>
>> Then I give all the symbols in the package a clumpier unique prefix, like
>> `emdb:'.  That way they both are unique and relate to an expressive name.
>
> I don't see why you can't use the prefix "foo-" both in "foo.el" and
"foo-bar.el" but can use "foo" in "foo.el" and "plugins/bar.el".

Because the full names get too long.  For instance, "emdb:" in fact
relates to the module emtest/common/persist, so for instance the function
`emdb:get-value' would have to be written as
`emtest/common/persist:get-value' which is 31 characters.  In the
submodule `emdb:tinydb', I could have to wrestle with
`emtest/common/persist:tinydb:name->tinydb' which is more than half an
80-char line just by itself.

> Also
> why is "foo:" any better than "foo-"?

I prefer to make a clear distinction between the pseudo-module prefix and
the name proper.  foo-bar-baz might be `bar-baz' living in "foo" or `baz'
living in "foo-bar", or even a top-level name like `where-is'.
"foo:bar-baz" is clearly bar-baz living in "foo".

>> I find it gives me a lot more freedom to package things as I want to
instead of in one big file.
>
> Why does it give you more freedom? Because you don't have to add every
subdirectory to the load path anymore?

Yes.  But the major point is that I can write support files without
inventing unique names for them.  For instance, I have several dozen files
called "tests.el".  It wouldn't be practical to given them all unique
names.  There are other types of support file that shouldn't need to be
named uniquely for each package that provides them.  Secondly, I don't
have to give subdirectory files emacs-unique names either.  For instance,
I have two files called "persist.el", one of which is testhelp, one of
which is the backend.  There's no collision between them.

        Tom Breton (Tehom)




reply via email to

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