summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/cl-extra.el
diff options
context:
space:
mode:
authorTassilo Horn <tsdh@gnu.org>2019-02-20 16:58:57 +0100
committerTassilo Horn <tsdh@gnu.org>2019-02-20 16:58:57 +0100
commite5c99a1757c281953257ac2548fb77702af75c86 (patch)
tree4820116244ad6650f53208bc792ca248ccc630fb /lisp/emacs-lisp/cl-extra.el
parentbfa10b704ebe71c91d5e5eb28e407a02d2d88863 (diff)
parentae77728d14e58054bdaee3c6965979947c778208 (diff)
downloademacs-scratch/replace-region-contents.tar.gz
Merge branch 'master' into scratch/replace-region-contentsscratch/replace-region-contents
Diffstat (limited to 'lisp/emacs-lisp/cl-extra.el')
-rw-r--r--lisp/emacs-lisp/cl-extra.el8
1 files changed, 4 insertions, 4 deletions
diff --git a/lisp/emacs-lisp/cl-extra.el b/lisp/emacs-lisp/cl-extra.el
index 99b55ad6b72..a2400a0ba37 100644
--- a/lisp/emacs-lisp/cl-extra.el
+++ b/lisp/emacs-lisp/cl-extra.el
@@ -594,10 +594,10 @@ too large if positive or too small if negative)."
;;;###autoload
(defun cl-list-length (x)
"Return the length of list X. Return nil if list is circular."
- (let ((n 0) (fast x) (slow x))
- (while (and (cdr fast) (not (and (eq fast slow) (> n 0))))
- (setq n (+ n 2) fast (cdr (cdr fast)) slow (cdr slow)))
- (if fast (if (cdr fast) nil (1+ n)) n)))
+ (cl-check-type x list)
+ (condition-case nil
+ (length x)
+ (circular-list)))
;;;###autoload
(defun cl-tailp (sublist list)