]> git.eshelyaron.com Git - emacs.git/commitdiff
Add a letrec example to the manuel
authorLars Ingebrigtsen <larsi@gnus.org>
Wed, 9 Oct 2019 17:27:17 +0000 (19:27 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Wed, 9 Oct 2019 17:27:17 +0000 (19:27 +0200)
* doc/lispref/variables.texi (Local Variables): Add a letrec example.

doc/lispref/variables.texi

index 02e156396db0943446cbf208789a793c94e562dd..89dac4f7a4d090ea4d238d2b9b75a1ccd627d987 100644 (file)
@@ -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