bbatsov / emacs-lisp-style-guide

A community-driven Emacs Lisp style guide
1.08k stars 53 forks source link

Libraries adding unprefixed functions #24

Closed Trevoke closed 9 years ago

Trevoke commented 10 years ago

What are the guidelines for this? Are there any?

Malabarba commented 10 years ago

I believe the rule of thumb is "Don't".

The only exception I'm aware of is if the library's entry function is a global listing command, as described in the documentation of tabulated-list-mode

An inheriting mode is usually accompanied by a "list-FOO" command (e.g. list-packages, list-processes).

bbatsov commented 10 years ago

I believe the rule of thumb is "Don't".

Indeed.

shosti commented 10 years ago

One other exception (according to the manual) is for def-style macros, where the package name can be somewhere else in the name:

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.

swsnr commented 9 years ago

@shosti In either case you'll have the “prefix” somewhere in that name, though, i.e. def-myfoo-thing, or list-myfoo-things.

You should never define names in which the name of the defining library does not appear at all.

shosti commented 9 years ago

@lunaryorn right, of course the library name should be in there, but it's not a prefix.

dgutov commented 9 years ago

Another canonical exception is global, as in global-flycheck-mode.

Anyway, it seems like there's nothing more to be discussed here.