bbatsov / emacs-lisp-style-guide

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

Naming convention for boolean variables #57

Closed andreyorst closed 1 year ago

andreyorst commented 4 years ago

Style guide suggest to name functions that return booleans with p or -p for "predicate", but what convention should be used for such variables, like feature-enabled or feature-enabled-p. These variables are used in predicate position in if or when, yet those aren't functions, so I'm a bit confused.

dgutov commented 4 years ago

I believe the convention is that -p is only for functions.

andreyorst commented 4 years ago

I've searched a bit over GitHub, and didn't found a lot of examples where boolean variables are named with -p: haskell-mode, cling-mode, parinfer-rust-mode.

A lot of such variables were ending with imperative word implying that some action can be taken or not depending on the value, e.g. -enable, -hover, -format, -split. -import

dgutov commented 4 years ago

Agree.