Subject: 24.3; nth with negative index values

From: Wilfred Hughes <[email-masked]>
Date: Fri, 9 Aug 2013 12:55:53 +0100

I've noticed that nth returns the first item in a list, when it's given
a negative index.

(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).

In GNU Emacs 24.3.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.8.2)
 of 2013-07-30 on -var-lib-archbuild-staging-x86_64-jgc
Windowing system distributor `The X.Org Foundation', version 11.0.11402000
Configured using:
 `configure '--prefix=/usr' '--sysconfdir=/etc' '--libexecdir=/usr/lib'
 '--localstatedir=/var' '--with-x-toolkit=gtk3' '--with-xft'
 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector
 --param=ssp-buffer-size=4'
 'LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro'
 'CPPFLAGS=-D_FORTIFY_SOURCE=2''

Important settings:
  value of $LANG: en_GB.utf8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t