bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#25122: 24.5; function describe-variable hangs on large variables


From: npostavs
Subject: bug#25122: 24.5; function describe-variable hangs on large variables
Date: Sun, 12 Mar 2017 12:32:48 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux)

> We could probably achieve something similar without breaking circular
> printing by not calling indent-sexp on the full list

The following patch is almost as fast as the mapc 'pp trick, but doesn't
get stuck on circular lists.  The indentation is a bit off: sublists
after the first one incorrectly start in column 0.  Also, this doesn't
really solve the performance problem, it just makes it much less likely
to occur, e.g., (pp (list load-history)) is still slow.

---   i/lisp/emacs-lisp/pp.el
+++   w/lisp/emacs-lisp/pp.el
@@ -76,9 +76,15 @@ pp-buffer
        (progn (skip-chars-forward " \t\n") (point)))
       (insert ?\n))
      (t (goto-char (point-max)))))
   (goto-char (point-min))
-  (indent-sexp))
+  (condition-case () (down-list)
+    (scan-error nil))
+  (while (and (not (eobp))
+              (condition-case () (progn (indent-sexp)
+                                        (forward-sexp)
+                                        t)
+                (scan-error nil)))))
 
 ;;;###autoload
 (defun pp (object &optional stream)
   "Output the pretty-printed representation of OBJECT, any Lisp object.





reply via email to

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