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

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

Re: `pp-eval-expression' behaves strangely under lexical binding


From: Marcin Borkowski
Subject: Re: `pp-eval-expression' behaves strangely under lexical binding
Date: Sun, 17 Apr 2016 16:33:10 +0200
User-agent: mu4e 0.9.13; emacs 25.1.50.8

On 2016-04-17, at 13:43, Marcin Borkowski <address@hidden> wrote:

> Hi all,
>
> put this in an empty buffer, call `normal-mode' (so that
> `lexical-binding' is set to t) and evaluate:
>
> --8<---------------cut here---------------start------------->8---
> ;;; -*- lexical-binding: t; -*-
> (setq spam 'eggs)
> (let ((spam 'bacon))
>   (pp-eval-expression 'spam)
>   (message "%s" spam))
> --8<---------------cut here---------------end--------------->8---
>
> Then look at *Messages*: "eggs" is printed, then "bacon".
>
> I wanted to use `pp-eval-expression' when debugging (basically as
> a pretty-printing variant of `message'), and this behavior hit me.  Why
> does this behave in this way, and is it a feature or a bug?

OK, never mind: `pp-eval-expression' is defined in Lisp, so it cannot
work any other way.

But isn't my question still valid for `symbol-value'?

Best,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University



reply via email to

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