From: Lars Ingebrigtsen Date: Wed, 9 Oct 2019 17:27:17 +0000 (+0200) Subject: Add a letrec example to the manuel X-Git-Tag: emacs-27.0.90~1182 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=50886f0992cf824f87a501cc8d8d8f62e7d2762a;p=emacs.git Add a letrec example to the manuel * doc/lispref/variables.texi (Local Variables): Add a letrec example. --- 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 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