ag91 / moldable-emacs

Adapting Emacs for moldable development
GNU General Public License v3.0
105 stars 8 forks source link

Namespace prefixes & Style: Opinion? Standard? #6

Closed kat-co closed 2 years ago

kat-co commented 2 years ago

I am not completely sure about this, but I think emacs states that you should use hyphens and not forward slashes to prefix your namespace:

https://www.gnu.org/software/emacs/manual/html_node/elisp/Coding-Conventions.html#Coding-Conventions

You should choose a short word to distinguish your program from other Lisp programs. The names of all global symbols in your program, that is the names of variables, constants, and functions, 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 space26. Use two hyphens to separate prefix and name if the symbol is not meant to be used by other packages.

I know there are some packages that use the forward slash, but I'm unsure if this is just preference or goes against the accepted style guidelines. Personally, I am always a bit surprised when I use a package that uses hyphens forward-slashes.

I'm wondering how you would feel about switching?

EDIT: I switched the source of my surprise around. Forward-slashes surprise me, not hyphens!

ag91 commented 2 years ago

You are correct. I tend to use "/" for Emacs code that I have no plans yet to officially publish (I am thinking like Elpa and Melpa as official). I guess since you are trying to package it, I can welcome your efforts by cleaning up things.

It should be a pretty quick refactor: so coming up soon :)

Thanks for pinging about it!

On Fri 24 Sep 2021 at 05:05, Katherine Cox-Buday @.***> wrote:

I am not completely sure about this, but I think emacs states that you should use hyphens and not forward slashes to prefix your namespace:

https://www.gnu.org/software/emacs/manual/html_node/elisp/Coding-Conventions.html#Coding-Conventions

You should choose a short word to distinguish your program from other Lisp programs. The names of all global symbols in your program, that is the names of variables, constants, and functions, 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 space26. Use two hyphens to separate prefix and name if the symbol is not meant to be used by other packages.

I know there are some packages that use the forward slash, but I'm unsure if this is just preference or goes against the accepted style guidelines. Personally, I am always a bit surprised when I use a package that uses hyphens.

I'm wondering how you would feel about switching?