bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#26564: Document that only functions and not variables can end with "


From: Kaushal Modi
Subject: bug#26564: Document that only functions and not variables can end with "-p"
Date: Wed, 19 Apr 2017 15:47:06 +0000

The discussion on whether variables should end in "-p" came up few time on emacs-devel, at least the ones I was part of:

1. https://lists.gnu.org/archive/html/emacs-devel/2016-07/msg00734.html
2. http://lists.gnu.org/archive/html/emacs-devel/2017-04/msg00540.html

Doing a rudimentary search in emacs/lisp/ code-base shows a sign of an undocumented convention that predicate functions, functions that return either nil or non-nil can end in "-p" (if the function name is multi-word, like nested-alist-p), or just "p" (if the function name is a single word, like stringp).

I ran ag[1] in emacs/lisp:

1. 1511 matches -- defuns and defsubsts ending in -p -- ag 'def(un|subst)\s+[^ ]+-p\s+' --stats
2. 149 matches -- defvars, defconsts and defcustoms ending in -p -- ag 'def(var|const|custom)\s+[^ ]+-p\s+' --stats  
3. 65 matches -- Just the user-facing defcustoms -- ag 'defcustom\s+[^ ]+-p\s+' --stats

That corroborates that more functions tend to end in "-p" than variables.

This bug report is to make a request to incorporate this unspoken rule as a rule in the Elisp manual.

What would be the correct section to do so?

[1]: https://github.com/ggreer/the_silver_searcher
--

Kaushal Modi


reply via email to

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