GNU bug report logs - #70155
29.3; Several Emacs Lisp list functions accept non-list arguments

Previous Next

Package: emacs;

Reported by: <tpeplt <at> gmail.com>

Date: Tue, 2 Apr 2024 23:16:02 UTC

Severity: wishlist

Tags: wontfix

Found in version 29.3

Done: Stefan Kangas <stefankangas <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Drew Adams <drew.adams <at> oracle.com>
To: "tpeplt <at> gmail.com" <tpeplt <at> gmail.com>, "70155 <at> debbugs.gnu.org" <70155 <at> debbugs.gnu.org>
Subject: bug#70155: 29.3; Several Emacs Lisp list functions accept non-list arguments
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 gnu-emacs-help <at> gnu.org, 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...

This bug report was last modified 83 days ago.

Previous Next


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