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


View this message in rfc822 format

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Visuwesh <visuweshm <at> gmail.com>
Cc: 54537 <at> debbugs.gnu.org
Subject: bug#54537: 29.0.50; Last sexp notion is different for eval-last-sexp and pp-eval-last-sexp
Date: Wed, 23 Mar 2022 15:06:31 +0100
Visuwesh <visuweshm <at> gmail.com> writes:

> The notion of "last sexp" is different for eval-last-sexp and
> pp-eval-last-sexp as seen by the following,
>
>     ,(list 1 2 3)
>
> eval-last-sexp echoes (1 2 3) in the echo area but pp-eval-last-sexp
> signals an error.  I am not sure which one is more correct, but
> eval-last-sexp behaviour is more convenient (and backward-sexp when
> after the closing parenthesis places the point after , too...).

The pp function uses (forward-sexp -1) to determine where the preceding
expression begins, which seems natural.  (And it skips to before the
comma.)

The non-pp function uses (elisp--preceding-sexp), which basically does
the same, but then explicitly skips past the comma.

I think the non-pp function has the most convenient behaviour, so I'd be
in favour of changing it to just use (elisp--preceding-sexp).  Any opinions?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




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

Previous Next


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