[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 50886f0: Add a letrec example to the manuel
From: |
Lars Ingebrigtsen |
Subject: |
[Emacs-diffs] master 50886f0: Add a letrec example to the manuel |
Date: |
Wed, 9 Oct 2019 13:27:29 -0400 (EDT) |
branch: master
commit 50886f0992cf824f87a501cc8d8d8f62e7d2762a
Author: Lars Ingebrigtsen <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>
Add a letrec example to the manuel
* doc/lispref/variables.texi (Local Variables): Add a letrec example.
---
doc/lispref/variables.texi | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi
index 02e1563..89dac4f 100644
--- a/doc/lispref/variables.texi
+++ b/doc/lispref/variables.texi
@@ -273,7 +273,17 @@ before any of the local values are computed. The values
are then
assigned to the locally bound variables. This is only useful when
lexical binding is in effect, and you want to create closures that
refer to bindings that would otherwise not yet be in effect when using
-@code{let}.
+@code{let*}.
+
+For instance, here's a closure that removes itself from a hook after
+being run once:
+
+@lisp
+(letrec ((hookfun (lambda ()
+ (message "Run once")
+ (remove-hook 'post-command-hook hookfun))))
+ (add-hook 'post-command-hook hookfun))
+@end lisp
@end defspec
Here is a complete list of the other facilities that create local
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 50886f0: Add a letrec example to the manuel,
Lars Ingebrigtsen <=