emacs-devel
[Top][All Lists]
Advanced

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

RE: Naming predicates (was: master d0c77a1: Remove some assumptions abou


From: Drew Adams
Subject: RE: Naming predicates (was: master d0c77a1: Remove some assumptions about timestamp format)
Date: Fri, 28 Sep 2018 11:28:32 -0700 (PDT)

> >> Shouldn't this be `time-equal-p', as we have already `time-less-p'?
> > Thanks, as a Scheme refugee I never can remember which predicates should end
> > in "-p" vs "p" vs nothing. I installed the attached.
> 
> The rule is not that bad: use a "-p or p" suffix whenever a Schemer
> would use a "?" suffix.  As for when to use "-p" vs just "p" I'd say you
> can simply always use "-p" when it's something you define.

I'd say that as a user you can use whatever you want - i.e., "when it's 
something you define".

But there is an Emacs convention, and it's not difficult to find or to follow, 
for those so inclined:

In the Elisp manual, `i convention' shows you this index-entry candidate (*), 
among others: 

  `coding conventions in Emacs Lisp'

And choosing that takes you directly to, well, the coding conventions for Emacs 
Lisp (!), 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'.

_______
* Well, it shows you that candidate if you've configured Emacs option 
`completion-styles' to include substring matching. Or if you use something like 
Icicles. If not then, because that index entry doesn't start with "convention", 
it won't show up. In that case, you need to know to try `coding TAB' instead of 
`convention TAB'.



reply via email to

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