GNU bug report logs - #25122
24.5; function describe-variable hangs on large variables

Previous Next

Package: emacs;

Reported by: Boruch Baum <boruch_baum <at> gmx.com>

Date: Tue, 6 Dec 2016 02:21:02 UTC

Severity: minor

Tags: fixed, patch

Merged with 13439, 21717

Found in versions 24.4.50, 24.5

Fixed in version 26.1

Done: npostavs <at> users.sourceforge.net

Bug is archived. No further changes may be made.

Full log


Message #66 received at 25122 <at> debbugs.gnu.org (full text, mbox):

From: npostavs <at> users.sourceforge.net
To: Thierry Volpiatto <thierry.volpiatto <at> gmail.com>
Cc: 25122 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>,
 Boruch Baum <boruch_baum <at> gmx.com>
Subject: Re: bug#25122: 24.5;
 function describe-variable hangs on large variables
Date: Sun, 12 Mar 2017 12:32:48 -0400
> 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.




This bug report was last modified 8 years and 28 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.