diff options
author | Phillip Lord <phillip.lord@newcastle.ac.uk> | 2015-08-07 22:12:59 +0100 |
---|---|---|
committer | Phillip Lord <phillip.lord@newcastle.ac.uk> | 2015-08-07 22:12:59 +0100 |
commit | feadec307da148af70cf87013c99771ca4db91e4 (patch) | |
tree | 96e21a4246aadd41126f921fe5562904fd1b9e15 /lisp/emacs-lisp/cl-extra.el | |
parent | 0aec2aaccd8b745fa7214f3edd453c04a04bfba4 (diff) | |
download | emacs-fix/subsequence-error-with-negative-sequences.tar.gz |
Improve error signalling for seq-subseq.fix/subsequence-error-with-negative-sequences
The existing behaviour for seq-subseq is to error when indexes are too
large, but to silently ignore numbers which are too negative for lists.
String and vector handling errors in both cases. This has been
regularlised.
Error signalling behaviour has been explicitly added to the docstring of
seq-subseq, and also to cl-subseq which largely defers to
seq-subseq (and is therefore also impacted by this change).
Tests have been added for these exceptional cases, as well as one non
exceptional base case.
Diffstat (limited to 'lisp/emacs-lisp/cl-extra.el')
-rw-r--r-- | lisp/emacs-lisp/cl-extra.el | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lisp/emacs-lisp/cl-extra.el b/lisp/emacs-lisp/cl-extra.el index 101864d3721..9742014db0c 100644 --- a/lisp/emacs-lisp/cl-extra.el +++ b/lisp/emacs-lisp/cl-extra.el @@ -518,7 +518,9 @@ This sets the values of: `cl-most-positive-float', `cl-most-negative-float', (defun cl-subseq (seq start &optional end) "Return the subsequence of SEQ from START to END. If END is omitted, it defaults to the length of the sequence. -If START or END is negative, it counts from the end." +If START or END is negative, it counts from the end. +Signal an error if START or END are outside of the sequence (i.e +too large if positive or too small if negative)" (declare (gv-setter (lambda (new) (macroexp-let2 nil new new |