Subject: bug#52063: 28.0.60; Confusing presentation of lambda

From: Lars Ingebrigtsen <[email-masked]>
Date: Fri, 26 Nov 2021 13:28:25 +0100

Jim Porter <[email-masked]> writes:

> It might be nice to print an empty arglist as "()" instead of "nil"
> too. While both of those are equivalent, I think "()" is more
> idiomatic when showing an arglist. Currently we have:
>
>   (lambda () (setq foo 1))
>   ;; => (closure (t) nil (setq foo 1))

The printer used here is a general Lisp printer, and doesn't know
anything about the semantics.  (And I don't think we can change that.)
But Emacs 29 has a language-aware pp variant, which does what you
suggest:

(lambda () 'foo)
=> (closure (t) nil 'foo)

(pp-emacs-lisp-code '(closure (t) nil 'foo))
=> (closure (t) ()
     'foo)

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