unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: rustompmody@gmail.com, 21048@debbugs.gnu.org
Subject: bug#21048: 24.4; Letrec docs
Date: Wed, 09 Oct 2019 19:33:20 +0200	[thread overview]
Message-ID: <87a7a9963j.fsf@gnus.org> (raw)
In-Reply-To: <838sptvo0z.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 09 Oct 2019 20:15:08 +0300")

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	other threads:[~2019-10-09 17:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-13 15:59 bug#21048: 24.4; Letrec docs Rustom Mody
2019-10-09  4:06 ` Lars Ingebrigtsen
2019-10-09 17:15   ` Eli Zaretskii
2019-10-09 17:33     ` Lars Ingebrigtsen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a7a9963j.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=21048@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=rustompmody@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).