Subject: RE: [External] : bug#70155: 29.3; Several Emacs Lisp list functions accept non-list arguments

From: Drew Adams <[email-masked]>
Date: Wed, 3 Apr 2024 02:55:26 +0000

Thanks for filing this bug report.

> The built-in Emacs Lisp functions ‘last’, ‘nthcdr’, ‘take’,
> and ‘ntake’ are functions that accept lists as an argument.
> However, they also accept non-list arguments without
> signaling an error.

As I mentioned in [email-masked], this is the case now, but it wasn't the case until Emacs 24.5.  That's when this regression, or design change, occurred (which was it?).

For function `last' this occurred by simply changing `length' to `safe-length'.  If the intention was only to avoid problems with things such as cyclic lists, then this should be fixed by first ensuring that the argument is a cons or nil.

But if the intention was to also have the effect of handling nonlists such as 3.14 then at least this (odd, non-legacy) behavior should be documented.

`last' is one of the oldest Lisp functions...