all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Drew Adams via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: "tpeplt@gmail.com" <tpeplt@gmail.com>,
	"70155@debbugs.gnu.org" <70155@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	[thread overview]
Message-ID: <SJ0PR10MB5488BF1A86B077E11188ED64F33D2@SJ0PR10MB5488.namprd10.prod.outlook.com> (raw)
In-Reply-To: <87y19v8igf.fsf@gmail.com>

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@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...

  reply	other threads:[~2024-04-03  2:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-02 23:15 bug#70155: 29.3; Several Emacs Lisp list functions accept non-list arguments tpeplt
2024-04-03  2:55 ` Drew Adams via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-04-27  8:22 ` Eli Zaretskii
2024-04-27  9:48   ` Mattias Engdegård
2024-04-27 15:01     ` Drew Adams via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-27 14:38   ` Drew Adams via Bug reports for GNU Emacs, the Swiss army knife of text editors

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=SJ0PR10MB5488BF1A86B077E11188ED64F33D2@SJ0PR10MB5488.namprd10.prod.outlook.com \
    --to=bug-gnu-emacs@gnu.org \
    --cc=70155@debbugs.gnu.org \
    --cc=drew.adams@oracle.com \
    --cc=tpeplt@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.