aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Petton2015-08-24 10:12:31 +0200
committerNicolas Petton2015-08-24 10:25:19 +0200
commit291593a0571dd62ae809ed337aca8b9e62a5fddc (patch)
treeabe0018efe8a90b1954a6bbb6dd3254842efe7b5
parent24c61cab074c81da00785bedb62eb0be95fd9776 (diff)
downloademacs-291593a0571dd62ae809ed337aca8b9e62a5fddc.tar.gz
emacs-291593a0571dd62ae809ed337aca8b9e62a5fddc.zip
Fix cl-subseq and cl-concatenate
* lisp/emacs-lisp/cl-extra.el (cl-subseq, cl-concatenate): Do not use seq functions. * lisp/emacs-lisp/seq.el (seq-concatenate): Call cl-concatenate in seq-concatenate.
-rw-r--r--lisp/emacs-lisp/cl-extra.el16
-rw-r--r--lisp/emacs-lisp/seq.el6
2 files changed, 11 insertions, 11 deletions
diff --git a/lisp/emacs-lisp/cl-extra.el b/lisp/emacs-lisp/cl-extra.el
index 90ca531ae7a..7a7712ac0d3 100644
--- a/lisp/emacs-lisp/cl-extra.el
+++ b/lisp/emacs-lisp/cl-extra.el
@@ -529,8 +529,8 @@ too large if positive or too small if negative)."
529 ((listp seq) 529 ((listp seq)
530 (let (len 530 (let (len
531 (errtext (format "Bad bounding indices: %s, %s" start end))) 531 (errtext (format "Bad bounding indices: %s, %s" start end)))
532 (and end (< end 0) (setq end (+ end (setq len (seq-length seq))))) 532 (and end (< end 0) (setq end (+ end (setq len (length seq)))))
533 (if (< start 0) (setq start (+ start (or len (setq len (seq-length seq)))))) 533 (if (< start 0) (setq start (+ start (or len (setq len (length seq))))))
534 (unless (>= start 0) 534 (unless (>= start 0)
535 (error "%s" errtext)) 535 (error "%s" errtext))
536 (when (> start 0) 536 (when (> start 0)
@@ -543,14 +543,18 @@ too large if positive or too small if negative)."
543 (push (pop seq) res)) 543 (push (pop seq) res))
544 (or (= (1+ end) start) (error "%s" errtext)) 544 (or (= (1+ end) start) (error "%s" errtext))
545 (nreverse res)) 545 (nreverse res))
546 (seq-copy seq)))) 546 (copy-sequence seq))))
547 (t (error "Unsupported sequence: %s" seq)))) 547 (t (error "Unsupported sequence: %s" seq))))
548 548
549;;;###autoload 549;;;###autoload
550(defalias 'cl-concatenate #'seq-concatenate 550(defun cl-concatenate (type &rest sequences)
551 "Concatenate, into a sequence of type TYPE, the argument SEQUENCEs. 551 "Concatenate, into a sequence of type TYPE, the argument SEQUENCEs.
552\n(fn TYPE SEQUENCE...)") 552\n(fn TYPE SEQUENCE...)"
553 553 (pcase type
554 (`vector (apply #'vconcat sequences))
555 (`string (apply #'concat sequences))
556 (`list (apply #'append (append sequences '(nil))))
557 (_ (error "Not a sequence type name: %S" type))))
554 558
555;;; List functions. 559;;; List functions.
556 560
diff --git a/lisp/emacs-lisp/seq.el b/lisp/emacs-lisp/seq.el
index 5ce4d91ec3e..6a386bdceff 100644
--- a/lisp/emacs-lisp/seq.el
+++ b/lisp/emacs-lisp/seq.el
@@ -200,11 +200,7 @@ The result is a sequence of the same type as SEQ."
200TYPE must be one of following symbols: vector, string or list. 200TYPE must be one of following symbols: vector, string or list.
201 201
202\n(fn TYPE SEQUENCE...)" 202\n(fn TYPE SEQUENCE...)"
203 (pcase type 203 (apply #'cl-concatenate type seqs))
204 (`vector (apply #'vconcat seqs))
205 (`string (apply #'concat seqs))
206 (`list (apply #'append (append seqs '(nil))))
207 (_ (error "Not a sequence type name: %S" type))))
208 204
209(cl-defgeneric seq-into (seq type) 205(cl-defgeneric seq-into (seq type)
210 "Convert the sequence SEQ into a sequence of type TYPE. 206 "Convert the sequence SEQ into a sequence of type TYPE.