GNU bug report logs - #68072
pp functions have O(n^2) runtime with lisp-indent-function set to common-lisp-indent-function

Previous Next

Package: emacs;

Reported by: Brennan Vincent <brennan <at> umanwizard.com>

Date: Thu, 28 Dec 2023 00:11:02 UTC

Severity: normal

Full log


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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: João Távora <joaotavora <at> gmail.com>
Cc: Brennan Vincent <brennan <at> umanwizard.com>, 68072 <at> debbugs.gnu.org
Subject: Re: bug#68072: pp functions have O(n^2) runtime with
 lisp-indent-function set to common-lisp-indent-function
Date: Thu, 04 Jan 2024 22:50:51 -0500
> And Eglot should probably use a faster pretty printer than the default
> `pp` for that.  Maybe we should make `lisp-data-mode` set
> `pp-default-function` or `lisp-indent-function` to avoid such problems?

Jsonrpc uses the pretty printer via `pp-to-string` so there's no major
mode to change (and `pp-to-string` isn't told whether it's printing code
or data 🙁), and in order to run on older Emacsen it can't really use
the `pp-function` argument either.

So in the mean time, maybe the patch below is in order?
João, any comment?


        Stefan


diff --git a/lisp/jsonrpc.el b/lisp/jsonrpc.el
index 3f33443f321..f0f5842a0ee 100644
--- a/lisp/jsonrpc.el
+++ b/lisp/jsonrpc.el
@@ -1011,7 +1010,9 @@
                        (format "%s%s" preamble
                                (or (and foreign-message
+                                    (let ((lisp-indent-function ;bug#68072
+                                           #'lisp-indent-function))
                                         (concat "\n" (pp-to-string
-                                                      foreign-message)))
+                                                    foreign-message))))
                                    (concat log-text "\n")))))))
           (goto-char (point-max))





This bug report was last modified 1 year and 160 days ago.

Previous Next


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