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

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

RE: [External] : The function naming convention used by Emacs.


From: Drew Adams
Subject: RE: [External] : The function naming convention used by Emacs.
Date: Sun, 26 Sep 2021 17:04:47 +0000

> As far as function names are concerned, are there some established
> conventions used by Emacs? For example, I noticed that there are so
> many functions in Emacs named by the suffix `-p', say,
> `file-exists-p', `ht-equal-p', and so on. But I still can't figure
> out the meaning of this suffix. Any tips will be appreciated.

Ask Emacs!

In the Elisp manual, `i' followed by `convention'
(if you have substring completion turned on) shows
these index-entry candidates (the exact list might
depend on your Emacs version):

 buffer display conventions
 coding conventions in Emacs Lisp 
 comments, Lisp convention for
 conventions for writing major modes 
 conventions for writing minor modes
 documentation conventions 
 documentation strings, conventions and tips
 key binding, conventions for 
 major mode conventions
 minor mode conventions 
 programming conventions
 set-advertised-calling-convention 
 typographic conventions

Some of those point to the same nodes of the manual.

Choosing, say, `coding conventions in Emacs Lisp'
takes you to node `Coding Conventions', where you
find this:

   • If the purpose of a function is to tell you
     whether a certain condition is true or false,
     give the function a name that ends in ‘p’
     (which stands for “predicate”).  If the name
     is one word, add just ‘p’; if the name is
     multiple words, add ‘-p’.  Examples are
     ‘framep’ and ‘frame-live-p’.

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



reply via email to

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