bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#21048: 24.4; Letrec docs


From: Lars Ingebrigtsen
Subject: bug#21048: 24.4; Letrec docs
Date: Wed, 09 Oct 2019 19:33:20 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Eli Zaretskii <eliz@gnu.org> writes:

> Thanks, but I have trouble understanding what the text you wrote
> says.  I think it needs clarifying, or maybe a descriptive enough
> example.

Yeah, it's pretty subtle what the difference is -- feel free to rewrite
to make it clearer.

I went through the tree looking for a real-life example of when this
macro is useful, and the first half-dozen examples I looked at could
have been written with let* instead and worked just as well, as far as I
can tell.

But I found one in elisp-mode.el and I adapted it slightly and added
this to the manual:

----

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


-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





reply via email to

[Prev in Thread] Current Thread [Next in Thread]