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: Hongyi Zhao
Subject: Re: [External] : The function naming convention used by Emacs.
Date: Mon, 27 Sep 2021 13:46:17 +0800

On Mon, Sep 27, 2021 at 1:04 AM Drew Adams <drew.adams@oracle.com> wrote:
>
> > 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)

What's the exact vanilla Emacs keystrokes corresponding to the above operations?

> 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

Thank you for showing me this. With swiper [1], I use the following
command to access the above Elisp manual built-in Emacs:

C-h i RET elisp RET cod conv RET

[1] https://github.com/abo-abo/swiper

HZ



reply via email to

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