GNU bug report logs - #54537
29.0.50; Last sexp notion is different for eval-last-sexp and pp-eval-last-sexp

Previous Next

Package: emacs;

Reported by: Visuwesh <visuweshm <at> gmail.com>

Date: Wed, 23 Mar 2022 13:53:02 UTC

Severity: normal

Tags: moreinfo

Found in version 29.0.50

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #34 received at 54537 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Michael Heerdegen <michael_heerdegen <at> web.de>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>,
 "54537 <at> debbugs.gnu.org" <54537 <at> debbugs.gnu.org>,
 Visuwesh <visuweshm <at> gmail.com>
Subject: RE: [External] : Re: bug#54537: Re: bug#54537: 29.0.50; Last sexp
 notion is different for eval-last-sexp and pp-eval-last-sexp
Date: Thu, 24 Mar 2022 03:44:20 +0000
> `(,(+ 2 3)
>   ,(+ 4 5))
> 
> The non-pp behavior is useful (you are able to eval the inserted
> subexpressions).  The pp behavior is not useful (error).

OK, I'm convinced.  I didn't (and I don't) see a good
reason for the `pp-*' behavior is that regard.  Just
wanted people to take a look.

What's needed is a fixed version of `pp-last-sexp'.
It's not about `pp-eval-last-sexp'.

pp-last-sexp' has several differences from
`elisp--preceding-sexp'.  Should some of those
differences be kept?  Dunno.  E.g.,  it uses `read',
and it ignores leading comments.

Regardless of what changes are made to `pp-last-sexp',
I think those changes should allow the functions that
call `pp-last-sexp' to remain unchanged; IOW, fix
`pp-last-sexp', but don't change how it's used/called.

E.g., `pp-eval-last-sexp' should remain with this code:

(defun pp-eval-last-sexp (arg)
  "..."
  (interactive "P")
  (if arg
      (insert (pp-to-string (eval (pp-last-sexp)
                                  lexical-binding)))
    (pp-eval-expression (pp-last-sexp))))

Similarly `pp-macroexpand-last-sexp'.  There's no doubt
other code out there (I have some) that makes use of
`pp-last-sexp'.  Let's please have just a simple fix of
`pp-last-sexp'.

And besides allowing no changes in calling, preferably
no other behavior would be changed than to fix this bug.





This bug report was last modified 3 years and 54 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.