GNU bug report logs - #15059
24.3; nth with negative index values

Previous Next

Package: emacs;

Reported by: Wilfred Hughes <wilfred <at> editd.com>

Date: Fri, 9 Aug 2013 11:57:01 UTC

Severity: minor

Tags: notabug, wontfix

Found in version 24.3

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #11 received at 15059 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Wilfred Hughes <wilfred <at> editd.com>
Cc: 15059 <at> debbugs.gnu.org
Subject: Re: bug#15059: 24.3; nth with negative index values
Date: Fri, 09 Aug 2013 14:52:29 -0400
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++)
      {





This bug report was last modified 11 years and 286 days ago.

Previous Next


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