summaryrefslogtreecommitdiff
path: root/devdocs/elisp/closures.html
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2025-08-14 22:58:58 -0500
committerCraig Jennings <c@cjennings.net>2025-08-14 22:58:58 -0500
commit82ba818ff456bcd6d56a06226e3f27e98fbb55c3 (patch)
tree158cfc17b2f644a10f063cb546752cfaae12c97f /devdocs/elisp/closures.html
parent9278ddd4ea1a8b1a4c1edaa8894516e3f48d245b (diff)
downloaddotemacs-82ba818ff456bcd6d56a06226e3f27e98fbb55c3.tar.gz
dotemacs-82ba818ff456bcd6d56a06226e3f27e98fbb55c3.zip
removing all downloaded devdocs files
Diffstat (limited to 'devdocs/elisp/closures.html')
-rw-r--r--devdocs/elisp/closures.html10
1 files changed, 0 insertions, 10 deletions
diff --git a/devdocs/elisp/closures.html b/devdocs/elisp/closures.html
deleted file mode 100644
index 3e8a42b3..00000000
--- a/devdocs/elisp/closures.html
+++ /dev/null
@@ -1,10 +0,0 @@
- <h3 class="section">Closures</h3> <p>As explained in <a href="variable-scoping">Variable Scoping</a>, Emacs can optionally enable lexical binding of variables. When lexical binding is enabled, any named function that you create (e.g., with <code>defun</code>), as well as any anonymous function that you create using the <code>lambda</code> macro or the <code>function</code> special form or the <code>#'</code> syntax (see <a href="anonymous-functions">Anonymous Functions</a>), is automatically converted into a <em>closure</em>. </p> <p>A closure is a function that also carries a record of the lexical environment that existed when the function was defined. When it is invoked, any lexical variable references within its definition use the retained lexical environment. In all other respects, closures behave much like ordinary functions; in particular, they can be called in the same way as ordinary functions. </p> <p>See <a href="lexical-binding">Lexical Binding</a>, for an example of using a closure. </p> <p>Currently, an Emacs Lisp closure object is represented by a list with the symbol <code>closure</code> as the first element, a list representing the lexical environment as the second element, and the argument list and body forms as the remaining elements: </p> <div class="example"> <pre class="example">;; <span class="roman">lexical binding is enabled.</span>
-(lambda (x) (* x x))
- ⇒ (closure (t) (x) (* x x))
-</pre>
-</div> <p>However, the fact that the internal structure of a closure is exposed to the rest of the Lisp world is considered an internal implementation detail. For this reason, we recommend against directly examining or altering the structure of closure objects. </p><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/Closures.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Closures.html</a>
- </p>
-</div>