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: Thierry Volpiatto
Subject: bug#25122: 24.5; function describe-variable hangs on large variables
Date: Tue, 06 Dec 2016 07:41:13 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

Boruch Baum <address@hidden> writes:

> Subject: 24.5; function describe-variable hangs on large variables
>
> 1) When evaluating function describe-variable for variable
> package-archive-conteqnts, emacs hangs for minutes before I gave up.

I have already reported this bug.
I use this to workaround it:

    (progn
        ;; Speedup `describe-variable' for variables with huge value 
description.
        (defun tv/describe-variable (old-fn &rest args)
          ;; `cl-flet' can't be used here because `pp' should
          ;; appear lexically in its body, which is not the case.
          ;; Using `flet' is an option, but even better is binding
          ;; (symbol-function 'pp) with `cl-letf'.
          (cl-letf (((symbol-function 'pp)
                     (lambda (object &optional stream)
                       (let ((fn (lambda (ob &optional stream)
                                   (princ (pp-to-string ob)
                                          (or stream standard-output))
                                   (terpri)))
                             (print-circle t))
                         (if (consp object)
                             (progn
                               (insert "\n(")
                               (mapc fn object)
                               (cl-letf (((point) (1- (point))))
                                 (insert ")")))
                             (funcall fn object stream))))))
            (apply old-fn args)))
        (advice-add 'describe-variable :around #'tv/describe-variable))






reply via email to

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