Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the double minus (--) convention in function names mean in Emacs Lisp

I've been reading through a number of Emacs Lisp packages and have come across the convention of some functions being declared with -- after the library prefix, e.g.:

(defun eproject--combine-regexps (regexp-list)

I'm wondering if this a convention for declaring "private" functions to the library but so far I haven't found anything in the Emacs Coding guidelines.

like image 540
stsquad Avatar asked Jul 05 '10 14:07

stsquad


People also ask

What does #' mean in Emacs Lisp?

#'... is short-hand for (function ...) which is simply a variant of '... / (quote ...) that also hints to the byte-compiler that it can compile the quoted form as a function.

Is Emacs functional Lisp?

Emacs Lisp supports multiple programming styles or paradigms, including functional and object-oriented. Emacs Lisp is not a purely functional programming language since side effects are common. Instead, Emacs Lisp is considered an early functional flavored language.


2 Answers

Emacs doesn't have any support for namespaces, packages, libraries or modules. Emacs sources therefore use foo- as a prefix for a foo library, and in some cases foo-- is used for bindings that are supposed to be internal.

like image 54
Eli Barzilay Avatar answered Oct 07 '22 13:10

Eli Barzilay


There is really no such thing as "internal" for Emacs. But yes, some programmers have adopted this convention to indicate things that are more internal -- meaning essentially that there will be less (or no) hesitation by implementors to change them. It's a way of letting users of the code be aware of this possible volatility.

like image 38
Drew Avatar answered Oct 07 '22 14:10

Drew