From: "Drew Adams" <drew.adams@oracle.com>
To: "'Oleksandr Gavenko'" <gavenkoa@gmail.com>, <help-gnu-emacs@gnu.org>
Subject: RE: Need advice for naming practice for namespaces in Elisp.
Date: Tue, 5 Feb 2013 22:42:07 -0800 [thread overview]
Message-ID: <1396EDC456CE46C784B8F45242B3B6FA@us.oracle.com> (raw)
In-Reply-To: <87ehguo5ha.fsf@gavenkoa.example.com>
> I read very small amount of elisp code and found practice to
> put '->' in the name of elisp var/func:
>
> Also I search for dot in names:
> and for colon:
>
> Seems that official sources don't often use special marker to
> separate package name and command and some times uses '->',
> ':' and '.'
>
> I want to choose good marker for package to simplify reading
> my code and make it more syntactically structured. I am
> feeling good with dot:
>
> but would be glad to hear any suggestion and coding
> practices...
I say use whatever you like.
The Elisp manual suggests using a hyphen (`-'). See (elisp) `Coding
Conventions':
,----
|* You should choose a short word to distinguish your program from
| other Lisp programs. The names of all global variables,
| constants, and functions in your program should begin with that
| chosen prefix. Separate the prefix from the rest of the name with
| a hyphen, `-'. This practice helps avoid name conflicts, since
| all global variables in Emacs Lisp share the same name space, and
| all functions share another name space(1).
|
| Occasionally, for a command name intended for users to use, it is
| more convenient if some words come before the package's name
| prefix. And constructs that define functions, variables, etc.,
| work better if they start with `defun' or `defvar', so put the
| name prefix later on in the name.
|
| This recommendation applies even to names for traditional Lisp
| primitives that are not primitives in Emacs Lisp--such as
| `copy-list'. Believe it or not, there is more than one plausible
| way to define `copy-list'. Play it safe; append your name prefix
| to produce a name like `foo-copy-list' or `mylib-copy-list'
| instead.
|
| If you write a function that you think ought to be added to Emacs
| under a certain name, such as `twiddle-files', don't call it by
| that name in your program. Call it `mylib-twiddle-files' in your
| program, and send mail to `bug-gnu-emacs@gnu.org' suggesting we add
| it to Emacs. If and when we do, we can change the name easily
| enough.
|
| If one prefix is insufficient, your package can use two or three
| alternative common prefixes, so long as they make sense.
`----
next prev parent reply other threads:[~2013-02-06 6:42 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-05 20:44 Need advice for naming practice for namespaces in Elisp Oleksandr Gavenko
2013-02-06 6:42 ` Drew Adams [this message]
2013-02-06 18:59 ` Stefan Monnier
2013-02-07 19:04 ` Oleksandr Gavenko
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1396EDC456CE46C784B8F45242B3B6FA@us.oracle.com \
--to=drew.adams@oracle.com \
--cc=gavenkoa@gmail.com \
--cc=help-gnu-emacs@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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.