emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 291593a: Fix cl-subseq and cl-concatenate


From: Nicolas Petton
Subject: [Emacs-diffs] master 291593a: Fix cl-subseq and cl-concatenate
Date: Mon, 24 Aug 2015 08:27:31 +0000

branch: master
commit 291593a0571dd62ae809ed337aca8b9e62a5fddc
Author: Nicolas Petton <address@hidden>
Commit: Nicolas Petton <address@hidden>

    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.
---
 lisp/emacs-lisp/cl-extra.el |   16 ++++++++++------
 lisp/emacs-lisp/seq.el      |    6 +-----
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/lisp/emacs-lisp/cl-extra.el b/lisp/emacs-lisp/cl-extra.el
index 90ca531..7a7712a 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)."
         ((listp seq)
          (let (len
                (errtext (format "Bad bounding indices: %s, %s" start end)))
-           (and end (< end 0) (setq end (+ end (setq len (seq-length seq)))))
-           (if (< start 0) (setq start (+ start (or len (setq len (seq-length 
seq))))))
+           (and end (< end 0) (setq end (+ end (setq len (length seq)))))
+           (if (< start 0) (setq start (+ start (or len (setq len (length 
seq))))))
            (unless (>= start 0)
              (error "%s" errtext))
            (when (> start 0)
@@ -543,14 +543,18 @@ too large if positive or too small if negative)."
                    (push (pop seq) res))
                  (or (= (1+ end) start) (error "%s" errtext))
                  (nreverse res))
-             (seq-copy seq))))
+             (copy-sequence seq))))
         (t (error "Unsupported sequence: %s" seq))))
 
 ;;;###autoload
-(defalias 'cl-concatenate #'seq-concatenate
+(defun cl-concatenate (type &rest sequences)
   "Concatenate, into a sequence of type TYPE, the argument SEQUENCEs.
-\n(fn TYPE SEQUENCE...)")
-
+\n(fn TYPE SEQUENCE...)"
+  (pcase type
+    (`vector (apply #'vconcat sequences))
+    (`string (apply #'concat sequences))
+    (`list (apply #'append (append sequences '(nil))))
+    (_ (error "Not a sequence type name: %S" type))))
 
 ;;; List functions.
 
diff --git a/lisp/emacs-lisp/seq.el b/lisp/emacs-lisp/seq.el
index 5ce4d91..6a386bd 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."
 TYPE must be one of following symbols: vector, string or list.
 
 \n(fn TYPE SEQUENCE...)"
-  (pcase type
-    (`vector (apply #'vconcat seqs))
-    (`string (apply #'concat seqs))
-    (`list (apply #'append (append seqs '(nil))))
-    (_ (error "Not a sequence type name: %S" type))))
+  (apply #'cl-concatenate type seqs))
 
 (cl-defgeneric seq-into (seq type)
   "Convert the sequence SEQ into a sequence of type TYPE.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]