unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Eduardo Ochs <eduardoochs@gmail.com>
To: help-gnu-emacs <help-gnu-emacs@gnu.org>
Subject: Lambdas for beginners broken - help, please
Date: Wed, 24 Jul 2024 05:43:38 -0300	[thread overview]
Message-ID: <CADs++6hazVbsNpy2YvXYWZTOmRG3FdmNrcX00KzUeVu5mS6WyA@mail.gmail.com> (raw)

Hi all,

I always present Emacs to beginners starting by Lisp, with this
approach:

  http://anggtwu.net/eev-intros/find-eev-quick-intro.html#2
  http://anggtwu.net/eev-intros/find-eev-quick-intro.html#3

and when I show Emacs to friends who are programmers - in some sense -
and they like it, I usually tell them to read my short tutorial on
elisp as soon as possible, and try its examples:

  http://anggtwu.net/eev-intros/find-elisp-intro.html

But one or two days ago I compiled a current Emacs from git, and I saw
that many functions in eev don't work anymore. Apparently the problem
is here:

  (info "(elisp)Function Cells")
  https://www.gnu.org/software/emacs/manual/html_node/elisp/Function-Cells

Now the htmlized version of the manual says this,

  (defun bar (n) (+ n 2))
  (symbol-function 'bar)
    ;; -> (lambda (n) (+ n 2))

the current info manual says this,

  (defun bar (n) (+ n 2))
  (symbol-function 'bar)
    ;; -> #f(lambda (n) [t] (+ n 2))

and if I run the code myself(*) I get this:

  (defun bar (n) (+ n 2))
  (symbol-function 'bar)
    ;; -> #[(n) ((+ n 2)) nil]

I have lots of code and lots of tutorials that rely on the idea that
when lexical binding is nil then after a

  (defun bar (n) (+ n 2))

the value of

  (symbol-function 'bar)

will be a lambda expression in this sense,

  (info "(elisp)Lambda Expressions")
  http://www.gnu.org/software/emacs/manual/html_node/elisp/Lambda-Expressions

_as a list_, not as a "function object that is not a list".

What do I need to read to learn how to adapt my code to the new
behavior of Emacs?

  Thanks in advance...
    Eduardo Ochs
    http://anggtwu.net/#eev


(*): I tried both the standard `C-x C-e' and my favorite way of
calling it, that uses the key `M-e' and `(eval <obj> t)'.



             reply	other threads:[~2024-07-24  8:43 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-24  8:43 Eduardo Ochs [this message]
2024-07-24 13:12 ` Lambdas for beginners broken - help, please Michael Heerdegen via Users list for the GNU Emacs text editor
2024-07-24 16:43   ` Eduardo Ochs
2024-07-24 20:03     ` Michael Heerdegen via Users list for the GNU Emacs text editor
2024-07-24 22:06       ` Eduardo Ochs
2024-07-25  5:18       ` Eli Zaretskii
2024-07-25  9:44         ` Eduardo Ochs
2024-07-25 11:33           ` Eli Zaretskii
2024-07-25 12:49             ` Eduardo Ochs
2024-07-25 14:53               ` Eli Zaretskii
2024-07-24 16:54 ` tpeplt
2024-07-24 18:49   ` Michael Heerdegen via Users list for the GNU Emacs text editor
2024-07-24 19:29     ` tpeplt
2024-07-24 19:58       ` Michael Heerdegen via Users list for the GNU Emacs text editor

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=CADs++6hazVbsNpy2YvXYWZTOmRG3FdmNrcX00KzUeVu5mS6WyA@mail.gmail.com \
    --to=eduardoochs@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /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.
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).