[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#15059: 24.3; nth with negative index values
From: |
Glenn Morris |
Subject: |
bug#15059: 24.3; nth with negative index values |
Date: |
Fri, 09 Aug 2013 14:52:29 -0400 |
User-agent: |
Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) |
Wilfred Hughes wrote:
> (nth -1 '(5 6 7)) ;; 5
> (nth -2 '(5 6 7)) ;; 5
>
> Judging by my reading of the docstring, I was expecting nil (though
> raising an error might be a sensible behaviour instead).
Easy to raise an error (unless something was relying on the behaviour
for -ve arguments?):
*** src/fns.c 2013-08-01 22:24:02 +0000
--- src/fns.c 2013-08-09 18:43:02 +0000
***************
*** 1277,1283 ****
(Lisp_Object n, Lisp_Object list)
{
EMACS_INT i, num;
! CHECK_NUMBER (n);
num = XINT (n);
for (i = 0; i < num && !NILP (list); i++)
{
--- 1277,1283 ----
(Lisp_Object n, Lisp_Object list)
{
EMACS_INT i, num;
! CHECK_NATNUM (n);
num = XINT (n);
for (i = 0; i < num && !NILP (list); i++)
{