summaryrefslogtreecommitdiff
path: root/devdocs/elisp/primitive-function-type.html
diff options
context:
space:
mode:
Diffstat (limited to 'devdocs/elisp/primitive-function-type.html')
-rw-r--r--devdocs/elisp/primitive-function-type.html12
1 files changed, 12 insertions, 0 deletions
diff --git a/devdocs/elisp/primitive-function-type.html b/devdocs/elisp/primitive-function-type.html
new file mode 100644
index 00000000..4e93aeea
--- /dev/null
+++ b/devdocs/elisp/primitive-function-type.html
@@ -0,0 +1,12 @@
+ <h4 class="subsection">Primitive Function Type</h4> <p>A <em>primitive function</em> is a function callable from Lisp but written in the C programming language. Primitive functions are also called <em>subrs</em> or <em>built-in functions</em>. (The word “subr” is derived from “subroutine”.) Most primitive functions evaluate all their arguments when they are called. A primitive function that does not evaluate all its arguments is called a <em>special form</em> (see <a href="special-forms">Special Forms</a>). </p> <p>It does not matter to the caller of a function whether the function is primitive. However, this does matter if you try to redefine a primitive with a function written in Lisp. The reason is that the primitive function may be called directly from C code. Calls to the redefined function from Lisp will use the new definition, but calls from C code may still use the built-in definition. Therefore, <strong>we discourage redefinition of primitive functions</strong>. </p> <p>The term <em>function</em> refers to all Emacs functions, whether written in Lisp or C. See <a href="function-type">Function Type</a>, for information about the functions written in Lisp. </p> <p>Primitive functions have no read syntax and print in hash notation with the name of the subroutine. </p> <div class="example"> <pre class="example">(symbol-function 'car) ; <span class="roman">Access the function cell</span>
+ ; <span class="roman">of the symbol.</span>
+ ⇒ #&lt;subr car&gt;
+(subrp (symbol-function 'car)) ; <span class="roman">Is this a primitive function?</span>
+ ⇒ t ; <span class="roman">Yes.</span>
+</pre>
+</div><div class="_attribution">
+ <p class="_attribution-p">
+ Copyright &copy; 1990-1996, 1998-2022 Free Software Foundation, Inc. <br>Licensed under the GNU GPL license.<br>
+ <a href="https://www.gnu.org/software/emacs/manual/html_node/elisp/Primitive-Function-Type.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Primitive-Function-Type.html</a>
+ </p>
+</div>