From: "Mihai Călin Bazon" <mihai.bazon@gmail.com>
To: Kaushal Modi <kaushal.modi@gmail.com>
Cc: John Mastro <john.b.mastro@gmail.com>,
Andreas Schwab <schwab@linux-m68k.org>,
22961@debbugs.gnu.org
Subject: bug#22961: The read function does not support a lambda argument
Date: Wed, 9 Mar 2016 23:10:39 +0200 [thread overview]
Message-ID: <CAOUqiQ3HvWNs+CB6SFcKYhpon0w_GeVE6cfp2bTo2gJW2G=gGA@mail.gmail.com> (raw)
In-Reply-To: <CAFyQvY0zSD17iELk7C+tRo7TzCwTxbca66BU+0Okc-urXOs+kA@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1071 bytes --]
You should (setq lexical-binding t) before running it (and note that's
buffer-local, I've been bitten by that several times). With lexical
binding my original example should work (with the fix, as John pointed out,
that the argument should be &optional).
Thanks Andreas for the quick fix! :-)
On Wed, Mar 9, 2016 at 10:31 PM, Kaushal Modi <kaushal.modi@gmail.com>
wrote:
> I just re-built using this commit (
> http://git.savannah.gnu.org/cgit/emacs.git/commit/?h=emacs-25&id=711ca362e7f8ca7c4f664dc2fe60bc5fa4e4f4fe
> ).
>
> Now the earlier error went away, but I get
>
> Symbol’s value as variable is void: prev
>
> I guess the read call should be inside the let:
>
> (let ((str "TEST")
> (pos 0)
> (prev nil))
> (read (lambda (&optional ch)
> (cond
> (ch (push ch prev))
> (prev (pop prev))
> ((< pos (length str))
> (prog1 (aref str pos)
> (setq pos (1+ pos))))))))
>
> Above returns "TEST".
>
--
Mihai Bazon,
http://lisperator.net/
[-- Attachment #2: Type: text/html, Size: 1920 bytes --]
prev parent reply other threads:[~2016-03-09 21:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-09 8:37 bug#22961: The read function does not support a lambda argument Mihai Călin Bazon
2016-03-09 18:27 ` John Mastro
2016-03-09 18:46 ` Andreas Schwab
2016-03-09 20:31 ` Kaushal Modi
2016-03-09 21:10 ` Mihai Călin Bazon [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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAOUqiQ3HvWNs+CB6SFcKYhpon0w_GeVE6cfp2bTo2gJW2G=gGA@mail.gmail.com' \
--to=mihai.bazon@gmail.com \
--cc=22961@debbugs.gnu.org \
--cc=john.b.mastro@gmail.com \
--cc=kaushal.modi@gmail.com \
--cc=schwab@linux-m68k.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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.