aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Ingebrigtsen2019-10-09 19:27:17 +0200
committerLars Ingebrigtsen2019-10-09 19:27:17 +0200
commit50886f0992cf824f87a501cc8d8d8f62e7d2762a (patch)
tree12eda935fd4878b92c2a0f1d098d8efdef8610d3
parentfe2e29d29b50b378545632fb730209de6e5532d5 (diff)
downloademacs-50886f0992cf824f87a501cc8d8d8f62e7d2762a.tar.gz
emacs-50886f0992cf824f87a501cc8d8d8f62e7d2762a.zip
Add a letrec example to the manuel
* doc/lispref/variables.texi (Local Variables): Add a letrec example.
-rw-r--r--doc/lispref/variables.texi12
1 files changed, 11 insertions, 1 deletions
diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi
index 02e156396db..89dac4f7a4d 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
273assigned to the locally bound variables. This is only useful when 273assigned to the locally bound variables. This is only useful when
274lexical binding is in effect, and you want to create closures that 274lexical binding is in effect, and you want to create closures that
275refer to bindings that would otherwise not yet be in effect when using 275refer to bindings that would otherwise not yet be in effect when using
276@code{let}. 276@code{let*}.
277
278For instance, here's a closure that removes itself from a hook after
279being run once:
280
281@lisp
282(letrec ((hookfun (lambda ()
283 (message "Run once")
284 (remove-hook 'post-command-hook hookfun))))
285 (add-hook 'post-command-hook hookfun))
286@end lisp
277@end defspec 287@end defspec
278 288
279 Here is a complete list of the other facilities that create local 289 Here is a complete list of the other facilities that create local