From 9552485c4d471a02cd3973d4458d8513a81f9c85 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Sat, 14 Apr 2018 01:02:25 -0400 Subject: Fix cl-print for circular sublists (Bug#31146) * lisp/emacs-lisp/cl-print.el (cl-print-object) : Push each element of list being printed onto cl-print--currently-printing. * test/lisp/emacs-lisp/cl-print-tests.el (cl-print-circle-2): New test. (cherry picked from commit b8aa7ecf54c9b164a59f1b0e9f9fe90531dadd20) --- test/lisp/emacs-lisp/cl-print-tests.el | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test/lisp/emacs-lisp/cl-print-tests.el') diff --git a/test/lisp/emacs-lisp/cl-print-tests.el b/test/lisp/emacs-lisp/cl-print-tests.el index 660d5c80692..d986c4015d7 100644 --- a/test/lisp/emacs-lisp/cl-print-tests.el +++ b/test/lisp/emacs-lisp/cl-print-tests.el @@ -55,4 +55,14 @@ (let ((print-circle t)) (should (equal "(#1=(a . #1#) #1#)" (cl-prin1-to-string x)))))) +(ert-deftest cl-print-circle-2 () + ;; Bug#31146. + (let ((x '(0 . #1=(0 . #1#)))) + (let ((print-circle nil)) + (should (string-match "\\`(0 0 . #[0-9])\\'" + (cl-prin1-to-string x)))) + (let ((print-circle t)) + (should (equal "(0 . #1=(0 . #1#))" (cl-prin1-to-string x)))))) + + ;;; cl-print-tests.el ends here. -- cgit v1.2.1